Hello, I am new to uProcs, Pics and PicBasic, but things are going well.
I am using SEROUT2 to communicate with a Basic STAMP and it appears to work well, but the STAMP only receives every second transmission. I hooked a scope to the serial line, and yes, the PIC is transmitting correctly.
Here is the PicBasic Code:
<code><b>
@ Device PIC12F675,WDT_OFF,PWRT_ON,PROTECT_OFF,MCLR_ON,BOD_ OFF 'sets configuration
INCLUDE "modedefs.bas"
Serial VAR gpio.2
Stuff VAR word
TRISIO = %00000000 ' Set all ports to output
CMCON = %00000111 ' Disable Comparators
ANSEL = %00000000 ' Turn off all ADC
Pause 1000 ' Wait to allow Hardware to Settle
gpio = %00000000
' Loop, sending a value out on the serial line
Stuff = 0
testloop:
stuff = stuff + 1
serout2 Serial, 16780, ["Value:", DEC Stuff]
PAUSE 1000
goto testloop
END
</b></code>
And here is the BASIC Stamp code:
<code><b>
'{$STAMP BS2}
'{$PBASIC 2.5}
INPUT 0
Value VAR Word
Waits VAR Word
Waits = 0
DO
DEBUG HOME
DEBUG "Waiting... ", DEC Waits, CR
SERIN 0, 16780, [WAIT("Value:"), DEC Value]
DEBUG "Got Value. Value=", DEC Value
Waits = Waits + 1
LOOP
END
</b>
</code>
Any ideas?
thanks
d1
Bookmarks