亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? lcdsed1335.cpp

?? SED1335驅動程序
?? CPP
字號:
/////////////////////////////////////////////////////////////////////////
////                           SED1335.c                             ////
////                                                                 ////
////  Example drivers for the SED1335 LCD controller on an Ampire    ////
////  AG-320240A1 display.                                           ////
/////////////////////////////////////////////////////////////////////////
////                                                                 ////
////  glcd_init(mode)                                                ////
////     * Must be called before any other function.                 ////
////       - mode can be ON or OFF to turn the LCD on or off         ////
////                                                                 ////
////  glcd_pixel(x,y,color)                                          ////
////     * Sets the pixel to the given color.                        ////
////       - color can be ON or OFF                                  ////
////                                                                 ////
////  glcd_fillScreen(color)                                         ////
////     * Fills the entire LCD with the given color.                ////
////       - color can be ON or OFF                                  ////
////                                                                 ////
/////////////////////////////////////////////////////////////////////////
////        (C) Copyright 1996,2003 Custom Computer Services         ////
//// This source code may only be used by licensed users of the CCS  ////
//// C compiler.  This source code may only be distributed to other  ////
//// licensed users of the CCS C compiler.  No other use,            ////
//// reproduction or distribution is permitted without written       ////
//// permission.  Derivative programs created using this software    ////
//// in object code form are not restricted in any way.              ////
/////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////
#ifndef SED1335
#define SED1335

#ifndef GLCD_WIDTH
#define GLCD_WIDTH         320
#endif

#ifndef GLCD_HEIGHT
#define GLCD_HEIGHT        240
#endif

#ifndef GLCD_CHAR_WIDTH
#define GLCD_CHAR_WIDTH    8
#endif

#ifndef GLCD_CHAR_HEIGHT
#define GLCD_CHAR_HEIGHT   8
#endif

#ifndef GLCD_RST
#define GLCD_RST           PIN_C3
#endif

#ifndef GLCD_RD
#define GLCD_RD            PIN_B5
#endif

#ifndef GLCD_WR
#define GLCD_WR            PIN_B1
#endif

#ifndef GLCD_CS
#define GLCD_CS            PIN_B2
#endif

#ifndef GLCD_A0
#define GLCD_A0            PIN_B4
#endif

#ifndef ON
#define ON                 1
#endif

#ifndef OFF
#define OFF                0
#endif
/////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////
// The following defines setup the memory used by different regions
// Currenty one text area is defined at the beginning of memory
// and a graphics area follows immediately after
/////////////////////////////////////////////////////////////////////////
#define GLCD_TEXT_ADDR              0x0000
#define GLCD_GRAPHICS_ADDR          GLCD_WIDTH * GLCD_HEIGHT / 64
#define GLCD_GRAPHICS_ADDR_END      GLCD_GRAPHICS_ADDR + (GLCD_WIDTH * GLCD_HEIGHT / 8)
/////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////
#if GLCD_CHAR_WIDTH < 9
   #define GLCD_CR (GLCD_WIDTH/8 - 1)
#else
   #define GLCD_CR (GLCD_WIDTH/4 - 2)
#endif
/////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////
#define TGLCD_COMMAND   output_high(GLCD_A0);
#define TGLCD_DATA      output_low(GLCD_A0);
/////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////
int8 glcd_readByte();
void glcd_sendByte(int8 data);
void glcd_fillScreen(int1 color);
void glcd_fillScreenText(char c);
void setCursorAddress(int16 addr);
void glcd_pixel(int16 x, int16 y, int1 color);
int8 getData(int16 addr);
void glcd_sendCMD(int8 cmd);
/////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////
void glcd_systemSetup();
void glcd_scrollSetup();
void glcd_overlaySetup();
void glcd_power(int1 mode);
void glcd_cursorDirection(int8 dir);
void glcd_cursorForm(int8 width, int8 height);
void setData(int16 addr, int8 data);
/////////////////////////////////////////////////////////////////////////


