~ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ~ ³ Test Program to Drive the ³ ~ ³ Seven-Digit LED Display with Colons ³ ~ ³ Author: Thomas Henry ³ ~ ³ 3/22/95 ³ ~ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ~ ~ Explanation: This program demonstrates the principle behind a ~ multiplexed display. Performing at a slowed down rate, the ~ multiplexing action is clearly visible. It simply lights the ~ seven 7-segment displays one at a time, while blinking the colons ~ on alternate counts. It can be used to confirm that all of the ~ segments and discrete LEDs are functional. Later, you can strip ~ out parts of the code and modify them to perform practical tasks ~ in your own project, or use the BASIC program as an outline for ~ a fully functional assembler routine. ~ ~ Once you start the program, which is a never-ending loop, type ~ CTRL-C to stop and exit to the command mode. ~ ~ The 7-segment common cathode LED devices are labeled in the ~ following fashion. The binary weight for each segment and the ~ decimal code required to show each of the ten digits are listed ~ in the accompanying tables. (Note: A zero to each segment turns ~ it ON in this circuit). ~ ~ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ~ ³ Segment Weight ³ ³ Digit Code ³ ~ a ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ~ ÄÄÄÄÄÄÄ ³ a 1 ³ ³ 0 64 ³ ~ ³ ³ ³ b 2 ³ ³ 1 121 ³ ~ f ³ g ³ b ³ c 4 ³ ³ 2 36 ³ ~ ÄÄÄÄÄÄÄ ³ d 8 ³ ³ 3 48 ³ ~ ³ ³ ³ e 16 ³ ³ 4 25 ³ ~ e ³ d ³ c ³ f 32 ³ ³ 5 18 ³ ~ ÄÄÄÄÄÄÄ ³ g 64 ³ ³ 6 2 ³ ~ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ 7 120 ³ ~ ³ 8 0 ³ ~ ³ 9 24 ³ ~ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ~ ~ ~ It is assumed that the LED Display is connected to a Blue Earth ~ Research Xplor-32d Personal Digital Controller. The connections ~ are made to the ports in the following way. Segments 4a5 through 4g5 ~ are connected to Port lines PB0 through PB6 respectively. ~ Counting from the leftmost digit of the LED display, digits 1 ~ through 7 are connected to P1.0 through P1.6 respectively, and ~ the colons are connected to P1.7. A one enables each digit. See ~ the schematic for further details. ~ ~ Required Port Addresses of the Xplor-32d (in decimal): ~ ~ Port 1 144 (digit select) ~ Port B 8448 (segment select) ~ Control Word 8960 (configures Ports A, B and C) ~ ~ By writing the number 128 to the Control Word, Ports A, B and C ~ will all be configured as outputs. This is what will be done in ~ the BASIC program below, even though only Port B is used in the ~ application. Port 1 does not need to be configured specially. ~ 10 XBY 8960 = 128 ~ configure Port B as output 20 DBY 144 = 128 ~ shut off all digits and colon 30 C=128 ~ flag: status of colon 40 S=1 ~ S now aims at first digit 50 FOR I=1 TO 7 ~ count through 7 digits total ~ 60 GOTO 60+I ~ encode segments to match I 61 D=121:GOTO 70 ~ 1 62 D=36:GOTO 70 ~ 2 63 D=48:GOTO 70 ~ 3 64 D=25:GOTO 70 ~ 4 65 D=18:GOTO 70 ~ 5 66 D=2:GOTO 70 ~ 6 67 D=120:GOTO 70 ~ 7 ~ 70 S=S OR C:C=C XOR 128 ~ factor in the colon; reverse status 80 XBY 8448=D:DBY144=S ~ turn on segments of selected device 90 FOR J=1 TO 200 ~ kill some time so we can see it 100 NEXT J 110 S=2*S AND 127 ~ prepare for next digit to the right 120 NEXT I ~ do next one 130 GOTO 40 ~ start all over again if on the right ~ 999 END ~