20M to 18X comm frustration

sbscott

Senior Member
I am reading ADC values from a 20M and trying to transmit them to an 18X. I can send bits correctly, but sending three byte values are received by the 18X but not the correct values. I have tried a many variations but nothing seems to give the the correct values. Here is the code:
-----------------------------------------------------------------
'PICAXE 20M slave
b1=254
b2=1
b7=192

start:
SEROUT 0,n2400,(b1,b2)' clear LCD
readadc 1,b4
readadc 2,b5
readadc 3,b6

pause 100
SEROUT 0,n2400,(#b4," ",#b5," ",#b6)
pause 100:serout 0,n2400,(b1,b7,"waiting ")
pause 100:serin 6,n4800,("go")
pause 1000
high 7
pause 100

SEROUT 7,n4800,(b4,b5,b6)' send data

pause 100:SEROUT 0,n2400,(b1,b2)' clear LCD
pause 100:serout 0,n2400,("data sent")
pause 1000
goto start
-------------------------------------------------------------------------
' PIXACE18X MASTER
start:
SEROUT 4, t4800, ("?f") ' clear the LCD
pause 100:SEROUT 4, t4800, ("Master")
pause 100:SEROUT 4, t4800,("?n","press to retr data..")
main:
if pin1=1 then goto gtdat
goto main

gtdat:
SEROUT 4, t4800, ("sending go")
pause 100:serout 5, n4800,("go")
pause 100:SEROUT 4, t4800,("?n","retriving data..")

serin 2,t4800,b4,b5,b6

pause 100:SEROUT 4, t4800, ("?f") ' clear the LCD
pause 100:SEROUT 4, t4800,(#b4," ",#b5," ",#b6)
pause 3000
SEROUT 4, t4800, ("?f") ' clear the LCD
goto start
 

slimplynth

Senior Member
Just had a quick look at your progs... for the 18X program

should...

serin 2,t4800,b4,b5,b6

be...

serin 2,N4800,b4,b5,b6

I'd also reduce the baud rate to N2400
 

slimplynth

Senior Member
sorry if you read this post before I edited Scott.. im seein T's and N's everywhere. I'm tired.. my bed beckons
 
Last edited:

hippy

Ex-Staff (retired)
pause 100:serin 6,n4800,("go")
pause 1000
high 7
pause 100
SEROUT 7,n4800,(b4,b5,b6)' send data

Using HIGH 7 then SEROUT with an Nxxxx baud rate is probably going to confuse the receiving SERIN.

Start with simpler code.

1) A transmitter which just sends "X" every second or so. Get that working.

2) Update that to sending "ABC", get it receiving all three characters correctly.

3) Get it to only send when told to by the master.

4) Add all the fancy stuff on top of that.
 

slimplynth

Senior Member
this my stable_send.bas for 20M

Code:
main:

readtemp 5,b1
readadc 1,b2

serout 1,N2400,("uuuuuuuuuuuuuuuuuuuuuuuuuuu",b1,b2) ' wireless hence the "UUUUUUUUU...." qualifier

pause 1000

goto main
my axe033 LCD is connected to an 08M

stable_recieve.bas is...

Code:
	'08M with AXE033 LCD and sparkfun Rx

init:
pause 500 	'pause, as advised for the initialisation of AXE033 LCD
let b1=0  	' just to display something
gosub disp	 'blank screens panic me :0)
pause 5000 	'used this to give me time to switch apps and start the Eltima - data logging program
		' freeware RS232 data logger - http://www.eltima.com/products/rs232-data-logger/
symbol flash = 50
symbol lo_led = 0
symbol ok_led = 1
goto mark	'to put the column headers at the top of the txt file, saves tippy tappying in excel/OO

main:
serin 2,N2400,("data"),b1,b2  ' collect RF data
if b2<180 then li_low         ' included this to see how quickly or if at all the update to the LCD is with an LDR
gosub ser_out			' have used Gosubs because program length was innitally too big for an 08M
high ok_led				' just to indicate that program hasn't gone into a hang at serin
gosub disp
serout 4,N2400,("OK  ")		' if light level is above some figure then append the output to LCD screen
low ok_led				
pause flash
goto main 

li_low:
gosub ser_out
high lo_led				' put a red LED in there so i could put some distance between the units, cover the LDR 
					' an hope that the red light flashes sooner rather than later - thanks womai ;0)
