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

More than 3 years have passed since last update.

STM32F767と秋月シリアル7セグで3分タイマー GPIO

Last updated at Posted at 2021-07-02

x Mbedでのボード設定は、NUCLEO-F767ZI
x 赤色7セグメントLEDシリアルドライバモジュール 完成品
x OSL10564-74HC595-R M-12642

説明
文字を文字パターンに変換する
64は、@の開始位置です。
7セグメントの文字パターンに変換
変換範囲は、32文字で5ビット分



# include <Arduino.h>

//*          *****  *****  
//*         *       *    * 
//*         ******  *    *
//*         *       *    *
//*         *       *    *
//********   *****  *****

# define DW   digitalWrite

//031
// //#define swdclk   PA14 // 8pin
// //#define swdio    PA13 // 7pin
// #define swdclk   PA12 // 6pin
// #define swdio    PA11 // 5pin
// //#define t_led1   PA12 // 6pin
// //#define t_led2   PA11 // 5pin
// #define en       PA0  // 4pin
// #define in7      PB7  // 1pin

//767
# define swdclk   13 // 
# define swdio    11 // 
# define en       10 // 
# define in7      A0 // 


char seg[32] = {
   0x00 , //0 @ -> ' '
   0x77 , //1 A  o
   0x7c , //2 B      combined use "6"
   0x39 , //3 C
   0x5e , //4 D
   0x79 , //5 E  o
   0x71 , //6 F
   0x3d , //7 G

   0x76 , //8 H  o
   0x06 , //9 I     combined use "1"
   0x1e , //10 J
   0x75 , //11 K 
   0x38 , //12 L  o
   0x15 , //13 M
   0x37 , //14 N  o
   0x3f , //15 O  o combined use "0"

   0x73  , //16 P
   0x67  , //17 Q combined use "9"
   0x50  , //18 R
   0x6d  , //19 S combined use "5"
   0x78  , //20 T
   0x3e  , //21 U
   0x1c  , //22 V
   0x2a  , //23 W  o
   0x64  , //24 X

   0x6e  , //25 Y
   0x5b  , //26 Z combined use "2"
   0x4f  , //27 [  --> "3"
   0x66  , //28 \  --> "4"
   0x27  , //29 ]  --> "7"
   0x7f  , //26 ^  --> "8"
   0x08    //31 _
};

//             12345678   12345678   12345678   12345678
char b8[8] = {0b10000000,0b01000000,0b00100000,0b00010000,
              0b00001000,0b00000100,0b00000010,0b00000001 };

void seg1(char v)
{
    v=seg[v-64];
    for(int jj=0;jj<8;jj++){
        if( (v & b8[jj]) == 0 ){
                DW(swdio,0); //ビットが0
        } else {
                DW(swdio,1); //ビットが1
        }//endif
        DW(swdclk,1);
        DW(swdclk,0);
    }//for
    DW(en,1);
    DW(en,0);
}//seg1

//初期化
void setup() {

    delay(3000); //not Delete

    //7セグの初期化
    pinMode(swdclk,OUTPUT);
    pinMode(swdio,OUTPUT);
    pinMode(en,OUTPUT);
    pinMode(in7,INPUT_PULLUP);
    DW(en,0);
    DW(swdclk,0);
    
}//setup

int ii; //ループカウンター
//ループ
void loop() {

  seg1('O');

  for(ii = 0;ii < 60;ii++){
    delay(1000);
  }

  seg1('I');

  for(ii = 0;ii < 60;ii++){
    delay(1000);
  }

  seg1('Z');

  for(ii = 0;ii < 60;ii++){
    delay(1000);
  }

  seg1('[');

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




h_con28.jpg

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?