User Tools

Site Tools


abel:codes:0to99bcd

0-99 BCD counter

0to99bcdcounter.abl
MODULE zaehler
"Author: Lunetikk
"Projekt: 0-99 BCD Zähler
TITLE 'zaehler'

@dcset
Declarations
"4-Zähler FFs 1er Stelle
DFF0 node istype 'buffer,reg';
DFF1 node istype 'buffer,reg';
DFF2 node istype 'buffer,reg';
DFF3 node istype 'buffer,reg';

"4-Zähler FFs 10er Stelle
Z0 node istype 'buffer,reg';
Z1 node istype 'buffer,reg';
Z2 node istype 'buffer,reg';
Z3 node istype 'buffer,reg';

run node;

"Ausgänge für die 7 Segmentanzeige (1er)
a,b,c,d,e,f,g pin 38,37,40,41,42,43,44  ISTYPE 'BUFFER,COM';
"Ausgänge für die 7 Segmentanzeige (10er)
h,i,j,k,l,m,n pin 4,3,6,7,8,9,10  ISTYPE 'BUFFER,COM';

"Eingang am alle FFs
takt pin 11;


Equations

"Takt an alle FFs
DFF0.clk = takt;
DFF1.clk = takt;
DFF2.clk = takt;
DFF3.clk = takt;
Z0.clk = takt;
Z1.clk = takt;
Z2.clk = takt;
Z3.clk = takt;



"RUN = 1 heisst Zehnerzähler ist aktiviert
"Run wird nur bei 9 auf der Einerstelle aktiviert
run = DFF3.q & !DFF2.q & !DFF1.q & DFF0.q;

Truth_Table
"BDC-Zähler Tabelle

([DFF3, DFF2, DFF1, DFF0] :> [DFF3, DFF2, DFF1, DFF0])

[0,0,0,0]:>[0,0,0,1]; "0-1
[0,0,0,1]:>[0,0,1,0]; "1-2
[0,0,1,0]:>[0,0,1,1]; "2-3
[0,0,1,1]:>[0,1,0,0]; "3-4
[0,1,0,0]:>[0,1,0,1]; "4-5
[0,1,0,1]:>[0,1,1,0]; "5-6
[0,1,1,0]:>[0,1,1,1]; "6-7
[0,1,1,1]:>[1,0,0,0]; "7-8
[1,0,0,0]:>[1,0,0,1]; "8-9
[1,0,0,1]:>[0,0,0,0]; "9-0
[1,0,1,0]:>[.x.,.x.,.x.,.x.]; "Don't care
[1,0,1,1]:>[.x.,.x.,.x.,.x.]; "Don't care
[1,1,0,0]:>[.x.,.x.,.x.,.x.]; "Don't care
[1,1,0,1]:>[.x.,.x.,.x.,.x.]; "Don't care
[1,1,1,0]:>[.x.,.x.,.x.,.x.]; "Don't care
[1,1,1,1]:>[.x.,.x.,.x.,.x.]; "Don't care


Truth_Table
"Codeumstzer 7-Segment Anzeige
([DFF3.q, DFF2.q, DFF1.q, DFF0.q]  ->   [a,b,c,d,e,f,g])
[0,0,0,0] -> [1,1,1,1,1,1,0]; //0
[0,0,0,1] -> [0,1,1,0,0,0,0]; //1
[0,0,1,0] -> [1,1,0,1,1,0,1]; //2
[0,0,1,1] -> [1,1,1,1,0,0,1]; //3
[0,1,0,0] -> [0,1,1,0,0,1,1]; //4
[0,1,0,1] -> [1,0,1,1,0,1,1]; //5
[0,1,1,0] -> [1,0,1,1,1,1,1]; //6
[0,1,1,1] -> [1,1,1,0,0,0,0]; //7
[1,0,0,0] -> [1,1,1,1,1,1,1]; //8
[1,0,0,1] -> [1,1,1,1,0,1,1]; //9
[1,0,1,0] -> [.x.,.x.,.x.,.x.,.x.,.x.,.x.]; //A
[1,0,1,1] -> [.x.,.x.,.x.,.x.,.x.,.x.,.x.]; //B
[1,1,0,0] -> [.x.,.x.,.x.,.x.,.x.,.x.,.x.]; //C
[1,1,0,1] -> [.x.,.x.,.x.,.x.,.x.,.x.,.x.]; //D
[1,1,1,0] -> [.x.,.x.,.x.,.x.,.x.,.x.,.x.]; //E
[1,1,1,1] -> [.x.,.x.,.x.,.x.,.x.,.x.,.x.]; //F

