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 1 year has passed since last update.

LPC812MAXと液晶、ACM1602K-NLW-BBWで「HELLO...」を表示(74HC164)(mbed)

Posted at

x mbed2リビジョン144
x リビジョンを変更できる人むけ

x 74HC164使用

x 原因は、わからないが液晶がちらつく場合は、ウェートを調整してね!!
(電源-GND間のパスコン(47μF~100μF...するといいらしい)

o_con88.jpg

o_cop232.jpg

目的
パラレルLCDのテスト
とりあえず、配線を減らしたかった。




// gpio_P_LCD_HEL_812_1


#include "mbed.h"

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


#define S_SCK  P0_12    //ic 3pin
#define S_MOSI P0_14    //ic 20pin
#define S_SSEL P0_13    //ic 2pin

DigitalOut s_sck(S_SCK);
DigitalOut s_mosi(S_MOSI);
DigitalOut s_ssel(S_SSEL);


void seg1(int v,int rs)
{
    for(int jj=0; jj<8; jj++) {
        if( (v<<jj) & 0x80 ) {
            s_mosi=1; //ビットが1
        } else {
            s_mosi=0; //ビットが0
        }//endif
        s_sck=1;
        s_sck=0; //clk
    }//for

    s_mosi=rs;
    s_ssel=1;
    wait_ms(1);
    s_ssel=0;
}

//文字列の表示 nana_seg
int ns_printf(const 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()
{

    //GPIOの初期化
    s_ssel=0;
    s_sck=0;
    s_mosi=0;
    wait_ms(200); //debug

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

    seg1( 0x80+(0x40*0)+0, 0  );  //1ライン目にカーソルを移動
    ns_printf( "START" );
    wait_ms(700);

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

    seg1( 0x80+(0x40*0)+0, 0  );  //1ライン目にカーソルを移動
    ns_printf( "HELLO" );

    seg1( 0x80+(0x40*1)+0, 0  );  //2ライン目にカーソルを移動
    ns_printf( "WORLD" );

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

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