#define GLCD_CMD_SYSTEM          0x40  // General system settings
#define GLCD_CMD_SLEEP           0x53  // Enter into standy mode
#define GLCD_CMD_DISP_OFF        0x58  // Turn the display off
#define GLCD_CMD_DISP_ON         0x59  // Turn the display on
#define GLCD_CMD_SCROLL          0x44  // Setup text and graphics address regions
#define GLCD_CMD_CSR_FORM        0x5D  // Set cursor size
#define GLCD_CMD_CSRDIR_RIGHT    0x4C  // Cursor moves right after write to display memory
#define GLCD_CMD_CSRDIR_LEFT     0x4D  // Cursor moves left after write to display memory
#define GLCD_CMD_CSRDIR_UP       0x4E  // Cursor moves up after write to display memory
#define GLCD_CMD_CSRDIR_DN       0x4F  // Cursor moves down after write to display memory
#define GLCD_CMD_CGRAM_ADDR      0x5C  // Configure character generator RAM address
#define GLCD_CMD_HDOT_SCR        0x5A  // Set horizontal scroll rate
#define GLCD_CMD_OVERLAY         0x5B  // Configure how layers overlay
#define GLCD_CMD_SET_CSR_ADDR    0x46  // Set the cursor address
#define GLCD_CMD_GET_CSR_ADDR    0x47  // Read the cursor address
#define GLCD_CMD_DISPLAY_WRITE   0x42  // Write to display memory
#define GLCD_CMD_DISPLAY_READ    0x43  // Read from display memory


// Purpose:       Initialize the controller
// Inputs:        The initialization mode
//                OFF - Turns the LCD off
//                ON  - Turns the LCD on
void glcd_init(int1 mode)
{
   // Initialze some pins
   output_high(GLCD_RST);
   output_high(GLCD_CS);
   output_high(GLCD_RD);
   output_high(GLCD_WR);

   glcd_systemSetup();
   glcd_scrollSetup();
   glcd_overlaySetup();
   glcd_power(OFF);
   glcd_cursorForm(4, 6);
   glcd_fillScreen(OFF);
   glcd_fillScreenText(' ');
   glcd_power(mode);
   glcd_cursorDirection(GLCD_CMD_CSRDIR_RIGHT);
}


// Purpose:       Turn a pixel on a graphic LCD on or off
// Inputs:        x - the x coordinate of the pixel
//                y - the y coordinate of the pixel
//                color - ON or OFF
void glcd_pixel(int16 x, int16 y, int1 color)
{
   int8  data;
   int16 addr;

   // Calculate the byte address containing the pixel
   addr = GLCD_GRAPHICS_ADDR + (GLCD_WIDTH/8 * y + x/8);

   // Read the byte of data at the address
   data = getData(addr);

   // Turn the pixel on or off
   if(color == ON)
      bit_set(data, 7 - x%8);
   else
      bit_clear(data, 7 - x%8);

   // Write the new data byte to display memory
   setData(addr, data);
}


// Purpose:    Initialize the display environment
void glcd_systemSetup()
{
   glcd_sendCMD(GLCD_CMD_SYSTEM);          // Setup the system
   TGLCD_DATA                              // Set for data
   glcd_sendByte(0x30);                    // No offset
   glcd_sendByte(0x7F + GLCD_CHAR_WIDTH);  // Set character width
   glcd_sendByte(GLCD_CHAR_HEIGHT - 1);    // Set character height
   glcd_sendByte(GLCD_CR);                 // Display line address range
   glcd_sendByte(0x2F);                    // TC/R
   glcd_sendByte(GLCD_HEIGHT - 1);         // Number of lines per frame
   glcd_sendByte(GLCD_CR + 1);             // Horizontal address range LSB (APL)
   glcd_sendByte((GLCD_CR + 1) / 0xFF);    // Horizontal address range MSB (APH)
}


// Purpose:    Set the scroll start address and
//             the size of a scroll block
void glcd_scrollSetup()
{
   // Currently setup for a text and graphics layer
   glcd_sendCMD(GLCD_CMD_SCROLL);              // Setup scrolling
   TGLCD_DATA                                  // Set for data
   glcd_sendByte(GLCD_TEXT_ADDR);              // SAD1L
   glcd_sendByte(GLCD_TEXT_ADDR / 0xFF);       // SAD1H
   glcd_sendByte(GLCD_HEIGHT - 1);             // SL1
   glcd_sendByte(GLCD_GRAPHICS_ADDR);          // SAD2L
   glcd_sendByte(GLCD_GRAPHICS_ADDR / 0xFF);   // SAD2H
   glcd_sendByte(GLCD_HEIGHT - 1);             // SL2
   glcd_sendByte(0x00);                        // SAD3L
   glcd_sendByte(0x00);                        // SAD3H
   glcd_sendByte(0x00);                        // SAD4L
   glcd_sendByte(0x00);                        // SAD4H

   glcd_sendCMD(GLCD_CMD_HDOT_SCR);            // Horizontal scroll rate
   TGLCD_DATA                                  // Set for data
   glcd_sendByte(0x00);                        // Horizontal pixel shift is 0
}


