LoginSignup
0
0

More than 1 year has passed since last update.

STM32G031でソフトウェアシリアル1000bps(STM32G031J6M6)(USART)2

Posted at

目的
シリアルのテスト

o_con179.jpg



//s_ser_g031_2
//1000bps

//文字列の表示 nana_seg
int ns_printf(char *str1)
{

  //文字の中身がゼロか
  while (*str1) {

    digitalWrite(PB7, LOW);//Start
    delay(1);

    for (int ii = 0; ii < 8; ii++) { //Data x 8
      digitalWrite(PB7, ( (*str1) >> ii) & 1  );
      delay(1);
    }//for

    digitalWrite(PB7, HIGH);//Stop
    delay(1);

    str1++;//ポインターをカウントアップ

  } //while

  //戻り値
  return (0);

}//ns_printf


//初期化
void setup() {

  //仮想シリアルの出力ポートの初期化
  pinMode(PB7, OUTPUT);
  digitalWrite(PB7, HIGH);

}//setup


//無限ループ
void loop() {

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

  //I2Cに文字列を出力
  ns_printf("hello world\r\n");

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

}//loop



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