me1234
Newbie level 3
- Joined
- Dec 8, 2012
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,306
; assignment.asm
title"assignment.asm"
list p=18f452, f=inhx32
#include<p18f452.inc>
delaycnt equ 0x04
org 0x00
CLRF PORTA; initalizing port A by clearing output
CLRF PORTC; initalizing port C by clearing output
goto start
start MOVLW b'00000001' ;move literal value 1 to working register
MOVWF TRISA ;set RA <0> as input and rest as output
MOVLW b'11111100' ;move literal value 3 to working register
MOVWF TRISC ;set RC <1:0> as input and rest as output
loop BCF PORTA,0
BCF PORTC,0
BCF PORTC,0
call delay1
BSF PORTA,0
call delay2
delay1 movlw d'34' ;loop 50 micro seconds
movwf delaycnt
delayloop1 nop
nop
nop
nop
decfsz delaycnt, f
goto delayloop1
nop
nop
nop
nop
nop
nop
return
end
delay2 movlw d'70' ;loop 100 micro seconds
movwf delaycnt
delayloop2 nop
nop
nop
nop
decfsz delaycnt, f
goto delayloop2
nop
nop
nop
nop
return
end
IM GETTING AN ERROR SAYING DELAY2 HAS NOT BEEN DEFINED BUT I DNT UNDERSTAND WHY? COULD SOMEONE PLEASE HELP ME OUT?
ANOTHER STRANGE THING THAT HAPPENS IS THAT IF I DEFINE DELAY2 BEFORE DELAY1, THEN IT SAYS DELAY1 HAS NOT BEEN DEIFNED!!
HELP WOULD BE APPRECIATED!!
THANK YOU IN ADVANCE!!
title"assignment.asm"
list p=18f452, f=inhx32
#include<p18f452.inc>
delaycnt equ 0x04
org 0x00
CLRF PORTA; initalizing port A by clearing output
CLRF PORTC; initalizing port C by clearing output
goto start
start MOVLW b'00000001' ;move literal value 1 to working register
MOVWF TRISA ;set RA <0> as input and rest as output
MOVLW b'11111100' ;move literal value 3 to working register
MOVWF TRISC ;set RC <1:0> as input and rest as output
loop BCF PORTA,0
BCF PORTC,0
BCF PORTC,0
call delay1
BSF PORTA,0
call delay2
delay1 movlw d'34' ;loop 50 micro seconds
movwf delaycnt
delayloop1 nop
nop
nop
nop
decfsz delaycnt, f
goto delayloop1
nop
nop
nop
nop
nop
nop
return
end
delay2 movlw d'70' ;loop 100 micro seconds
movwf delaycnt
delayloop2 nop
nop
nop
nop
decfsz delaycnt, f
goto delayloop2
nop
nop
nop
nop
return
end
IM GETTING AN ERROR SAYING DELAY2 HAS NOT BEEN DEFINED BUT I DNT UNDERSTAND WHY? COULD SOMEONE PLEASE HELP ME OUT?
ANOTHER STRANGE THING THAT HAPPENS IS THAT IF I DEFINE DELAY2 BEFORE DELAY1, THEN IT SAYS DELAY1 HAS NOT BEEN DEIFNED!!
HELP WOULD BE APPRECIATED!!
THANK YOU IN ADVANCE!!