
Originally Posted by
tekart
Had a long chat with Charles at MElabs and he had me go over all the hardware and also try DEBUGIN. Still not recognizing the qualifier
Hello Guy,
Your code works for me, even with hex. (at least on my 12f683). But, I have to add this at the top of my code. Otherwise, I get no response.
Code:
CMCON0 = 7 'TURN COMPARITORS OFF
ANSEL = %00000000 'Set all pins to digital I/O
ADCON0 = %00000000 'Analog converter OFF
Here's what I used for my 12f683:
Code:
define OSC 8
OSCCON = %01110000 'set for 8mhz internal
CMCON0 = 7 'TURN COMPARITORS OFF
ANSEL = %00000000 'Set all pins to digital I/O *wont work without this *
ADCON0 = %00000000 'Analog converter OFF
'* uC : PIC12F508 *
'****************************************************************
' chip setup
' oscillator = INTRC
' watchdog = enabled
' MCLR = INPUT
X var byte ' dummy variable
' ************** DEBUGIN SETUP ************
define debugin_bit 1 ' incoming data bit
define debug_baud 9600 ' baud
define debugin_mode 0 ' 0 = true
' Pin Assignments
SCADAin var gpio.1 ' data in via MAX232
Ready var gpio.2 ' signal main processor to send data
'I changed from gpio.4 to match my hardware
low ready ' set low
' config
TRISIO = %000010 ' set I/O directions (0 = output, 1 = input)
'OPTION_REG = %01011111 ' 12F508/9 bit 6 disables weak pull-ups
OPTION_REG = %01000010 ' for my 12f683
Main:
' while scadain = 1 : wend ' test code detects presence of serial burst
' debugin 200,Noop,[wait(120)] ' wait for address and command
serin scadain,2,400,noop,[$0F] ' check for right qualifiers only
pause 10 ' wait for serial burst to end
high Ready ' signal main processor to send current data
pause 2 ' with a 2mS pulse
low ready
goto main
NoOp:
return
Bookmarks