Loop
btfss PORTA,0 ;skip if port A high
bcf PORTC,0 ;else set Port C low
btfsc PORTA,0 ;skip if port A low
bsf PORTC,0 ;else set Port C high
goto Loop ;repeat forever
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
org 0
Start:
bsf STATUS,RP0 ;select Register Page 1
clrf TRISC ;make make port C outputs
bcf STATUS,RP0 ;back to Register Page 0
bsf STATUS,RP1 ;page 2
clrf ANSEL ;turn off ADC
bcf STATUS,RP1 ;back to page 0
movlw 1 ;turn on LED
movwf PORTC ;on port C
Loop
btfss PORTA,0 ;skip if port A high
bcf PORTC,0 ;else set Port C low
btfsc PORTA,0 ;skip if port A low
bsf PORTC,0 ;else set Port C high
goto Loop ;repeat forever
end
That's for sure with a 16f690 PORTC is anologue to it's not a easy chip to setup. if you haven't use any pic much I was just going to post him some thing all most like that but with banksel for register switchingMany pitfalls that getting example code to play with is normally the best starting point.
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
org 0
Start:
banksel PORTA
clrf PORTA ;Init PORTA
banksel ANSEL ;Bank 2
clrf ANSEL ;digital I/O
banksel TRISA
movlw b'00001000' ;Set RA3 as input
movwf TRISA ;and set as outputs
banksel TRISC ;Bank 0
clrf TRISC ;make ouputs
banksel PORTC
clrf PORTC
goto run
run:
btfss PORTA,3 ;skip next if PORTA high
bsf PORTC,0 ;set PORTC High
btfsc PORTA,3 ;skip next if PORTA low
bcf PORTC,0 ;set PORTC Low
goto run ;keep checking the switch
end
It's 0 to1024 with that chip but it can do a 0 to 256 down load the data sheet I posted start at page195certain amount of resolution when monitoring a variable input? I guessing 0-255
Hi guys,
I have just bought the pickit2 pic16f690 starter kit with the lpc demo board.
I have ran into a wall with getting the push button working....
I have found though that when I jumper Vdd to RA3 it works! So, the pic must always be seeing a low on RA3 if the button is pressed or not. Has anyone ran into this problem? I am not sure what to do but it is bugging me. Help please.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?