Serie Comunications between a PIXAXE18M2 abd a DRA818V radio module

zs6wbt

New Member
Hi i hope i do this post at the correct Forum. I am busy building a radio beacon withe a PIXCAXE and a DRA818V radio module. To start up the radio module i have to send a <AT> command to the DRA818 it will Respond withe an <AT> command back that consist of 15 ASCII characters. i use the "hserout" command to send the first string and the "hserin" to read back the reply from the module. Then i want to send the reply back to the PC via the program cable to see if i got the correct response. so fare i have been able to capture the first 2 characters and then i get stuck.

Is there a better way of doing this?

This is my code:

'----------------------- Setup Serial port -----------------------------
hsersetup B9600_4,%00
'----------------------- Setup Radio -----------------------------------

high C.1'Sleep mode Off
high C.0 'PTT = RX
low C.7 'RF power = Low 0.5W
'----------------------- Check if respond -------------
hserout 0,("AT+DMOCONNECT",CR,LF) 'Test Radio Module

sertxd (cr,lf)

for b5=1 to 200
w0 = $FFFF ; set up a non-valid value
hserin w0 ; receive 1 byte into w1
'sertxd (w1)
pause 100
if w0 <> $FFFF then
sertxd (w0)
hserin w0 ; receive 1 byte into w1
sertxd (w0)
b5=200
end if
next b5
 

srnet

Senior Member
Is there a better way of doing this?

There is.

The problem here could well be that the program loop reading the incoming characters is just not fast enough and misses characters.

I have seen work-arounds for using a M2 series PICAXE but this sort of application, and reading a GPS for instance is similar, is much easier using an X2 series PICAXE.

The X2 series has serial background receive, so that when you send the "AT+DMOCONNECT", all the serial characters the VHF beacon replies with are automatically captured in the background into a buffer. You wont miss characters and you can read them back at your leisure.
 

rossko57

Senior Member
Do NOT attempt to sertxd the data to the PC at the same time as you are receiving it from the radio. The sertxd takes time, and while that is going on you will miss incoming characters. Do the serrtxd after you have got the whole message.
 

hippy

Technical Support
Staff member
Why did thy make a "hserin" on the M2 processors if it is not capable to handle a data string?
HSERIN on an M2 can receive data in the background and this can be very useful even if the M2 devices do not have the extensive background receive capabilities of the X2 devices. It was considered better to have the limited capability than not have it at all.
 

srnet

Senior Member
You are running the program with the processor at at 4Mhz, it will run at 32Mhz, so 8 times faster, you should get better results at the speed.

But do take out the 100mS delay in the loop reading characters from serial, at 9600baud the characters are coming in about once ever 1ms or so, too long a delay between reading them and they will be missed.
 
Top