2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

(高速)レジ直でSTM32C011をたたく(Lチカ)(GPIO)(STM32C011F4P6)

Last updated at Posted at 2025-09-08

参考

Screenshot from 2025-09-09 07-11-26.png

いろいろ注意

  • 心にレジスターを持つ人、限定
  • AND(アンド)がわかる人、限定
  • OR(オア)がわかる人、限定
     
  • 過去ログを見よ!!!

目的

GPIOレジスターを直接、たたく (宗教)
略して、これを「レジ直」と言う。
けして、スーパーのセルフレジに直接行くのでは、ない。
皆の衆、ご理解いただけましたか?

結果

image_original(71).jpg

image_original(72).jpg

プログラム



//これは、GPIOレジスターを直接操作する方法
//GPIO_IO_REG_PA2_C011_1


//定義
int on1;   //ビットのオン
int off1;  //ビットのオフ


//初期化
void setup() {

  //ピンの初期化 PA2
  pinMode(PA2, OUTPUT);

  //オンオフの設定 PA2
  //                    1111110000000000
  //                    5432109876543210
  on1  = GPIOA->ODR | 0b0000000000000100;
  off1 = GPIOA->ODR & 0b1111111111111011;

}  //setup


//メインループ
void loop() {

  //PA2をオン
  GPIOA->ODR = on1;
  //digitalWrite(PA2, HIGH);

  delay(1000);  //1秒待つ

  //PA2をオフ
  GPIOA->ODR = off1;
  //digitalWrite(PA2, LOW);

  delay(1000);  //1秒待つ

}  //loop


2
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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?