Last Updated or created 2022-09-14
The ATF22V10 is a Programmable Logic Device. This means you can program the logic in the chip.
Internally it looks like a big matrix of connections which you can program to connect/disconnect from certain logic.
It has just a bunch of inputs/outputs
So if we want to have a 7 Segment decoder (you can easily buy a BCD decoder .. but these only work for displaying 0-9 and not 0-9A-F for displaying HEX numbers)
Binary IN | 7 Segment decoded | Displays |
D C B A | 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 | 1 1 1 0 1 1 1 | A |
1 0 1 1 | 0 0 1 1 1 1 1 | B |
1 1 0 0 | 1 0 0 1 1 1 0 | C |
1 1 0 1 | 0 1 1 1 1 0 1 | D |
1 1 1 0 | 1 0 0 1 1 1 1 | E |
1 1 1 1 | 1 0 0 0 1 1 1 | F |
Now we see that segment A is 1 in the case of (0,2,3,5,6,7,8,9,A,C,E,F)
When programming the PLD we can write that as: (note / means inverted a plus is OR, and * is AND)
So A is 0 in case of input being (1,4,B,D)
/QA = /D1 * /C1 * /B1 * A1
+ /D1 * C1 * /B1 * /A1
+ D1 * /C1 * B1 * A1
+ D1 * C1 * /B1 * A1
Complete code for galasm
Compiling and burning
GAL22V10 7SEGMENT Clock D1 C1 B1 A1 D2 C2 B2 A2 NC NC GND /OE NC NC NC QG QF QE QD QC QB QA VCC /QA = /D1 * /C1 * /B1 * A1 + /D1 * C1 * /B1 * /A1 + D1 * /C1 * B1 * A1 + D1 * C1 * /B1 * A1 /QB= /D1 * C1 * /B1 * A1 + /D1 * C1 * B1 * /A1 + D1 * /C1 * B1 * A1 + D1 * C1 * /B1 * /A1 + D1 * C1 * B1 * /A1 + D1 * C1 * B1 * A1 /QC = /D1 * /C1 * B1 * /A1 + D1 * C1 * /B1 * /A1 + D1 * C1 * B1 * /A1 + D1 * C1 * B1 * A1 /QD= /D1 * /C1* /B1 * A1 + /D1 * C1 * /B1 * /A1 + /D1 * C1 * B1 * A1 + D1 * /C1 * B1 * /A1 + D1 * C1 * B1 * A1 /QE = /D1 * /C1 * /B1 * A1 + /D1 * /C1 * B1 * A1 + /D1 * C1 * /B1 * /A1 + /D1 * C1 * /B1 * A1 + /D1 * C1 * B1 * A1 + D1 * /C1 * /B1 * A1 /QF = /D1 * /C1 * /B1 * A1 + /D1 * /C1 * B1 * /A1 + /D1 * /C1 * B1 * A1 + /D1 * C1 * B1 * A1 + D1 * C1 * /B1 * A1 /QG = /D1 * /C1 * /B1 * /A1 + /D1 * /C1 * /B1 * A1 + /D1 * C1 * B1 * A1 + D1 * C1 * /B1 * /A1 DESCRIPTION A 7 segment hex decoder
galasm 7seghex.gal
minipro -p ATF22V10CQZ -w 7seghex.jed
minipro -p ATF22V10CQZ -w 7seghex.jed Found TL866II+ 04.2.129 (0x281) Warning: Firmware is newer than expected. Expected 04.2.128 (0x280) Found 04.2.129 (0x281) VPP=12V Warning! JED file doesn't match the selected device! Declared fuse checksum: 0x98D5 Calculated: 0x98D5 ... OK Declared file checksum: 0x40B3 Calculated: 0x41A8 ... Mismatch! JED file parsed OK Use -P to skip write protect Erasing... 0.33Sec OK Writing jedec file... 5.01Sec OK Reading device... 0.32Sec OK Writing lock bit... 0.35Sec OK Verification failed at address 0x16C6: File=0x01, Device=0x00 < ------------------ Gives error, but burning seems okay henri@zspot:~/projects/galasm$ minipro -p ATF22V10CQZ -r 7seghex.out Found TL866II+ 04.2.129 (0x281) Warning: Firmware is newer than expected. Expected 04.2.128 (0x280) Found 04.2.129 (0x281) Reading device... 0.32Sec OK Gives all zeros as output, but device works!