I can send each command separately and i receive the ACK back. Now I want to do this with a function like this writing:
//
// Send out the sync pattern and wait for an ack from the board.
//
byte[]ucSyncPattern[]={0x55, 0x55};
byte[]COMMAND_ACK ={0xcc};
byte[] ucAck;
byte[]COMMAND_PING={0x20};
if(!serial.Writer(ucSyncPattern,0, 2))
{
Log("SyncPattern with the device: error");
}
//
// Wait for the ACK to be received, if something besides an ACK or a zero
// is received then something went wrong.
//
do
{
serial.Reader(ucAck,0, 1);
} while(ucAck == new byte[0]);
if (ucAck != COMMAND_ACK)
{
Log("Synchronize with the device: error");
}
//
// Make sure we can at least communicate with the board.
//
ucCommand = COMMAND_PING;
if(serial.Writer(ucCommand,0, 1) < 0)
{
Log("Ping: error");
}
what i want to have is something like this DumpView:
[19/07/2012 13:50:42] Written data
55 55 UU
[19/07/2012 13:50:42] Read data
00 cc .Ì
[19/07/2012 13:50:42] Written data
03 20 20 .
[19/07/2012 13:50:42] Read data
00 cc .Ì
but my function return this:
[23/07/2012 07:41:54] - Written data
55 55 03 20 20 UU.
[23/07/2012 07:41:54] - Read data
00 cc .Ì
Thanks for your feedback
Cyteam

New Topic/Question
Reply



MultiQuote





|