Truth_Table
"BDC-Zähler Tabelle

([run, Z3, Z2, Z1, Z0] :> [Z3, Z2, Z1, Z0])

[0,0,0,0,0]:>[0,0,0,0]; "0-1
[0,0,0,0,1]:>[0,0,0,1]; "1-2
[0,0,0,1,0]:>[0,0,1,0]; "2-3
[0,0,0,1,1]:>[0,0,1,1]; "3-4
[0,0,1,0,0]:>[0,1,0,0]; "4-5
[0,0,1,0,1]:>[0,1,0,1]; "5-6
[0,0,1,1,0]:>[0,1,1,0]; "6-7
[0,0,1,1,1]:>[0,1,1,1]; "7-8
[0,1,0,0,0]:>[1,0,0,0]; "8-9
[0,1,0,0,1]:>[1,0,0,1]; "9-0
[0,1,0,1,0]:>[.x.,.x.,.x.,.x.]; "Don't care
[0,1,0,1,1]:>[.x.,.x.,.x.,.x.]; "Don't care
[0,1,1,0,0]:>[.x.,.x.,.x.,.x.]; "Don't care
[0,1,1,0,1]:>[.x.,.x.,.x.,.x.]; "Don't care
[0,1,1,1,0]:>[.x.,.x.,.x.,.x.]; "Don't care
[0,1,1,1,1]:>[.x.,.x.,.x.,.x.]; "Don't care

[1,0,0,0,0]:>[0,0,0,1]; "0-1
[1,0,0,0,1]:>[0,0,1,0]; "1-2
[1,0,0,1,0]:>[0,0,1,1]; "2-3
[1,0,0,1,1]:>[0,1,0,0]; "3-4
[1,0,1,0,0]:>[0,1,0,1]; "4-5
[1,0,1,0,1]:>[0,1,1,0]; "5-6
[1,0,1,1,0]:>[0,1,1,1]; "6-7
[1,0,1,1,1]:>[1,0,0,0]; "7-8
[1,1,0,0,0]:>[1,0,0,1]; "8-9
[1,1,0,0,1]:>[0,0,0,0]; "9-0
[1,1,0,1,0]:>[.x.,.x.,.x.,.x.]; "Don't care
[1,1,0,1,1]:>[.x.,.x.,.x.,.x.]; "Don't care
[1,1,1,0,0]:>[.x.,.x.,.x.,.x.]; "Don't care
[1,1,1,0,1]:>[.x.,.x.,.x.,.x.]; "Don't care
[1,1,1,1,0]:>[.x.,.x.,.x.,.x.]; "Don't care
[1,1,1,1,1]:>[.x.,.x.,.x.,.x.]; "Don't care


Truth_Table
"Codeumstzer 7-Segment Anzeige

([Z3, Z2, Z1, Z0]  ->   [h,i,j,k,l,m,n])

[0,0,0,0] -> [1,1,1,1,1,1,0]; //0
[0,0,0,1] -> [0,1,1,0,0,0,0]; //1
[0,0,1,0] -> [1,1,0,1,1,0,1]; //2
[0,0,1,1] -> [1,1,1,1,0,0,1]; //3
[0,1,0,0] -> [0,1,1,0,0,1,1]; //4
[0,1,0,1] -> [1,0,1,1,0,1,1]; //5
[0,1,1,0] -> [1,0,1,1,1,1,1]; //6
[0,1,1,1] -> [1,1,1,0,0,0,0]; //7
[1,0,0,0] -> [1,1,1,1,1,1,1]; //8
[1,0,0,1] -> [1,1,1,1,0,1,1]; //9
[1,0,1,0] -> [.x.,.x.,.x.,.x.,.x.,.x.,.x.]; //A
[1,0,1,1] -> [.x.,.x.,.x.,.x.,.x.,.x.,.x.]; //B
[1,1,0,0] -> [.x.,.x.,.x.,.x.,.x.,.x.,.x.]; //C
[1,1,0,1] -> [.x.,.x.,.x.,.x.,.x.,.x.,.x.]; //D
[1,1,1,0] -> [.x.,.x.,.x.,.x.,.x.,.x.,.x.]; //E
[1,1,1,1] -> [.x.,.x.,.x.,.x.,.x.,.x.,.x.]; //F


END



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