I'm doing a more featured custom decoder, which will display both letters and digits on max7219 7 segment display. It will also have custom decoder for digital values. The code is below:
This code works, but DLEN instead of cropping digits from the left, crops them from the right - say initial variable is "12345" and I want to display 2 digits from it, I'm getting "45" instead of "12", have no idea why. Same for start position - DSTART starts from rightmost position, instead of leftmost....Code:FOURD=12345 'test value dstart=2 'start segment DLEN=2 'decode length TEST: 'test digits FOR x=DLEN TO 1 STEP -1 Z=FOURD DIG X+1 'EXTRACT VALUE GOSUB FOURDEC PAUSE 500 NEXT GOTO TEST FOURDEC: 'DIGIT DECODER if Z=0 then Y=126 if Z=1 then Y=48 if z=2 then Y=109 if z=3 then Y=121 if z=4 then Y=51 if z=5 then Y=91 if z=6 then Y=95 if z=7 then Y=112 if z=8 then Y=127 if z=9 then Y=115 low load shiftout datapin,clockpin,1,[x+DSTART-1, y] 'DISPLAY THE LETTER high load RETURN




Bookmarks