LoginSignup
0
0

More than 1 year has passed since last update.

STM32L010でソフトウェアシリアル1000bps(STM32L010F4P6)(USART)

Last updated at Posted at 2021-12-29

目的
シリアルのテスト

o_con180.jpg



//S_SER_1000_010_1

#include "mbed.h"

DigitalOut TX(PA_2);

//仮想シリアルへの一文字出力 1000bps
int pc_putc(char ch)
{

    TX=1;
    TX=0;//Start
    wait_ms(1);

    for(int ii=0; ii<8; ii++) { //Data x 8
        TX=(ch>>ii)&1;
        wait_ms(1);
    }; //for

    TX=1;//Stop
    wait_ms(1);

    return(0);

} //pc_putc


//メインルーチン
int main()
{

    TX=1; //ポートの初期化

    //無限ループ
    while(1) {

        //一文字出力
        pc_putc('A');

        //1秒の待ち
        wait_ms(1000);

    }//while

}//main

//容量削減
void error(const char* format, ...) {}




0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0