I have written the following assembly code (for an 8052 soft processor) to show a number on my Altera DE-2's 8 7-segment displays:
mov HEX0, #0x98 ; show 9 mov HEX1, #0xC0 ; show 0 mov HEX2, #0xF9 ; show 1 mov HEX3, #0xF8 ; show 7 mov HEX4, #0x92 ; show 5 mov HEX5, #0x92 ; show 5 mov HEX6, #0x92 ; show 5 mov HEX7, #0xA4 ; show 2
HEXns are defined as follows:
HEX0 DATA 091H ; Zero turns the segment on HEX1 DATA 092H ; HEX2 DATA 093H ; HEX3 DATA 094H ; HEX4 DATA 08EH ; HEX5 DATA 08FH ; HEX6 DATA 096H ; HEX7 DATA 097H ;
The above code works just fine on its own, but when I try to rotate the number using the following code, all of the 7-segment displays output as though the HEXn registers were set to 0x00.
M0: wait(2) mov A, HEX0 ; store HEX0 in the accumulator mov HEX0, HEX1 mov HEX1, HEX2 mov HEX2, HEX3 mov HEX3, HEX4 mov HEX4, HEX5 mov HEX5, HEX6 mov HEX6, HEX7 mov HEX7, A ljmp M0 END
wait(2) is a macro that uses up about two seconds worth of clock cycles. Could someone tell me (or even speculate) as to why HEXn are being written to 0?