Aloha Robert:

I'm a scoreboard programmer so I have to write non-printable characters via
the serial port all the time. It's no big deal. Like everything else about
the PalmOS, it's easy when you know how, but finding out how can be a real
Easter-egg hunt.

Here's a snippet of code from my software that's used to drive the
scoreboards at the US Open tennis tournament. This should be
self-explanatory. I actually use the "new" serial manager at the US Open,
but I have translated it here into the old serial manager for you.


const   char   som1        = 0x02;     //control-B
const   char   eom1   = 0x03;         //control-C
const char   eom2   = 0x0D;          //#13 carriage return
const char   eom3   = 0x0A;           //#10 linefeed
const   char   control_d  = 0x04;      //control-D
typedef     char  c_string[255];        //define c_string
 c_string   mydata = "";

 mydata[0]=eom1;//control-C
 mydata[1]=eom2;//CR
 mydata[2]=eom3;//LF
 mydata[3]=eom3;//send an extra character, which gets eaten when the port
gets shut off

SerSend10(refNumP,&mydata,4);
SerSendWait(refNumP,-1);


Just be careful to specify the number of characters to send, do NOT use
StrLen(mydata), because StrLen returns some funky results when using
non-printable characters.

Best of luck.


James


> I need to send ASCII 255 character.
>
> I can send strings, but how do you send Ctrl C for example? Which is 2 in
> ASCII.Printable smile face.
>
> What is wrong with this code?
>
> Int16 DecValue=255;
> byte_sent=SerSend(Refnum,&DecValue,1, &error);
>
> Int16 ControlC=2;
> byte_sent=SerSend(Refnum,&ControlC,1, &error);
>
> I looked at the SDK Reference and I think I am doing this correctly.
>
> Thank you
> Rob
>
>
>
>
>
>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to