FRDM-K64 Serial communication basic example using mbed

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

FRDM-K64 Serial communication basic example using mbed

FRDM-K64 Serial communication basic example using mbed

Here you can find both the code and project files for the Serial communication project, in this example the serial port (UART) is configured to establish communication between the computer using a serial terminal and the evaluation board. The default baud rate for the serial port is 9600 bauds. The code also implements an echo function, any key pressed in the computer's keyboard will be captured and displayed in the serial terminal.

If your computer does not have a serial terminal you can download Tera Term from the following link:

Tera Term Open Source Project

The communication is established through the USB cable attached to the OpenSDA USB port.

Code:

#include "mbed.h"

//Digital output declaration

DigitalOut Blue(LED3);

//Serial port (UART) configuration

Serial pc(USBTX,USBRX);

int main()

{

    Blue=1;

    pc.printf("Serial code example\r\n");   

    while(1)

    {

        Blue=0;

        pc.putc(pc.getc());

    }

  

}

附件
%3CLINGO-SUB%20id%3D%22lingo-sub-1123613%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E4%BD%BF%E7%94%A8%20mbed%20%E7%9A%84%20FRDM-K64%20%E4%B8%B2%E8%A1%8C%E9%80%9A%E4%BF%A1%E5%9F%BA%E6%9C%AC%E7%A4%BA%E4%BE%8B%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1123613%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3Dutf-8%22%20%2F%26gt%3B%0A%3CP%3E%E5%9C%A8%E8%BF%99%E9%87%8C%E6%82%A8%E5%8F%AF%E4%BB%A5%E6%89%BE%E5%88%B0%E4%B8%B2%E8%A1%8C%E9%80%9A%E4%BF%A1%E9%A1%B9%E7%9B%AE%E7%9A%84%E4%BB%A3%E7%A0%81%E5%92%8C%E9%A1%B9%E7%9B%AE%E6%96%87%E4%BB%B6%EF%BC%8C%E5%9C%A8%E6%AD%A4%E7%A4%BA%E4%BE%8B%E4%B8%AD%EF%BC%8C%E4%B8%B2%E8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html.en%22%20title%3D%22http%3A%2F%2Fttssh2.sourceforge.jp%2Findex.html.en%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ETera%20Term%E5%BC%80%E6%BA%90%E9%A1%B9%E7%9B%AE%3C%2FA%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%E9%80%9A%E4%BF%A1%E6%98%AF%E9%80%9A%E8%BF%87%E8%BF%9E%E6%8E%A5%E5%88%B0%20OpenSDA%20USB%20%E7%AB%AF%E5%8F%A3%E7%9A%84%20USB%20%E7%94%B5%E7%BC%86%E5%BB%BA%E7%AB%8B%E7%9A%84%E3%80%82%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%E4%BB%A3%E7%A0%81%EF%BC%9A%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%23%E5%8C%85%E6%8B%AC%E2%80%9Cmbed.h%E2%80%9D%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%2F%2F%E6%95%B0%E5%AD%97%E8%BE%93%E5%87%BA%E5%A3%B0%E6%98%8E%3C%2FP%3E%3CP%3E%E6%95%B0%E5%AD%97%E8%BE%93%E5%87%BA%E8%93%9D%E8%89%B2(LED3)%EF%BC%9B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%2F%2F%E4%B8%B2%E5%8F%A3%EF%BC%88UART%EF%BC%89%E9%85%8D%E7%BD%AE%3C%2FP%3E%3CP%3ESerial%20pc(USBTX%2CUSBRX)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3Eint%20main()%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Blue%3D1%3B%3C%2FP%3E%3CP%3Epc.printf(%22%E4%B8%B2%E5%8F%A3%E4%BB%A3%E7%A0%81%E7%A4%BA%E4%BE%8B%5Cr%5Cn%22)%3B%20%3C%2FP%3E%3CP%3Ewhile(1)%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Blue%3D0%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20pc.putc(pc.getc())%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1123613%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EFreedom%E5%BC%80%E5%8F%91%E5%B9%B3%E5%8F%B0%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EKinetis%20K%E7%B3%BB%E5%88%97MCU%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
无评分
版本历史
最后更新:
‎06-27-2014 10:56 AM
更新人: