CCSのPICCでLCD表示をしたいと思った。
古い書籍ではLCD.cについての解説がなかったのでインターネットで探した。
K.Iさんの「http://bluefish.orz.hm/sdoc/pic_ccp.html#LCDってどうやって使うの」
というページでLCD.c内に関数の説明がコメントで書いてあることを知る。
以下の順で記述するとできた。
まず、LCDとPICとのピン接続を定義する。
<例:自分がやったPIC18F2550の場合>
#define LCD_DATA4 PIN_B4
#define LCD_DATA5 PIN_B5
#define LCD_DATA6 PIN_B6
#define LCD_DATA7 PIN_B7
あとは、自分の表示したい事を以下の関数を利用してやる。
\a Set cursor position to upper left //使用例 lcd_putc("\atest");とするとLCDの左
\f Clear display, set cursor to upper left //上端に「test」と表示される。
\n Go to start of second line //
\b Move back one position //
//// If LCD_EXTENDED_NEWLINE is defined, the \n character ////
//// will erase all remanining characters on the current ////
//// line, and move the cursor to the beginning of the next ////
//// line. ////
//// If LCD_EXTENDED_NEWLINE is defined, the \r character ////
//// will move the cursor to the start of the current ////
//// line. ////
\f Clear display, set cursor to upper left //上端に「test」と表示される。
\n Go to start of second line //
\b Move back one position //
//// If LCD_EXTENDED_NEWLINE is defined, the \n character ////
//// will erase all remanining characters on the current ////
//// line, and move the cursor to the beginning of the next ////
//// line. ////
//// If LCD_EXTENDED_NEWLINE is defined, the \r character ////
//// will move the cursor to the start of the current ////
//// line. ////
↑自分には意味が分かりません。
//上左端 lcd_gotoxy(1,1);
//下左端 lcd_gotoxy(2,16);