// Purpose:    Setup the overlay functionality for combining
//             layers of text and graphics, or multiple
//             graphics layers
void glcd_overlaySetup()
{
   // Currently setup for a single graphics layer
   glcd_sendCMD(GLCD_CMD_OVERLAY);              // Text / graphic overlay mode
   TGLCD_DATA                                   // Set for data
   glcd_sendByte(0x09);                         // Area 1 text, others graphics
                                                // Text XOR Graphics
}


// Purpose:    Turn the display on or off
// Inputs:     ON to turn on or OFF to turn off
void glcd_power(int1 mode)
{
   if(mode == ON)
   {
      glcd_sendCMD(GLCD_CMD_DISP_ON);           // Turn the display on
   }
   else
   {
      glcd_sendCMD(GLCD_CMD_DISP_OFF);          // Turn the display off
   }

   TGLCD_DATA                                   // Set for data
   glcd_sendByte(0x14);
}


// Purpose:    Set the direction the cursor moves after
//             writing to dispaly memory
// Inputs:     Use one of the following to set the direction:
//             GLCD_CMD_CSRDIR_RIGHT
//             GLCD_CMD_CSRDIR_LEFT
//             GLCD_CMD_CSRDIR_UP
//             GLCD_CMD_CSRDIR_DOWN
void glcd_cursorDirection(int8 dir)
{
   glcd_sendCMD(dir);
}


// Purpose:    Set the size of the cursor
// Inputs:     1) The width in pixels - 1  Valid numbers: (0 - 15)
//             2) The height in pixels - 1 Valid numbers: (1 - 15)
void glcd_cursorForm(int8 width, int8 height)
{
   glcd_sendCMD(GLCD_CMD_CSR_FORM);             // Cursor form and size
   TGLCD_DATA                                   // Set for data
   glcd_sendByte(width);
   glcd_sendByte(0x80 + height);
}


// Purpose:    Fill a graphics layer passed in color
//             Works much faster than drawing a rectangle to fill the screen
// Inputs:     ON - turn all the pixels on
//             OFF - turn all the pixels off
void glcd_fillScreen(int1 color)
{
   int16 i;

   setCursorAddress(GLCD_GRAPHICS_ADDR);
   glcd_sendCMD(GLCD_CMD_DISPLAY_WRITE);
   TGLCD_DATA

   for(i = GLCD_GRAPHICS_ADDR; i < GLCD_GRAPHICS_ADDR_END; ++i)
   {
      glcd_sendByte(0xFF * color);
   }
}


// Purpose:    Fill a text layer with a the passed in character
//             Works much faster than drawing a rectangle to fill the screen
// Inputs:     ON - turn all the pixels on
//             OFF - turn all the pixels off
void glcd_fillScreenText(char c)
{
   int16 i;

   setCursorAddress(GLCD_TEXT_ADDR);
   glcd_sendCMD(GLCD_CMD_DISPLAY_WRITE);
   TGLCD_DATA

   for(i = GLCD_TEXT_ADDR; i < GLCD_GRAPHICS_ADDR; ++i)
   {
      glcd_sendByte(c);
   }
}


// Purpose:    Write a byte of data
// Inputs:     The byte of data to write
void glcd_sendByte(byte data)
{
   output_d((data));
   output_low(GLCD_CS);
   delay_cycles(1);
   output_low(GLCD_WR);
   delay_cycles(2);
   output_high(GLCD_WR);
   output_high(GLCD_CS);
}


// Purpose:    Read a byte of data
// Outputs:    The byte of data
int8 glcd_readByte()
{
   byte data;
   set_tris_d(0xFF);
   output_low(GLCD_CS);
   delay_cycles(1);
   output_low(GLCD_RD);
   delay_cycles(2);
   data = input_d();
   output_high(GLCD_RD);
   output_high(GLCD_CS);

   return data;
}


// Purpose:    Get the status
// Outputs:    The status in an 8 bit integer
int8 getStatus()
{
   int8 status;
   TGLCD_DATA
   output_low(GLCD_CS);
   output_low(GLCD_RD);
   delay_us(1);
   status = input_d();
   output_high(GLCD_RD);
   output_high(GLCD_CS);

   return status;
}


