Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC program Error message. Can someone help?

Status
Not open for further replies.

BABYBASS210

New Member
Hello everyone,

I am trying to program a 16F84 and I am having some difficulties.

What I want to do is change the state of outputs portA and port B at the same time but I get errors when I assemble.

Can someone take a look and please help me out?

Thank you so much.

Sincerely,
Joey Hernandez.

Here is the program:



; ------------------
; CONFIGURATION FUSE
; ------------------
;
__CONFIG 0x3FFB

;
;
;
;
STATUS equ 0x03
RP0 equ 0x05
PORTA equ 0x05
PORTB equ 0x06
TRISA equ 0x85
TRISB equ 0x86
DelayA equ 0x0C
DelayB equ 0x0D
DelayC equ 0x0E
;
; START
;
;
org 0h ; startup address = 0000


movlw b'00000000'
movwf PORTA ; all PORTA pins = 1
movlw b'11111111'
movwf PORTB ; all PORTB pins = 0
bsf STATUS,RP0 ; set RP0 for RAM page 1
movlw b'00000000' ; all PortA = outputs
movwf TRISA
movlw b'11111111' ; all PortB = outputs
movwf TRISB
bcf STATUS,RP0 ; set RP0 for RAM page 0

MainLoop movlw b'00000001'
movwf PORTA
call Delay500

movlw b'11111110'
movwf PORTB
call Delay500

movlw b'00000010'
movwf PORTA
call Delay500

movlw b'10111101'
movwf PORTB
call Delay500

goto MainLoop ; do this loop forever
end


; --------------------------------
; SUBROUTINE: waste time for 500mS
; --------------------------------
;
Delay500 clrf DelayA ; clear DelayA to 0
clrf DelayB ; clear DelayB to 0
movlw 3h ; set DelayC to 3
movwf DelayC
Wait1 decfsz DelayA ; subtract 1 from DelayA
goto Wait1 ; if not 0, goto Wait1
decfsz DelayB ; subtract 1 from DelayB
goto Wait1 ; if not 0, goto Wait1
decfsz DelayC ; subtract 1 from DelayC
goto Wait1 ; if not 0, goto Wait1
return ; finished the delay

end

THESE ARE THE ERROR MESSAGES:

Message[302] C:\3081\GFD.TXT 34 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\3081\GFD.TXT 36 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[113] C:\3081\GFD.TXT 41 : Symbol not previously defined (Delay500)
Error[113] C:\3081\GFD.TXT 45 : Symbol not previously defined (Delay500)
Error[113] C:\3081\GFD.TXT 49 : Symbol not previously defined (Delay500)
Error[113] C:\3081\GFD.TXT 53 : Symbol not previously defined (Delay500)
 
Correction on the spacing of the program.

Even though the program looks wrong because of the spacings, the spacings where correct the got repositioned when I copied and pasted it to the Electro Tech message body.

Joey Hernandez
 
Be careful where you place the END statement. All statements are ignored after that.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top