1602 キャラクタディスプレイ データ4bit接続用ライブラリ STM32F103RB CUCLEOボードを想定
CharLcd4bit.h@0:0e84781e64cf, 2017-10-06 (annotated)
- Committer:
- tshl
- Date:
- Fri Oct 06 05:01:05 2017 +0000
- Revision:
- 0:0e84781e64cf
?????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tshl | 0:0e84781e64cf | 1 | #ifndef _CharLcd4bit_H |
tshl | 0:0e84781e64cf | 2 | #define _CharLcd4bit_H |
tshl | 0:0e84781e64cf | 3 | |
tshl | 0:0e84781e64cf | 4 | #include "mbed.h" |
tshl | 0:0e84781e64cf | 5 | |
tshl | 0:0e84781e64cf | 6 | /** 1602LCD表示クラス 4bitモード */ |
tshl | 0:0e84781e64cf | 7 | class CharLcd4bit |
tshl | 0:0e84781e64cf | 8 | { |
tshl | 0:0e84781e64cf | 9 | public: |
tshl | 0:0e84781e64cf | 10 | /** コンストラクタ */ |
tshl | 0:0e84781e64cf | 11 | CharLcd4bit( |
tshl | 0:0e84781e64cf | 12 | PinName rs, |
tshl | 0:0e84781e64cf | 13 | PinName rw, |
tshl | 0:0e84781e64cf | 14 | PinName e, |
tshl | 0:0e84781e64cf | 15 | PinName d4, |
tshl | 0:0e84781e64cf | 16 | PinName d5, |
tshl | 0:0e84781e64cf | 17 | PinName d6, |
tshl | 0:0e84781e64cf | 18 | PinName d7); |
tshl | 0:0e84781e64cf | 19 | |
tshl | 0:0e84781e64cf | 20 | /** LCD初期化 */ |
tshl | 0:0e84781e64cf | 21 | void Initialize(); |
tshl | 0:0e84781e64cf | 22 | |
tshl | 0:0e84781e64cf | 23 | /** 1行出力 (1行の文字数満たない場合は空白で埋める) |
tshl | 0:0e84781e64cf | 24 | * |
tshl | 0:0e84781e64cf | 25 | * @param int line : ライン番号 |
tshl | 0:0e84781e64cf | 26 | * @param char *str : 文字列 |
tshl | 0:0e84781e64cf | 27 | */ |
tshl | 0:0e84781e64cf | 28 | void WriteLine(int line, char *str); |
tshl | 0:0e84781e64cf | 29 | |
tshl | 0:0e84781e64cf | 30 | /** 文字列出力 |
tshl | 0:0e84781e64cf | 31 | * |
tshl | 0:0e84781e64cf | 32 | * @param char *str : 文字列 |
tshl | 0:0e84781e64cf | 33 | */ |
tshl | 0:0e84781e64cf | 34 | void WriteStr(char *str); |
tshl | 0:0e84781e64cf | 35 | |
tshl | 0:0e84781e64cf | 36 | /** 1文字出力 |
tshl | 0:0e84781e64cf | 37 | * |
tshl | 0:0e84781e64cf | 38 | * @param char c : 文字 |
tshl | 0:0e84781e64cf | 39 | */ |
tshl | 0:0e84781e64cf | 40 | void WriteChar(char c); |
tshl | 0:0e84781e64cf | 41 | |
tshl | 0:0e84781e64cf | 42 | /** 文字位置指定 |
tshl | 0:0e84781e64cf | 43 | * |
tshl | 0:0e84781e64cf | 44 | * @param int line : ライン番号 |
tshl | 0:0e84781e64cf | 45 | * @param int position : 文字位置 |
tshl | 0:0e84781e64cf | 46 | */ |
tshl | 0:0e84781e64cf | 47 | void SetPosition(int line, int position); |
tshl | 0:0e84781e64cf | 48 | |
tshl | 0:0e84781e64cf | 49 | /** 表示クリア */ |
tshl | 0:0e84781e64cf | 50 | void Clear(); |
tshl | 0:0e84781e64cf | 51 | |
tshl | 0:0e84781e64cf | 52 | private: |
tshl | 0:0e84781e64cf | 53 | void lcd8(char c, bool isData); |
tshl | 0:0e84781e64cf | 54 | void lcd4(char data); |
tshl | 0:0e84781e64cf | 55 | |
tshl | 0:0e84781e64cf | 56 | DigitalOut RS; |
tshl | 0:0e84781e64cf | 57 | DigitalOut RW; |
tshl | 0:0e84781e64cf | 58 | DigitalOut E; |
tshl | 0:0e84781e64cf | 59 | DigitalOut DB4; |
tshl | 0:0e84781e64cf | 60 | DigitalOut DB5; |
tshl | 0:0e84781e64cf | 61 | DigitalOut DB6; |
tshl | 0:0e84781e64cf | 62 | DigitalOut DB7; |
tshl | 0:0e84781e64cf | 63 | }; |
tshl | 0:0e84781e64cf | 64 | |
tshl | 0:0e84781e64cf | 65 | #endif // _CharLcd4bit_H |