Background serial reception

I'm working with the brand new 28X1 I just received, and I'm having trouble with the background serial input. I can't seem to get the proper value set in the scratch pad memory.

I'm sending serial data to the 28X1 with an 08M. The command on the 08M is
Code:
SEROUT 4, N2400_4, (5)
On the 28X1 I'm setting up background receive like this:

Code:
HSERSETUP B2400_4, %01
SERINTFLAGS %00100000, %00100000
The 28X1 generates interrupts, but when I read the data on the 28X1, I'm getting most the value 125, and occasionally the value 253. If I change the 28X1 to receive the data with a SERIN command like this:
Code:
SERIN 7,N2400_4,(B0)
I get the expected value 5.

The documentation isn't clear, but it's possible that I need to set the SEROUT command on the 08M to use T2400_4, but when I try that I get nothing at all, no interrupts, no data.

I'm sure someone out there has this simple configuration working, but I couldn't find it searching the forums (although I did find some other fascinating stuff). If you could share your code, or point me to the code in the forums, that would be great.

Chuck
 
Last edited:

ciseco

Senior Member
Try this first, havent anything interupt driven to hand and this can be a cleaner way, depends on what you need, but will get you going.

INIT:
hsersetup T2400_4, %01
gosub CLRserPTR
gosub CLRscratchpad

MAIN:
if HSerInFlag = 1 then gosub RECV
'put anything else you like in here
goto MAIN

RECV:
get 0,b16
sertxd (13,10,"RECV:",b16)
gosub CLRserPTR 'very important to reset pointer
return

CLRserPTR:
HSerPtr = 0 'Reset (background) write pointer
HSerInFlag = 0 'Reset reception indicator
Ptr = 0 'Reset read pointer
@Ptr = 0 'Clear the first scratchpad location
return

CLRscratchpad:
for b0=0 to 127
put b0,0
next
return
________
Lorenzo Bandini
 
Last edited:

Technical

Technical Support
Staff member
The hardware receive is fixed at the 'T' type polarity, and so requires T2400 on the sender. Your wrong values received are because of this inversion.

This is 'idle high' polarity and so you need to make sure that the hardware setup also supports this high default state (ie no pull down resistor etc.). You should still get an interrupt if the hardware is correct with the T baud rate. It is also a good idea to put a 'high 4' at the very start of the transmitter program to set the default correct idle state.
 

RogerTango

Senior Member
You had one set to N and one set to B, use both on N and you should be okay. I am still learning too...

Cheers,
Andrew
 
I got my system working last night after I set the 08M to send serial data using T2400 as the setting.

Thanks for your help.
 
Top