Serial demo program for the FRDM-KL25Z board. UART0 is used for communication via OpenSDA's USB-UART converter. Default speed and format are: 9600 bps, 8-bit, no parity, 1 stop bit

Dependencies:   mbed

Fork of 06_frdm_serial by Istvan Cserny

FRDM-KL25Z serial communication

Serial demo program for the FRDM-KL25Z board. UART0 is used for communication via OpenSDA's USB-UART protocol converter. Default speed and format are used: 9600 bps, 8-bit, no parity, 1 stop bit.

Usage: Find your virtual serial port at your computer and watch the transmission by using a terminal application. When you send a character from the PC, the character will be echoed back and the character code (in decimal) will be printed as well.

Hardware requirements:

  • FRDM-KL25Z board
  • USB cable between the PC and the OpenSDA connector

/media/uploads/icserny/05_frdm_serial_out.png

main.cpp

Committer:
icserny
Date:
2015-11-23
Revision:
0:e4d31a61ad72

File content as of revision 0:e4d31a61ad72:

/** 06_frdm_serial
 * Serial demo program for the FRDM-KL25Z board
 * Select UART0 for communication via OpenSDA's USB-UART converter
 * Default spedd and format are: 9600 bps, 8-bit, no parity, 1 stop bit 
 */

#include "mbed.h"

Serial pc(USBTX,USBRX);     //UART0 via OpenSDA

int main()
{
    pc.printf("\r\nWelcome to FRDM-KL25Z board!\r\n");
    while(1) {
        char c = pc.getc(); //Read one character
        pc.printf("received char: %c = %d\r\n",c,c);
    }
}