Hi! I am currently a new programmer programming a PIC16C745 IC. Can any people out there take a look at my code and advice me what is wrong.I am trying to detect an input at RB0 and give an output and RB5. Thanks!
#include <p16c745.inc>
#define LED PORTB,5 ;
#define switch PORTB,0 ;
ORG 00H ;
BCF STATUS, RP1 ;
BCF STATUS, RP0 ;
CLRF PORTB ; Initialize PORTB by
; clearing output
; data latches
BSF STATUS, RP0 ; Select Bank 1
MOVLW 06H ; Configure all pins
MOVWF ADCON1 ; as digital inputs
MOVLW 0xCF ; Value used to
; initialize data
; direction
MOVWF TRISB ; Set RB<3:0> as inputs
; RB<5:4> as outputs
; TRISB<7:6> are always
; read as ’0’.
GOTO main ;
main BTFSS switch ;
GOTO $-1 ;
BSF LED ;
BTFSC switch ;
GOTO $-1 ;
BCF LED ;
GOTO main ;
end
Bookmarks