User Tools

Site Tools


abel:codes:lightcontrol

Lightcontrol

Used to control a glowlamp.

glowlamp.abl
MODULE helligkeit
	"Autor: lunetikk
	"Zweck: Helligkeit einer Glühlampe

TITLE 'helligkeit'

 declarations

  FF0,FF1,FF2,FF3 	  pin 3,4,5,6 	        istype 'buffer,reg';
  S0, S1		  pin 19, 21		istype 'buffer,com';
  takt		 	  pin 11;
  A			  pin 32;
  A0,A1,A2,A3 	          node 	         	istype 'buffer,reg';
  run 			  node;

  CTR = [FF0,FF1,FF2,FF3];
  LOG1= [A0,A1,A2,A3];


 equations
  
  CTR.clk = takt;
  LOG1.clk = takt;

 Truth_Table

  "Zähler
    ([FF3, FF2, FF1, FF0] :> [FF3, FF2, FF1, FF0])

		[0,0,0,0] :> [0,0,0,1];		"0
		[0,0,0,1] :> [0,0,1,0]; 	"1
		[0,0,1,0] :> [0,0,1,1]; 	"2
		[0,0,1,1] :> [0,1,0,0]; 	"3
		[0,1,0,0] :> [0,1,0,1]; 	"4
		[0,1,0,1] :> [0,1,1,0]; 	"5
		[0,1,1,0] :> [0,1,1,1]; 	"6
		[0,1,1,1] :> [1,0,0,0]; 	"7
		[1,0,0,0] :> [1,0,0,1]; 	"8
		[1,0,0,1] :> [1,0,1,0]; 	"9
		[1,0,1,0] :> [0,0,0,0]; 	"10
		[1,0,1,1] :> [.x.,.x.,.x.,.x.]; 	"11
		[1,1,0,0] :> [.x.,.x.,.x.,.x.]; 	"12
		[1,1,0,1] :> [.x.,.x.,.x.,.x.]; 	"13
		[1,1,1,0] :> [.x.,.x.,.x.,.x.]; 	"14
		[1,1,0,1] :> [.x.,.x.,.x.,.x.]; 	"15
 
 Truth_Table

  "Logik1 Codeumsetzer

   ([FF3, FF2, FF1, FF0] :> [A3,A2,A1,A0])

	[0,0,0,1] :> [1,0,0,0];  "1 
	[0,0,1,0] :> [1,0,0,0];  "2 
	[0,0,1,1] :> [1,1,0,0];  "3 
	[0,1,0,0] :> [1,1,0,0];  "4 
	[0,1,0,1] :> [1,1,0,0];  "5 
	[0,1,1,0] :> [1,1,1,0];  "6 
	[0,1,1,1] :> [1,1,1,0];  "7 
	[1,0,0,0] :> [1,1,1,0];  "8 
	[1,0,0,1] :> [1,1,1,0];  "9 
	[1,0,1,0] :> [1,1,1,0];  "10
	[0,0,0,0] :> [1,0,0,0];  "0


 Equations

   "Logik2


	when ( (S1 == 0) &  (S0 == 0) ) then A = A0;
	when ( (S1 == 0) &  (S0 == 1) ) then A = A1;
	when ( (S1 == 1) &  (S0 == 0) ) then A = A2;
	when ( (S1 == 1) &  (S0 == 1) ) then A = A3;


 END



abel/codes/lightcontrol.txt · Last modified: 2018/12/20 17:42 by lunetikk