I am working on the very same issue using the Novatel OEM615 receiver.
Its RX/TX pins (LVTTL) are just connected to the p9, p10 of the mbed.
I need to send a string of bytes based on Novatel's binary message structure.
The also have an ASCII message structure, but I want to use the more compact binary structure.
The binary message is a fairly complex set of chars, shorts ad longs.
My current strategy (not complete yet) is to form a struct using the mbed C++.
I have added a #pragma pack(1) above the struct so that the struct internal storage doesnt have any extra packing.
I have used this before with Visual Studio C++ and it worked nicely.
If you dont add the #Pragme Pack(1), the compiler adds padding so the word boundaries are on 4-byte boundaries.
If I set up the struct with the various correcly named ints, shorts, longs, then I can just define these variables and the bytes will be laid out correctly.
The code is very readable w/o any bit/byte manipulation logic.
When I want to send the byte string to the receiver,
I just set up a putc loop that increments the pointer to the first element of the struct.
So far this compiles but I havent actually tested it!
Any thoughts on this idea woule be appreciated.
- Jim
I am trying to connect a GPS module to the mbed. I need to send a hex command string via serial to configure the GPS module. e.g. 0x2525F1040001000000000000730D0A.
Is there an easy way to send this all at once using a single function? At the moment I am using individual .putc methods to write two hex characters of the string at a time but this isn't very efficient!
Thanks.
Paul