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.

STM32L010と液晶、ACM1602K-NLW-BBWで表示 (Keil)

Last updated at Posted at 2022-02-20

x 原因は、わからないが液晶がちらつく場合は、ウェートを調整してね!!

x Mbed2

x まだ試していない 確認済2022/2/20_18:10
x 74hc164を使用
x Mbed2

目的
液晶のテスト

o_con88.jpg

-248

o_con248.jpg

SC1602と74HC595バージョン ソフトは、違う(確定)

-275-

o_con275.jpg

-277- その1 ソフトウェアの互換 あり

o_con277.jpg

-287- その2

o_con287.jpg

-291-

o_con291.jpg



//ON_LCD_010_1

#include "mbed.h"

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

#define swclk1  PA_5    //A4
#define swdio1  PA_7    //A6
#define en1     PA_4    //A3

DigitalOut swdclk(swclk1);
DigitalOut swdio(swdio1);
DigitalOut en(en1);

//シフトパターン
//              12345678   12345678   12345678   12345678
char b8[8] = {0b10000000,0b01000000,0b00100000,0b00010000,
              0b00001000,0b00000100,0b00000010,0b00000001 };

//1文字の出力
void seg1(int v,int rs)
{
    for(int jj=0;jj<8;jj++){
        if( (v & b8[jj]) == 0 ){
                swdio=0; //ビットが0
        } else {
                swdio=1; //ビットが1 
        }//endif
        swdclk=1;
        swdclk=0; //clk
    }//for

    swdio=rs;
    en=1;     wait_ms(1);
    en=0;
}//seg1

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

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

        //一文字出力
        seg1( *str1 ++ , 1  );

    } //while

    //戻り値
    return(0);

}//ns_printf

//液晶の初期化コード
int lcd_int[]={
  0x30,0x30,0x30,0x38,0x08,0x01,0x06,0x08+0x04
};//lcd_init


//メイン関数
int main() {

    char buf[16]; //バッファー

    //GPIOの初期化
    en=0;

    //液晶の初期化
    for(int ii=0;ii<8;ii++){ 
        seg1( lcd_int[ii] , 0);wait_ms(2);
    }//for

    seg1( 0x80+0x00 , 0  ); //1ライン目にカーソルを移動

    ns_printf("ON LCD ");//wait_ms(500); //debug

    //画面クリア
    //seg1(   0x01  , 0  ); 
    //wait_ms(5);


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

    }//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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?