Greital
Newbie level 4
hi
still working on my 8051 project using assembly language, and now I'm in phase 4 --->>>> the last phase
in this phase we should generate 2 random numbers as following:
1. one digit (1-9)
2. two digit (10-99)
and by using push button we pick randomly the number
we have done one digit perfectly, but we face a problem with the two digit
we used a counter with 99 numbers and decrements it each time until the user push a button to interrupt the function and show the number randomly
but the problem that it shows the one digit also :???:
we tried to make the counter to start from 10 and increment it each time until we reach 99 --->>> but also it didn't work :bang:
we tried and tried and tried :bang: but nothing work
the code :
please help
still working on my 8051 project using assembly language, and now I'm in phase 4 --->>>> the last phase
in this phase we should generate 2 random numbers as following:
1. one digit (1-9)
2. two digit (10-99)
and by using push button we pick randomly the number
we have done one digit perfectly, but we face a problem with the two digit
we used a counter with 99 numbers and decrements it each time until the user push a button to interrupt the function and show the number randomly
but the problem that it shows the one digit also :???:
we tried to make the counter to start from 10 and increment it each time until we reach 99 --->>> but also it didn't work :bang:
we tried and tried and tried :bang: but nothing work
the code :
Code:
ORG 0H
LJMP MAIN
ORG 0003H ; EX0 interrupt vector address
LJMP EX0ISR
ORG 0030H
MAIN:
MOV IE,#10000001B ; Enable EX0 interrupts
SETB IT0 ;Make EX0 edge-triggered interrupt
LCALL INLCD ; Initialize LCD
LABEL:
MOV R4,#99
LOOP:
DJNZ R4,LOOP
SJMP LABEL
;---------------------------------------
EX0ISR:
MOV A,R4
CJNE R4,#09,GENERATE
COME_HERE:
DJNZ R4,COME_HERE
SJMP OUT
GENERATE:
MOV 44H,A
MOV A,#1000B ; Move cursor to 1st line - send high nibble
LCALL CMD
MOV A,#0000B ; send low nibble
LCALL CMD
LCALL LDELAY ; 4.1 msec required for this command
MOV A,44H
MOV B,#10
DIV AB
MOV 36H,B
ADD A,#30H
LCALL WCHR
MOV A,36H
ADD A,#30H
LCALL WCHR
OUT:
RETI
please help