Null character on Rs232

Hello everyone,
I started programming Wavecom Modem with Open AT this morning.
I would send via serial link a string containing a null character.
I have done a very litte modification on “hello world sample modification” in order to send my string.

This is the code:

void HelloWorld_TimerHandler ( u8 ID )
{
// Hello World
TRACE (( 1, “Embedded : Hello World” ));
//adl_atSendResponse ( ADL_AT_UNS, “\r\nHello World \r\n” );

adl_atSendResponse(ADL_AT_UNS,"\x60\x1D\x00\xFF\x01\x15");

}

As you can see my string contains the null character. The modem is connected witha a PC and I use Hyper terminal for stamp the string sent bye modem. The application, finding the null character, cut my string.

I would ask you if there some other function for send string and if it is possible to specify the length of the string to be sent.

Thank you very much

Lorenzo
I

No - a ‘C’ string cannot possibly contain a NUL character, can it? :unamused:

This has nothing to do with Wavecom or Open-AT - it is a fundamental part of the way that the ‘C’ programming language works: think about it - the ‘C’ programming language uses the NUL character to mark the end of a string, doesn’t it?!

Anyhow, why do you want to do this as an AT Response?

You’ve posted this in the FCM forum, so look at the FCM ‘Send Data’ functions - these allow you to specify a buffer & length of data to send, and most certainly do support sending binary data (including NULs). :smiley:

If you really must do it in an AT Response, you’ll have to think of some way to encode it - or at least the ASCII Control codes.

Rather than re-invent the wheel, I suggest that you look at the way binary data is handled for SMS messages in PDU mode…

Thank you very much and excuse me for the basic question.
It is not necessary use a AT Response function but any function that allows me to send a string (including null character) via Rs232 to a PC.
So if you have any suggestion about doing this, please tell me.

Ah… Merry Christmas!

Lorenzo

I have already given you two suggestions:

1. Use the FCM functions instead of sending an AT response;

2. If you must use an AT response, encode it.

I used the FCM function adl_fcmSendData and it works.

Well, I’m able to send a string containing a null character via Rs232. Now I have to receive some kind of answer. So, what about receive string?

I’m looking for a function such as adl_fcmReceiveData but i doesn’t exist.

There some function for receive a string of character via Rs232?

Thank you very much for your help.

Hi daimoniro,

When data is received your handler function will be called from the system and the received data is passed through a parameter.

Best Regards,
Jan

Correct: it doesn’t - you have to provide it, as Jan says!

Look again at the adl_fcmSubscribe documentation - in particular, the data handler

Remember, the issues with NULs apply to all ‘C’ string-handling functions…