9 years, 3 months ago.

How to send binary data

As a result of using a "putc" to transmit the binary data for each byte , it is not possible to send . Please tell me how to 1 byte or multi-byte send binary data .

Question relating to:

You can use putc to send and getc to receive any character from 0x00 to 0xFF over a serial port. Same with pc.putc to send data to the PC.

posted by Chuck Davis 06 Feb 2015

1 Answer

9 years, 3 months ago.

I think the putc() can handle the binary data.
For just in case, I tried next code on mbed LPC1768.

It seems the output is fine.

#include "mbed.h"

Serial  serial( p28, p27 );

int main() {
    char    c   = 0;
    
    while( 1 ) {
        serial.putc( c++ );
    }
}

/media/uploads/okano/serial_out.png

Accepted Answer