Thanks for straightening me out. You learn something new every day.
Thanks for straightening me out. You learn something new every day.
I have read this thread several times and looked at the datasheet several time as well. I am having problems with code that has worked fine in the past and suddenly I can not make GPIO.0 and GPIO.3 function as inputs. This is the code I have used in the past. I have added a TRISIO statement and this does not seem to help either. “TRISIO = %11001011”
This code works on GPIO.1 but not on GPIO.0 and GPIO.3. I have used three ICs and continue to have no luck?
#IF __PROCESSOR__ = "12F629"
#DEFINE MCU_FOUND 1
#CONFIG
cfg = _INTRC_OSC_NOCLKOUT ; INTOSC oscillator: I/O function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN
cfg&= _WDT_ON ; WDT enabled
cfg&= _PWRTE_OFF ; PWRT disabled
cfg&= _MCLRE_OFF ; GP3/MCLR pin function is digital I/O, MCLR internally tied to VDD
cfg&= _BODEN_ON ; BOD enabled
cfg&= _CP_ON ; Program Memory code protection is enabled
cfg&= _CPD_OFF ; Data memory code protection is disabled
__CONFIG cfg
#ENDCONFIG
#ENDIF
#IFNDEF MCU_FOUND
#ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]"
#ENDIF
CMCON = 7
SYMBOL LTIN = GPIO.0 'input
SYMBOL RTIN = GPIO.1 'input
SYMBOL LTOUT = GPIO.2 'output
SYMBOL FOURIN = GPIO.3 'input
SYMBOL RTOUT = GPIO.4 'output
SYMBOL PEIZO = GPIO.5 'output
Over:
IF LTIN = 1 THEN HIGH PEIZO
IF LTIN = 0 THEN LOW PEIZO
IF RTIN = 1 THEN HIGH PEIZO
IF RTIN = 0 THEN LOW PEIZO
IF FOURIN = 1 THEN HIGH PEIZO
IF FOURIN = 0 THEN LOW PEIZO
GOTO OVER
See this post : http://www.picbasic.co.uk/forum/show...=7072#post7072
Maybe is useful !
I just found my problem. It was these two lines
SYMBOL RTOUT = GPIO.4
SYMBOL PEIZO = GPIO.5
I had changed my board on the last run and forgot to change the pin numbers in the code. The input was working fine it was the output the whole time.My silly mistake![]()
SYMBOL RTOUT = GPIO.5
SYMBOL PEIZO = GPIO.4
I am back up and running thank You for your reply!
Bookmarks