|
|
View previous topic :: View next topic |
Author |
Message |
bandofcs
Joined: 24 Jul 2014 Posts: 6
|
how to printf/putc "0x00" |
Posted: Sun Jul 27, 2014 6:13 pm |
|
|
Dear all,
I am writing a program for wireless transmission where there may be instances where transmission of 0x00 is necessary via TX port.
Does anyone have any idea how that can be achieved?
for example, my array is something like:
char array[3]={0x11,0x00,0x22}; |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Mon Jul 28, 2014 2:04 am |
|
|
Lets just give a fractional 'explanation'.
0, ('\0' in C), is a perfectly normal character. Can be sent just the same as any other.
The only 'difference' about 0, is that internally, 'C' uses this as an 'end of string' marker. So any _string_ functions, will stop when they reach 0.
So if you use string functions, then there is a problem. However if you ignore string functions, 0 can be sent as a character, no problem at all.
So for the array, simply looping through for the entire size (sizeof?...), of the array, is perfectly legitimate, and 0 can be sent as easily as anything else.
Separately though, async serial, uses a 'continuous 0' (where the output line goes low, and stays low without any 'start' or 'stop' bits, for a defined time longer than a character), as a 'break'. The name comes from the simple thing that this was what was seen, if the wire was broken. The 'break' transmission is commonly used as a trigger for certain operations, so (for instance) things like modems will often institute a 'reset', when they receive a 'break'. The thread PCM_programmer points to, is about 'how to send a break' if this is what is needed.
You need to get the difference 'clear in your head', and know which you actually need (and if the device needs a 'break', how _long_ it needs this to be). |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|