gosub disp
serout 4,N2400,("Low!")		' as above, if light level is below my arbitary 180 figure attach "Low!" to the end of 
					' the LCDs second line of text
low lo_led
pause flash
goto main

mark:
sertxd("Temp.°C:     Light%:",13,10) 'used at line 9, for column headers, included as a gosub in case i want to repeat
						 ' the headers, rather than have a long list of dizzying numbers
goto main

ser_out:
sertxd(#b1,"   :   ",#b2,"  :",13,10) 'include some white space and colons to make splitting text into columns easier in excel/OO
return

disp:
serout 4,N2400,(254,128) 		' point LCD to the 1st character of the 1st line
serout 4,N2400,("Temp. ", #b1, "oC") ' display temperature.
serout 4,N2400,(254,192)
serout 4,N2400,("Light Level ")
return
 

sbscott

Senior Member
followup - wireless transparency

Greetings,
I got sidetracked working with the 40x1 and did not get back to this post. I have since been about to communicate between the 18x and 20m thanks to other posts (This forum is a great investment in time!).

I am now trying to achieve wireless transparency using a set of Reynolds Electronics RWS-434 RF Receiver Module and the TWS-434A RF Transmitter Module. Have worked with these before and they have a usable range of about 50 feet (through walls).

I breadboarded the 18x (tx) and the 20m (rx) and have them talking. When I put the wireless modules between them no play. I have tried different baud rates with the same result. I am using a dual-trace scope and see that the transmission is getting across the ether and looks similar(ie. shape and lenghts of the square wave signal are very similar) with an exception that there is a low level osculation (carrier) that is on the receive side, probably causing the problem. Also, the trailing edge of the receive 'bits' have a bit of a slope to them.

Anyone have any suggestions on a "clean-up" circuit that would improve the quality of the incoming data stream?

Thanks!
 

sbscott

Senior Member
Wireless transparancy - who needs wires?

I posted this as a continuing thread on an original post "20M to 18X comm frustration" but had no replies. This seems to be an important technical capability-connecting PICAXEs together without wire. I have searched the site for this and have seen a number of discussions but none have really focused on the subject with a straigh forward solution. This is my attempt to do this.
--------------------------------------------------------------------
Greetings,
I got sidetracked working with the 40x1 and did not get back to this post. I have since successfully communicated between the 18x and 20m thanks to other posts (This forum is a great investment in time!).

I am now trying to achieve wireless transparency using a set of Reynolds Electronics RWS-434 RF Receiver Module and the TWS-434A RF Transmitter Module. Have worked with these before and they have a usable range of about 50 feet (through walls).

I bread-boarded the 18x (tx) and the 20m (rx) and have them talking. When I put the wireless modules between them, no play. I have tried different baud rates with the same result. I am using a dual-trace scope and see that the transmission is getting across the 'ether' and looks similar(ie. shape and lengths of the square wave signal are very similar) with the exception that there is a low level osculation (carrier) that is on the receive side, probably causing the problem. Also, the trailing edge of the receive 'bits' have a bit of a slope to them.

Anyone have any suggestions on a "clean-up" circuit that would improve the quality of the incoming data stream?

Thanks!
 

hippy

Ex-Staff (retired)
Have you added a preamble ( sending a sequence of "U" characters ) and data qualifiers to your transmission ?

Carrier ripple and slewing of signal may not be the problem so cleaning it up might not help. IF you want to, the easiest solution is to take the signal through a Schmitt Trigger or use a Schmitt Trigger input pin on the PICAXE - Assuming the switching voltage is large enough to be usable.

With a simple test setup, sending a single character at a time, what does the receiving PICAXE get ?
 

slimplynth

Senior Member
Reyto SBS

Apologies, I made an error by posting the incorrect tx program earlier in the thread.

I was having RF probs and stumbled across a solution by Wolfgang.

The program i now use is based on this...

Code:
main:

readtemp 5,b1
pause 250		'got pause happy
readadc 1,b2
pause 250		'got pause happy
serout 1,N2400,(0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55) ' preamble to lock link the tx/rx
pause 5
serout 1,N2400,("data",b1,b2)
it's the 0x55 preamble and the pause 5 that sorted it for me.

Regards

Slim
 
Top