??? 09/23/04 04:44 Read: times |
#77976 - Maybe this will work.... Responding to: ???'s previous message |
I have modified the code below ( already suggested by Russell )and this should work. You can also think about the following :
> Name the internal ram locations instead of calling them 30h, 31h etc > Terminate your code with and END directive. > Make your intentions or rather the program's intentions very clear as comments in the begining.Maybe this is too simple to comment - but then you have to start with good habits some day. Why not now ? > Initialize all variables at the right place. OK out of the above, the MCU is just not bothered about the first three points - but it will help us humans in a big way ;-) ; EXAMPLE - 01 led equ p2.0 org 0000h ljmp 0050h org 0050h start: clr led acall Delay1 setb led acall Delay2 sjmp start Delay1: mov 30h, #0ffh mov 31h, #0ffh time1: djnz 30h,time1 time2: djnz 31h,time2 ret Delay2: mov 30h, #0ffh mov 31h, #0ffh mov 32h, #0ffh time3: djnz 30h,time3 time4: djnz 31h,time4 time5: djnz 32h,time5 ret end Raghu |