Reputation: 1
list P=16f54
#include <p16f54.inc>
; CONFIG
; __config 0xFFFB
__CONFIG _OSC_RC & _WDT_OFF & _CP_OFF
org 1FFH
GOTO Start ; go to beginning of program
org 0
Init clrf PORTA ;reset ports
clrf PORTB
movlw b'00000000' ;set port-a I/O
movwf TRISA
movlw b'00000000' ;set port-b I/O
movwf TRISB
retlw 0
Start
call Init
Main
bsf PORTA, 0
GOTO Main ; loop forever
End
Upvotes: -1
Views: 84
Reputation: 75062
Check the datasheet of your target device:
PIC16F54 | Microchip Technology
According to this datasheet, PIC16F54 doesn't have TRIS registers in the register file.
Instead of general instructions like MOVWF
, you should use the special TRIS
instruction to set TRIS
registers in PIC16F54.
movlw b'00000000' ;set port-a I/O
;movwf TRISA
tris PORTA
movlw b'00000000' ;set port-b I/O
;movwf TRISB
tris PORTB
Upvotes: 1