// Purpose:    Get the current address of the cursor
// Outputs:    A 16 bit integer containing the cursor address
int16 getCursorAddress()
{
   int16 addr;

   glcd_sendCMD(GLCD_CMD_GET_CSR_ADDR);
   TGLCD_DATA
   *(int8*)(&addr    ) = glcd_readByte();  // Read low part
   *(int8*)(&addr + 1) = glcd_readByte();  // Read high part

   return addr;
}


// Purpose:    Set the cursor address
// Inputs:     A 16 bit integer containing the new cursor address
void setCursorAddress(int16 addr)
{
   glcd_sendCMD(GLCD_CMD_SET_CSR_ADDR);
   TGLCD_DATA
   glcd_sendByte(*(int8*)(&addr    ));
   glcd_sendByte(*(int8*)(&addr + 1));
}


// Purpose:    Get a byte of data from the display at the address
// Inputs:     A 16 bit integer containing the address
// Outputs:    An 8 bit integer with the read data
int8 getData(int16 addr)
{
   setCursorAddress(addr);
   glcd_sendCMD(GLCD_CMD_DISPLAY_READ);
   TGLCD_DATA
   return glcd_readByte();
}


// Purpose:    Set a byte of display data at an address
// Inputs:     1) A 16 bit address
//             2) 8 bits worth
void setData(int16 addr, int8 data)
{
   setCursorAddress(addr);
   glcd_sendCMD(GLCD_CMD_DISPLAY_WRITE);
   TGLCD_DATA
   glcd_sendByte(data);
}


