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

Revision:
0:e4d31a61ad72
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 23 12:18:36 2015 +0000
@@ -0,0 +1,18 @@
+/** 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);
+    }
+}