PDA

View Full Version : Spakfun radiomodem problems UM-12



wjsmarine
- 4th August 2010, 08:40
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



@ 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<…;éä

HenrikOlsson
- 4th August 2010, 11:45
Hi,
Have you tried replacing #a with DEC a? Not that I'd know why it would matter but it's worth a try.

Another thing worth trying might be to first write your whole string to an array and then using that in SEROUT2 statement. Perhaps the character timing gets screwed when the PIC converts the value the ASCII or something.

Something like:

myString VAR BYTE[40]
ArrayWrite myString, ["X1, 23.4, 56.7, m/s, a=",#a,", ",DEC WScnts,10,13,0] 'Pad a zero at the end to terminate the string.
serout2 S_out, B12I, STR myString
I've not tested the above, shown for "illustration purposes" only ;-)

Well, not much help, just some ideas.

/Henrik.

Dave
- 4th August 2010, 12:27
HenrikOlsson , You are exactly right... He is not formating the data presented to the transmitter in ascii as the receiver code is receiving it....

Dave Purola,
N8NTA

wjsmarine
- 4th August 2010, 17:39
Hi Henrik and Dave,

Thanks guys, I've implemented your suggestions and have some good results although still have a few things to sort out...

I can't find any Help files or documentation on the ArrayWrite or ArrayRead commands - do such exist somewhere I can study? The only information I can find relate to previous posts but there is no concise definition or statement it seems.

Thanks and regards,
Bill

HenrikOlsson
- 5th August 2010, 07:40
Hi,
That would be in the PBP manual. The help files (if you mean the help in Micro Code Studio) aren't being updated because that software isn't developed by the same guys that develops PBP.

/Henrik.

ScaleRobotics
- 6th August 2010, 14:54
I can't find any Help files or documentation on the ArrayWrite or ArrayRead commands - do such exist somewhere I can study?


Hello Bill,

Darrel wrote a couple examples for arraywrite here: http://www.picbasic.co.uk/forum/showthread.php?t=12472&p=82995#post82995

That would be another good Wiki topic!

Walter