I am trying to write a simple program on a 12F683. Its my first time using a 8 pin PIC. I can't figure out how to do a TRIS. I am not able to get pin GP3 to work as an output and I can't get GP1 to work as an input. I only need AN0, which I have not tested yet. Anyone have any ideas what I'm missing. Code is below. Thanks
@ device INTRC_OSC_NOCLKOUT
@ DEVICE MCLR_OFF ' Master Clear Options
OSCCON = $60 'sets the oscillator speed
DEFINE OSC 4 'Oscillator speed in MHz
' Alias pins
LED_Sig VAR GPIO.3 ' LED - Rx Complete Flag
LED_Rx VAR GPIO.4 ' LED - I2C Data being written
LED_Tx VAR GPIO.5 ' LED - Serial Data Being Read
' Set up Analog
ADCON0 = %11000001 'AN0 Analog, rest digital
ANSEL = %00110001 'AN0 Analog, rest digital
INTCON = %00000000 'all interrupts OFF
' Define used register flags
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
' Allocate RAM
i VAR BYTE
for i = 1 to 10
high LED_Sig ' LED won't work... It works is I just jumper 5V to the PIN
pause 50
Low LED_Sig
pause 50
High LED_Rx
pause 50
low LED_Rx
pause 50
high LED_TX
pause 50
low LED_Tx
pause 50
next i
start:
if GPIO.1 = 1 then
low LED_Rx
else
high LED_Rx
endif
if GPIO.2 = 1 then 'can't turn the LED off with 5V put right on the PIN
low LED_Tx
else
high LED_Tx
endif
goto start
Bookmarks