Shop OBEX P1 Docs P2 Docs Learn Events
Serial Input question — Parallax Forums

Serial Input question

ArchiverArchiver Posts: 46,084
edited 2003-03-05 12:53 in General Discussion
Serial In question.

I am having problems decoding serial in data from a Midon Designs
Temp 05 module. (All rates are set up to 9600,8,n,no)

I can send info from a hyper terminal pc to the stamp serial port and
data is properly decoded.

Midon temp 05 module sends serial stream properly to pc hyper
terminal.

The problem is when the temp 05 module is connected to the stamp i/p
all data is 255's.

The Stamp i/p is using an Al Williams RS1 inverter/level shifter.

Anybody had a similar problem??

Code is below


{$STAMP BS2p}
'{$PBASIC 2.0}
'{$PORT COM1}

' testing the ser out and in baud mode # 240 for rs 232 line driver
' 9600 8 no parity



STEST:



SERIN 1, 240, 30000, NODATA, [noparse][[/noparse]SPSTR 10]

' added wait for sensor worked once to trigger but still
garbage on decode.
'LOOKS FOR 10 BYTE SERIAL SCRATCH PAD STRING IF NOTHING IN GO
TO NO DATA


MYBYTES VAR BYTE(10)
INDEX VAR NIB


INDEX=0
FOR INDEX=0 TO 9

'LOOPS BETWEEN FOR AND NEXT THE NUMBER OF INDICATED TIMES

GET INDEX, MYBYTES(INDEX)

`takes scratch pad data and moves it to mybytes


NEXT
'END OF NEXT LOOP AFTER INDEX NUMBER IS EXCEEDED THE PGM
JUMPS OVER NEXT.





INDEX=0
FOR INDEX=0 TO 9
'SETS INDEX TO COUNT O-9
DEBUG ? MYBYTES(INDEX)
'SENDS MYBYTES ARRAY TO DEBUG IN SEQENTIAL ORDER WITH CR
BETWEEN EACH
' USE THIS FOR LOOKING INTO SCRATCH PAD ARRAY. DATA OUT IN
DECIMAL

NEXT


DEBUG STR MYBYTES, CR
'DEBUG STR SHOWS STRING OF DATA CALLED MYBYTES IN ASCCI.





PAUSE 500 'wait 5 seconds


GOTO STEST 'return to top



NODATA:

DEBUG "NO DATA",CR

GOTO STEST



'RESULTANT STRING OF DATA FROM DEBUG.


'MYBYTES(INDEX) = 255
'MYBYTES(INDEX) = 255
'MYBYTES(INDEX) = 255
'MYBYTES(INDEX) = 255
'MYBYTES(INDEX) = 255
'MYBYTES(INDEX) = 255
'MYBYTES(INDEX) = 255
'MYBYTES(INDEX) = 255
'MYBYTES(INDEX) = 255
'MYBYTES(INDEX) = 255
'ÿÿÿÿÿÿÿÿÿÿ


'ACTUAL DATA input.
'>
'Sensor #01=71.70F
'>
Sign In or Register to comment.