LCD12864 cubie驅動顯示

操做系統: 使用的是官方網站上的ubuntu sd card 1.1

1. 安裝python的庫和cubie的gpio庫php

  1. sudo apt-get install python-dev
    python

  2. wget http://dl.linux-sunxi.org/users/tom/pySUNXI-0.1.12.tar.gz
    linux

  3. tar zxf pySUNXI-0.1.12.tar.gz
    ubuntu

  4. sudo python setup.py install網站

複製代碼ui

2. 用Python GPIO裏面的GPIO C庫文件直接編寫 C應用程序 

在/home/cubie/pySUNXI-0.1.12/source目錄下編寫:
pyinclude.c文件(見附件)
pyinclude.h文件(見附件) 
LCD12864Serial.c文件(見附件) 
LCD12864Serial.h文件 (見附件) 
test12864.c文件以下:spa

  1. #include "pyinclude.h"
    操作系統

  2. #include "LCD12864Serial.h"
    orm


  3. int main(void)
    ip

  4. {

  5.     if(SETUP_OK!=sunxi_gpio_init())

  6.         {

  7.         printf("Failed to initialize GPIO\n");

  8.         return -1;

  9.     }

  10.         LCD12864Init();

  11.         while(1)

  12.         {

  13.                 Test12864();

  14.         }

  15.     sunxi_gpio_cleanup();

  16.         return 0;


  17. }

複製代碼

3.硬件鏈接:
cubie       LCD12864
PD6          CS    (RS)
PD7          SID   (RW)
PD8          SCLK   (EN)
PD9          RST
   
4. 編譯運行:

  1. gcc LCD12864Serial.c -c

  2. gcc gpio_lib.c -c

  3. gcc pyinclude.c -c

  4. gcc test12864.c -c

  5. gcc test12864.o gpio_lib.o pyinclude.o LCD12864Serial.o -o test12864

  6. ./test12864

複製代碼

5.有圖有真相:
IMG_20130809_102854.jpgIMG_20130809_102902.jpgIMG_20130809_102912.jpgIMG_20130809_102848.jpg 


附上代碼:  串行12864-1-1.zip (1.61 KB, 下載次數: 17)  串行12864-1-0.zip (1.08 KB, 下載次數: 16) Makefile.zip (297 Bytes, 下載次數: 13) 


原文做者:SUNROC1

原文連接:http://forum.cubietech.com/forum.php?mod=viewthread&tid=918

相關文章
相關標籤/搜索