LoginSignup
0
0

More than 1 year has passed since last update.

STM32L010のGPIOの速さを測る

Last updated at Posted at 2021-06-06

x Mbedのリビジョン143

目的
GPIOのテスト
WS2812Bを光らせる。

myledの速さは、1.827Mhz
ODRの速さは、7,995Mhz

結果
ODRの方が速い


#include "mbed.h"

//myled         1.827Mhz 010
//GPIOA->ODR    7,995Mhz 010

DigitalOut myled(PA_4);

int main() {

    while(1) {
        myled = 1;
        //wait(0.2);
        myled = 0;
        //wait(0.2);
    }//while

//    //                        1234567890123456
//    int on1  = GPIOA->ODR | 0b0000000000010000;
//    int off1 = GPIOA->ODR & 0b1111111111101111;
//    
//    while(1) {
//        GPIOA->ODR = on1;
//        //wait(0.2);
//        GPIOA->ODR = off1;
//        //wait(0.2);
//    }//while

}//main





#include "mbed.h"

//myled         1.827Mhz 010
//GPIOA->ODR    7,995Mhz 010

DigitalOut myled(PA_4);

int main() {

//    while(1) {
//        myled = 1;
//        //wait(0.2);
//        myled = 0;
//        //wait(0.2);
//    }//while

    //                        1234567890123456
    int on1  = GPIOA->ODR | 0b0000000000010000;
    int off1 = GPIOA->ODR & 0b1111111111101111;

    while(1) {
        GPIOA->ODR = on1;
        //wait(0.2);
        GPIOA->ODR = off1;
        //wait(0.2);
    }//while

}//main



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