jayanth.devarayanadurga
Banned
- Joined
- Dec 4, 2012
- Messages
- 4,280
- Helped
- 822
- Reputation
- 1,654
- Reaction score
- 791
- Trophy points
- 1,393
- Location
- Bangalore, India
- Activity points
- 0
I am posting a delay code generated at
I see goto $+1 and $+2 instructions but I don't see $+1 and $+2 labels. Can anyone tell me where to put the labels. I want $+1 and $+2 to be replaced by loop1 and loop2 labels.
Edit: I came to know that $+2 stands for jump to two instructions below and $+1 stands for jump to one instruction below. So Is my new code right?
I see goto $+1 and $+2 instructions but I don't see $+1 and $+2 labels. Can anyone tell me where to put the labels. I want $+1 and $+2 to be replaced by loop1 and loop2 labels.
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 ; Delay = 1 seconds ; Clock frequency = 20 MHz ; Actual delay = 1 seconds = 5000000 cycles ; Error = 0 % cblock d1 d2 d3 endc Delay ;4999993 cycles movlw 0x2C movwf d1 movlw 0xE7 movwf d2 movlw 0x0B movwf d3 Delay_0 decfsz d1, f goto $+2 decfsz d2, f goto $+2 decfsz d3, f goto Delay_0 ;3 cycles goto $+1 nop ;4 cycles (including call) return
Edit: I came to know that $+2 stands for jump to two instructions below and $+1 stands for jump to one instruction below. So Is my new code right?
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 ; Delay = 1 seconds ; Clock frequency = 20 MHz ; Actual delay = 1 seconds = 5000000 cycles ; Error = 0 % cblock d1 d2 d3 endc Delay ;4999993 cycles movlw 0x2C movwf d1 movlw 0xE7 movwf d2 movlw 0x0B movwf d3 Delay_0 decfsz d1, f goto loop2 decfsz d2, f loop2: goto loop2 decfsz d3, f goto Delay_0 ;3 cycles goto loop1 loop1: nop ;4 cycles (including call) return
Last edited: