ST7920 based Chinese LCD driver

Dependencies:   mbed

main.cpp

Committer:
zhangyx
Date:
2017-07-22
Revision:
1:426eea211d41
Parent:
0:7749526f3bdf

File content as of revision 1:426eea211d41:

#include "mbed.h"
#include "chn12864.h"
int main() {
    ChnLCD12864 lcd(D11,D10,D12); // sid(RW), sck(E), cs(RS)
    
    //Text to HEX converter: https://www.streamlet.org/tool/str2hex/
    lcd.printf("\xC4\xE3\xBA\xC3\xCA\xC0\xBD\xE7!123456789abcd");
    wait_ms(1000); //等待1秒
    lcd.cls(); //清屏
    
    for(int i=0; i<10000; i+=4){
        lcd.locate(0,0); //分别控制起始的列和行,从0开始
        lcd.printf("%d", i);
        wait_ms(1000); //等待1秒
        
        lcd.locate(0,1);
        lcd.printf("%d", i+1);
        wait_ms(1000);
        
        lcd.locate(0,2);
        lcd.printf("%d", i+2);
        wait_ms(1000);
        
        lcd.locate(0,3);
        lcd.printf("%d", i+3);
        wait_ms(1000);
        
        lcd.cls(); //清屏
    }


    while(1);
}