Hi Folks,
I have some Sparkfun 1200 baud radiomodems UM-12 (Sparkfun WRL-00560) which should be straigthforward in operation according to their writeup. Their forum has no mention of these.
I'm using PBPro 2.60 and taking the Rx TTL data straight into Hyperterminal.
I can successfully send and receive data in the form of text or anything else within quotation marks i.e. normal Serout2 form but when any variables are included I get garbage from then on until reset again. Making a direct wire connection confirms my code and I've tried pacing, extra resets, etc. to no avail.
The modulation of these items doesn't need preamble or data slicing setting up but I've tried this also - no difference. Using a good supply to each, proper custom pcb's for each modem and short distance (across the table!) also makes no difference. I don't understand why variables cause problems when any length of "characters" works flawlessly...
Has anyone used these items successfully before or can offer suggestions to crack this nut?
Thanks and regards to all,
Bill
Code:
@ device pic16F648A, intrc_osc, wdt_on, pwrt_on, bod_on, lvp_off, mclr_off, protect_on
RedLED var PORTA.1 ' Indicator via 1k, led to ground.
S_out var PORTB.1 ' Serial data out to modem, also to PC via 1k.
Slp var PORTB.5 ' Sleep pin pulled low, high puts to sleep.
Reset var PORTB.7 ' Reset line to radiomodem pulled high (low to reset).
WScnts var word ' Counts from 034b in 10 seconds.
a var byte ' Counter for testing.
B12I con 17197 ' Comm speed of 1200 at 4Mhz (Inverted).
B12T con 813 ' Comm speed of 1200 at 4Mhz (True).
CMCON = 7 ' PORTA all digital.
Slp=0 ' Radiomodem operational.
pause 100 ' Let everything settle...
Reset=1 ' Radiomodem online.
pulsout Reset,10000 ' 100ms low.
RedLED=0 ' Red LED Off.
GOTO Running ' Jump over the subroutines area.
Preamble1: MUST send in True first for some reason.
pulsout RedLED,10000 ' Tx indicator.
serout2 S_out,B12T,["U"] ' Garbage if not sent first.
pulsout Reset,5000 ' To ensure proper start of Tx module (50ms low).
pause 300 ' Settle time.
S_out = 0 ' Make low before Tx. *** Necessary else garbage!
pause 1 ' Settle time. *** Necessary else garbage!
serout2 S_out,B12I,[rep "U"\10,"FFFF,"] ' Warm up the Rx data slicer even tho not r'qd.
return
Running:
a=234:WScnts=1054
gosub Preamble1 ' Wake up, reset and warm up the Tx data slicer.
serout2 S_out,B12I,["X1, 23.4, 56.7, m/s, a=",#a,", ",DEC WScnts,10,13]
pause 5000 '
goto Running ' Repeat.
' Here is the result...
'UUUUUUUUUUFFFF,X1, 23.4, 56.7, m/s, a=
'xx¼·²ˆ9J$#U`*§
' H<…;éä
Bookmarks