Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NULL character (00h) receivesd causes rx data pause

Status
Not open for further replies.

nscripta

Technical User
Feb 14, 2003
58
GB
I have a script that receives data from a serial link. The data is terminated with a CR/LF. I am using the rget command to read this data.
Unfortunately as part of the string received there is four consecutive null (00h) characters. When the script receives this sequence it stop processing further characters until my rgetchar (CR) is received.
e.g.

Text transmitted : "HELLO WORLD ^@^@^@^@ HOW ARE YOU?"
Text decoded by Procomm as incoming string: "HELLO WORLD"

I have tried manually sending the string and the same situation occurs.

I have examined the set nullsuppress option and it appeared to work on the first occasion, however it didn't appear to work on all occasions.

Any help will be much appreciated.
 
Are you using one of the IBM 31xx emulations? If not, then the set emulation nullsuppress command would have no effect.

My initial hunch is that the nulls in the received string are being interpreted as the end of the string by the rget command since strings in ASPECT are null-terminated. This is why you only receive the first portion of your string and not the entire string. I did a quick look through the help file and did not see a way to work with a string containing nulls in it. One option you could try is using the when target command to key on the null (or all nulls at once, if it is always the same value), then use the STRIP keyword in that command to remove the nulls from the data stream. This should allow you to receive the entire string, but I'm not setup to test this theory at the moment.

I have a sample script from the Quarterdeck BBS that can do this for any specified string. You might look at it to give you an idea how to integrate this functionality into your existing script. It can be found here:


aspect@aspectscripting.com
 
Thanks for the reply.

I managed to solve the problem of the null being received by setting the rget command to pass the data to the translate table (removed the RAW option). In the translate table I changed the 00h incoming character to a '*'. The script then carried out a strreplace to remove the '*' characters from the processed data (The '*' is never received in the incoming data).

nscripta
 
Glad to hear that worked. I thought about offering that solution, but wasn't sure if there would be nulls elsewhere in the data stream that would then give you "odd" results if they were translated to a different character.


aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top