What is hitting the PIC?
15 or 0F
3 or 03
Notice SERIN2... Never did like the single...Code:SERIN2 PORT.x,MODE,[WAIT("0F"),WAIT("03")]
 
 
		What is hitting the PIC?
15 or 0F
3 or 03
Notice SERIN2... Never did like the single...Code:SERIN2 PORT.x,MODE,[WAIT("0F"),WAIT("03")]
Dave
Always wear safety glasses while programming.
 
 
		
Doesn't matter hex or decimal - it's the same binary number sent via serial...
I had not noticed the WAIT feature in SERIN2. But the manual warns that at 9600 baud I *may* need an osc faster than 4MHz. Have not used SERIN2 before and it is giving me compiler ERRORS with the 12F509A.
"Do or do not, there is no try" Yoda
 
 
		Does this work on your 12F509?
Code:DEFINE DEBUG_BAUD 9600 DEFINE DEBUGIN_REG GPIO DEFINE DEBUGIN_BIT 1 DEFINE DEBUGIN_MODE 0 '1=inverted X var byte ' dummy variable ' Pin Assignments SCADAin var gpio.1 ' data in via MAX232 Ready var gpio.4 ' signal main processor to send data low ready ' set low ' config TRISIO = %000010 ' set I/O directions (0 = output, 1 = input) OPTION_REG = %11011111 ' 12F508/9 bit 6 disables weak pull-ups Main: debugin 200,NoOp,[wait($0F)] ' wait for address and command 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: GOTO Main END
 Yes! :)
 Yes! :)
		Bruce,
It WORKS! I had tried variations of DEBUGIN before but must have gotten the setup wrong! THANKS MILLIONS - you have no idea how much time I have put in on this (well, maybe you do...).
Still don't know why SERIN did not work.
Guy
"Do or do not, there is no try" Yoda
 
 
		Hi Guy,
Glad I could help.
One problem was having RETURN in NoOp. The timeout/label option for serin/serin2/debugin use a GOTO to jump to NoOp. Not good since you have no idea what's on the call stack, and no idea just where it's going RETURN to when it lands on this return after only a few mS when it times-out.
Also .. serin/serout2 don't always work as expected at 4MHz for 9600 bps. debugin does.
If you refer back to my 1st post you'll see that I hinted about all of these potential show-stoppers...;o)
Bookmarks