Hi all,
I'm trying to get one of my mbed's to receive data on RS485, specifically that of DMX format. I've got myself a transceiver, but I'm a bit stuck on the coding, largely caused by my lack of knowledge about how the serial port on the mbed actually receives serial data.
In my main function I've got a line formatting the port and that compiles nicely, as well as one setting the correct baud rate. The mbed will need to receive a 513 byte packet and ignore the start code and read three of the following 512 (I'll stick with the first three for the sec) bytes and extract a value. This is where my lack of knowledge comes in.
I defined a variable to hold a value, and then put the following in my main function:
value = dmxin.getc();
with dmxin being the serial port. It compiles happily, but will this just update value with each new byte that comes in? Is there something other than getc I can use that will allow me to focus on, say, byte 2 of the packet?
Thanks so much if anyone can help :)
Simon
Hi all,
I'm trying to get one of my mbed's to receive data on RS485, specifically that of DMX format. I've got myself a transceiver, but I'm a bit stuck on the coding, largely caused by my lack of knowledge about how the serial port on the mbed actually receives serial data.
In my main function I've got a line formatting the port and that compiles nicely, as well as one setting the correct baud rate. The mbed will need to receive a 513 byte packet and ignore the start code and read three of the following 512 (I'll stick with the first three for the sec) bytes and extract a value. This is where my lack of knowledge comes in.
I defined a variable to hold a value, and then put the following in my main function:
value = dmxin.getc();
with dmxin being the serial port. It compiles happily, but will this just update value with each new byte that comes in? Is there something other than getc I can use that will allow me to focus on, say, byte 2 of the packet?
Thanks so much if anyone can help :)
Simon