Simple TTL input pin coding.
New to PIC basic - programming a 16F15324 - a substitute of the 16F616. I'm setting up pin 2 of the IC to be a simple 0 or 1 detector w 5V.
It will not detect a 1 or a zero unless I make the pin a analog pin as shown below. I do not understand this as its a I/O pin = not analog.
What am I not grasping here?
port A is an input - C is an output
please help... thanks
#CONFIG
__config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_ON & _FCMEN_OFF
__config _CONFIG2, _MCLRE_ON & _PWRTE_ON & _LPBOREN_OFF & _BOREN_ON & _BORV_LO & _ZCD_OFF & _PPS1WAY_OFF & _STVREN_ON
__config _CONFIG3, _WDTCPS_WDTCPS_11 & _WDTE_ON & _WDTCWS_WDTCWS_6 & _WDTCCS_SC
__config _CONFIG4, _BBSIZE_BB512 & _BBEN_OFF & _SAFEN_OFF & _WRTAPP_OFF & _WRTB_OFF & _WRTC_OFF & _WRTSAF_OFF & _LVP_OFF
__config _CONFIG5, _CP_ON
#ENDCONFIG
ANSELA = PORTA.5
TRISC = %00000000
LED VAR PORTC.3
BNC1 VAR PORTA.5
main:
IF BNC1 = 1 THEN
HIGH LED
ENDIF
goto main
My dad never liked you...
Bookmarks