// Purpose:    Send an 8 bit command
// Inputs:     The command to send
void glcd_sendCMD(int8 cmd)
{
   TGLCD_COMMAND
   glcd_sendByte(cmd);
}

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产综合色| 成人免费在线观看入口| 欧美视频一区二| 色又黄又爽网站www久久| 大白屁股一区二区视频| 国产成人啪免费观看软件| 精品亚洲国产成人av制服丝袜| 日日夜夜精品视频免费| 午夜国产精品一区| 日本欧美一区二区三区| 精品一区在线看| 国产成人精品网址| 99国内精品久久| 色婷婷一区二区三区四区| 91福利精品视频| 4438x亚洲最大成人网| 日韩欧美123| 国产欧美一区二区精品性色超碰| 国产亚洲精品7777| 一区二区三区在线观看国产| 亚洲综合丝袜美腿| 免费高清不卡av| 成人理论电影网| 欧美午夜免费电影| 精品国产人成亚洲区| 中文字幕在线观看不卡| 亚洲国产成人高清精品| 精品系列免费在线观看| 99久久精品国产麻豆演员表| 欧美午夜片在线看| 国产精品久久久久9999吃药| 一区二区三区影院| 激情久久五月天| 91国偷自产一区二区开放时间 | 成人精品免费网站| 精品视频123区在线观看| 欧美一级二级在线观看| 国产精品色在线| 看片网站欧美日韩| 色欲综合视频天天天| 337p日本欧洲亚洲大胆色噜噜| 国产精品久久久久影院亚瑟 | 中文字幕亚洲电影| 免费看精品久久片| 色八戒一区二区三区| 精品国产91乱码一区二区三区 | 人禽交欧美网站| 91在线porny国产在线看| 日韩一区二区高清| 亚洲精品成人少妇| 成人亚洲精品久久久久软件| 欧美电影在哪看比较好| 亚洲视频在线观看一区| 国产成人av一区二区三区在线 | 国产精品午夜电影| 国产麻豆精品在线| 91精品国产日韩91久久久久久| 中文字幕中文字幕在线一区| 九九久久精品视频| 欧美一区二区精品久久911| 一区二区三区精品久久久| 粉嫩av亚洲一区二区图片| 日韩一级大片在线观看| 午夜视频一区二区| 欧洲精品视频在线观看| 亚洲色大成网站www久久九九| 国产精品羞羞答答xxdd| 日韩免费高清视频| 蜜臀av一级做a爰片久久| 欧美日韩一区二区不卡| 一区二区三区高清不卡| 91麻豆蜜桃一区二区三区| 国产精品久久久久久福利一牛影视 | 成人激情小说网站| 国产午夜精品一区二区三区视频| 免费在线观看一区二区三区| 欧美日韩一卡二卡三卡| 亚洲一二三区不卡| 欧美日韩国产精品自在自线| 一区二区三区四区中文字幕| 色屁屁一区二区| 亚洲综合偷拍欧美一区色| 一本一本久久a久久精品综合麻豆| 国产精品美女一区二区在线观看| 福利电影一区二区三区| 日本一区二区电影| 99久久婷婷国产综合精品电影 | av午夜一区麻豆| 亚洲欧美日韩综合aⅴ视频| 成人毛片在线观看| 一区二区不卡在线视频 午夜欧美不卡在| 91豆麻精品91久久久久久| 一区二区三区视频在线看| 欧美伊人久久久久久午夜久久久久| 亚洲一区二区三区四区在线观看 | 欧美激情在线看| 色丁香久综合在线久综合在线观看| 亚洲精品v日韩精品| 欧美三片在线视频观看| 久久69国产一区二区蜜臀| 中文字幕欧美日韩一区| 91小视频免费观看| 日韩高清国产一区在线| 久久久午夜精品理论片中文字幕| 国产凹凸在线观看一区二区| 亚洲欧美激情插| 精品欧美一区二区在线观看 | 欧美三级一区二区| 久久99国产精品成人| 国产精品福利影院| 宅男噜噜噜66一区二区66| 丰满白嫩尤物一区二区| 午夜电影网一区| 中文字幕在线视频一区| 日韩一卡二卡三卡四卡| 91麻豆国产自产在线观看| 久久不见久久见中文字幕免费| 国产精品成人一区二区艾草| 6080亚洲精品一区二区| av资源站一区| 国产一区二区三区四区五区美女 | 99国产精品久久久久久久久久久| 成人污污视频在线观看| 亚洲国产精品久久一线不卡| 国产亚洲视频系列| 欧美一区二区三区免费| 91蜜桃免费观看视频| 国产在线国偷精品产拍免费yy| 亚洲精品一卡二卡| 中国色在线观看另类| 久久香蕉国产线看观看99| 欧美日韩精品综合在线| 成人av在线电影| 国产激情91久久精品导航 | 欧美在线视频全部完| 国产精品自产自拍| 久久99热这里只有精品| 香蕉成人伊视频在线观看| 亚洲同性gay激情无套| 国产精品女主播在线观看| 欧美草草影院在线视频| 91.com视频| 欧美精品aⅴ在线视频| 欧美视频精品在线| 色噜噜狠狠成人网p站| 99免费精品视频| 91亚洲国产成人精品一区二三| 风流少妇一区二区| 国产成人午夜视频| 成人国产精品视频| 成人av在线播放网址| av激情亚洲男人天堂| 成人avav影音| 91丨九色丨蝌蚪丨老版| 91丨九色丨蝌蚪富婆spa| 91浏览器打开| 欧美在线不卡视频| 欧美日韩精品综合在线| 欧美一区午夜精品| 精品日韩欧美一区二区| 26uuu久久天堂性欧美| 国产日韩欧美精品电影三级在线 | 欧美三级日韩在线| 欧美日韩激情一区二区三区| 91精品国产综合久久久久久久久久| 欧美亚洲国产一卡| 91麻豆精品国产| 久久久久九九视频| 亚洲视频 欧洲视频| 亚洲国产视频一区| 蜜桃一区二区三区在线观看| 韩国在线一区二区| 成人激情免费网站| 欧美日韩一区二区三区免费看 | 欧美日韩一卡二卡| 精品剧情v国产在线观看在线| 久久久久9999亚洲精品| 亚洲欧美激情插| 六月丁香综合在线视频| 福利一区福利二区| 欧美人妇做爰xxxⅹ性高电影| 欧美不卡视频一区| 亚洲视频在线一区二区| 日韩成人午夜电影| 波多野结衣在线一区| 国产日韩高清在线| 亚洲成人三级小说| 国产一区二区剧情av在线| 色狠狠av一区二区三区| 88在线观看91蜜桃国自产| 国产日韩欧美精品综合| 亚洲国产va精品久久久不卡综合| 国产一区二区网址| 欧美三级视频在线观看| 国产日产欧美一区二区三区| 香蕉久久夜色精品国产使用方法 | 欧美丰满少妇xxxxx高潮对白| 久久久91精品国产一区二区精品| 亚洲综合免费观看高清完整版在线 | 精品久久久网站|