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

Committer:
icserny
Date:
Mon Nov 23 12:18:36 2015 +0000
Revision:
0:e4d31a61ad72
First version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
icserny 0:e4d31a61ad72 1 /** 06_frdm_serial
icserny 0:e4d31a61ad72 2 * Serial demo program for the FRDM-KL25Z board
icserny 0:e4d31a61ad72 3 * Select UART0 for communication via OpenSDA's USB-UART converter
icserny 0:e4d31a61ad72 4 * Default spedd and format are: 9600 bps, 8-bit, no parity, 1 stop bit
icserny 0:e4d31a61ad72 5 */
icserny 0:e4d31a61ad72 6
icserny 0:e4d31a61ad72 7 #include "mbed.h"
icserny 0:e4d31a61ad72 8
icserny 0:e4d31a61ad72 9 Serial pc(USBTX,USBRX); //UART0 via OpenSDA
icserny 0:e4d31a61ad72 10
icserny 0:e4d31a61ad72 11 int main()
icserny 0:e4d31a61ad72 12 {
icserny 0:e4d31a61ad72 13 pc.printf("\r\nWelcome to FRDM-KL25Z board!\r\n");
icserny 0:e4d31a61ad72 14 while(1) {
icserny 0:e4d31a61ad72 15 char c = pc.getc(); //Read one character
icserny 0:e4d31a61ad72 16 pc.printf("received char: %c = %d\r\n",c,c);
icserny 0:e4d31a61ad72 17 }
icserny 0:e4d31a61ad72 18 }