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

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

?? lcd128x64.c

?? embedded graphics library for avr
?? C
?? 第 1 頁 / 共 2 頁
字號:
#pragma CODE

#include <c8051f020.h>                 // SFR declarations
#include "lcd128x64.h"
#include "fonts.h"

/* pixel level bit masks for display */
/* this array is setup to map the order */
/* of bits in a byte to the vertical order */
/* of bits at the LCD controller */
const unsigned char code l_mask_array[8] =
         {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};

/* the LCD display image memory */
/* buffer arranged so page memory is sequential in RAM */
unsigned char xdata l_display_array[Y_BYTES][X_BYTES];

/* 
**
** Low level LCD Controller Interface Support Routines
** The LCD Controller interfaces to the microcontroller
** using the connections as shown below. 
**
**		P3^0  LCD Controller Reset (RST/) signal
**		P3^1  LCD Controller Chip Select (CS/) signal
**		P3^2  LCD Controller Ctl/Data Select (C/D) signal
**		P3^2  LCD Controller Serial Clcok (SCLK) signal
**		P3^3  LCD Controller Serial Data (SDAT) signal
**
**
*/

void lcd_init(void)
{
	int i;

	/* initialize the port control lines to the LCD module */
	LCD_RST = 1;					/* set RST signal high off output */

	LCD_CS = 1;						/* set chip select high off output */
	
	LCD_CD = 0;						/* set the CD line low as output */
	
	LCD_SCLK = 1;					/* set SCLK line high */

	LCD_SDAT = 0;		   			/* set SDAT line low */

	/* reset the LCD controller chip */
	LCD_RST = 0;					/* set the reset line low */
	for(i=0; i<1000; i++)			/* delay for the reset time */
	{
	}
	LCD_RST = 1;					/* release reset to back high */

	/* program the controller operational state */
	lcd_out_ctl(LCD_SET_ADC_REV);	/* set ADC reverse */
	lcd_out_ctl(LCD_SET_SHL_NOR);	/* set SHL normal */
	lcd_out_ctl(LCD_SET_BIAS_0);	/* set for the low bias mode */
	lcd_out_ctl(LCD_PWR_CTL+5);		/* turn on the VC bit */
	for(i=0; i<1000; i++)			/* delay for the converter on */
	{
	}
	lcd_out_ctl(LCD_PWR_CTL+6);		/* now turn on VC+VR bits */
	for(i=0; i<1000; i++)			/* delay for the regulator on */
	{
	}
	lcd_out_ctl(LCD_PWR_CTL+7);		/* now turn on the VC+VR+VF */
	lcd_out_ctl(LCD_REG_RESISTOR+4); /* set default resistor ratio */
	lcd_out_ctl(LCD_REF_VOLT_MODE);	 /* prime for the reference voltage */
	lcd_out_ctl(LCD_REF_VOLT_REG+42);	 /* set default reference voltage select */
	for(i=0; i<1000; i++)			 /* delay for power stabilize */
	{
	}
	lcd_out_ctl(LCD_DISP_ON);		/* put the display on */

	lcd_out_ctl(LCD_SET_LINE+0);	/* set line for row 0 of display */
	lcd_out_ctl(LCD_SET_PAGE+0);	/* set page 0 */
	lcd_out_ctl(LCD_SET_COL_HI+0);	/* set column 0 */
	lcd_out_ctl(LCD_SET_COL_LO+0);
/*
** 
** program test loop to find right resistor ratio 0-8
** (use by break pointing at each loop step)
**
*/

#if 0
	for(p=0; p<7; p++)
	{
		lcd_out_ctl(LCD_REG_RESISTOR+p); /* set resistor ratio */
	}
#endif

/*
** 
** program test loop to find reference voltage setting 0-63
** (use by break pointing at each loop step)
**
*/

#if 0
	for(p=0; p<63; p++)
	{
		lcd_out_ctl(LCD_REF_VOLT_MODE);	 	 /* prime for the reference voltage */
		lcd_out_ctl(LCD_REF_VOLT_REG+p);	 /* set reference voltage select */
	}
#endif
} 

/* 
**
** low level routine to send a byte value out the serial bus
** to the LCD controller data register. entry argument
** is the data to output.
**
*/

void lcd_out_dat(char dat)
{
	unsigned char i=8;				/* serial bit counter */

	EA = 0;							/* disable interrupts */
	
	LCD_CD = 1;						/* select register for data port */
	LCD_CS = 0;						/* enable interface via chip select */

	while(i--)
	{
		LCD_SDAT = (dat & 0x80 ? 1 : 0);  /* transmit data from MSB */
		LCD_SCLK = 0;				/* turn the clock on */
		dat <<= 1;					/* shift data left 1 place */
		LCD_SCLK = 1;				/* clock back off */	
	}

	LCD_CD = 1;						/* force chip select back off */

	/* re-establish the exit interrupt state */
	EA = 1;
} 

/* 
**
** low level routine to send a byte value out the serial bus
** to the LCD controller control register. entry argument is
** the data to output.
**
*/

void lcd_out_ctl(char dat)
{
	unsigned char i=8;				/* serial bit counter */

	EA = 0;							/* disable interrupts */
	
	LCD_CD = 0;						/* select register for command port */
	LCD_CS = 0;						/* enable interface via chip select */

	while(i--)
	{
		LCD_SDAT = (dat & 0x80 ? 1 : 0);  /* transmit data from MSB */
		LCD_SCLK = 0;				/* turn the clock on */
		dat <<= 1;					/* shift data left 1 place */
		LCD_SCLK = 1;				/* clock back off */	
	}

	LCD_CD = 1;						/* force chip select back off */

	/* re-establish the exit interrupt state */
	EA = 1;
} 
 
/* 
**
** routine to erase the LCD screen, This erases whole
** display memory of the S6B0724 LCD controller.
**
*/

void lcd_erase(void)
{
	unsigned char p;
	unsigned char i;

	for(p=0; p<9; p++)
	{
		lcd_out_ctl(LCD_SET_PAGE+p);	/* set page */
		lcd_out_ctl(LCD_SET_COL_HI+0);	/* set column 0 */
		lcd_out_ctl(LCD_SET_COL_LO+0);
		for(i=0; i<132; i++)
		{
			lcd_out_dat(0);				/* clear the data */
		}
	}
}

/* 
**
** routine to display a test pattern on the LCD screen,
**
*/

unsigned char code testpat[4][8]={
				   {0x0F,0x0F,0x0F,0x0F,0xF0,0xF0,0xF0,0xF0},
				   {0xF0,0xF0,0xF0,0xF0,0x0F,0x0F,0x0F,0x0F},
	               {0xFF,0x81,0xBD,0xBD,0xBD,0xBD,0x81,0xFF},
				   {0x00,0x7E,0x42,0x42,0x42,0x42,0x7E,0x00}
				  };

void lcd_test(unsigned char pattern)
{
	unsigned char p;
	unsigned char i;

	for(p=0; p<7; p++)
	{
		lcd_out_ctl(LCD_SET_PAGE+p);	/* set page */
		lcd_out_ctl(LCD_SET_COL_HI+26/16);	/* set column 0 */
		lcd_out_ctl(LCD_SET_COL_LO+26%16);
		for(i=0; i<106; i++)
		{
			lcd_out_dat(testpat[pattern][i%8]);
		}
	}
}

/*
**
** 	Clears the display memory starting at the left/top  and going to
**  the right/bottom . No runtime error checking is performed. It is 
**  assumed that left is less than right and that top is less than 
**  bottom
**
*/

void lcd_clear_area(unsigned char left,  unsigned char top,    
			        unsigned char right, unsigned char bottom)
{
	unsigned char bit_pos;
	unsigned char x;
	unsigned char byte_offset;
	unsigned char y_bits;
	unsigned char remaining_bits;
	unsigned char mask;

	bit_pos = top & 0x07;					/* get starting bit offset into byte */

	for(x = left; x <= right; x++)
	{
		byte_offset = top >> 3;				/* get byte offset into y direction */
		y_bits = (bottom - top) + 1;		/* get length in the y direction to write */
		remaining_bits = 8 - bit_pos;		/* number of bits left in byte */
		mask = l_mask_array[bit_pos];		/* get mask for this bit */

		while(y_bits)						/* while there are still bits to write */
		{
			if((remaining_bits == 8) && (y_bits > 7))
			{
				/* here if we are byte aligned and have at least 1 byte to write */
				/* do the entire byte at once instead of bit by bit */
				while(y_bits > 7)			/* while there are at least 8 more bits to do */
				{
					l_display_array[byte_offset][x] = 0x00;
					byte_offset++;
					y_bits -= 8;
				}
			}
			else
			{
				/* here if not byte aligned or an entire byte does not need written */
				/* thus do bit by bit */
				l_display_array[byte_offset][x] &= ~mask;
				if(l_mask_array[0] & 0x80)
				{
					mask >>= 1;
				}
				else
				{
					mask <<= 1;
				}
				y_bits--;
				remaining_bits--;
				if(remaining_bits == 0)
				{
					/* might have bust gotton byte aligned */
					/* so reset for beginning of a byte */
					remaining_bits = 8;
					byte_offset++;
					mask = l_mask_array[0];
				}
			}
		}
	}
}

/*
**
** Inverts the display memory starting at the left/top and going to
** the right/bottom. No runtime error checking is performed. It is 
** assumed that left is less than right and that top is less than 
** bottom 
** 
*/

void lcd_invert_area(unsigned char left,  unsigned char top,    
			         unsigned char right, unsigned char bottom)
{
	unsigned char bit_pos;
	unsigned char x;
	unsigned char byte_offset;
	unsigned char y_bits;
	unsigned char remaining_bits;
	unsigned char mask;

	bit_pos = top & 0x07;					/* get starting bit offset into byte */

	for(x = left; x <= right; x++)
  	{
		byte_offset = top >> 3;				/* get byte offset into y direction */
		y_bits = (bottom - top) + 1;		/* get length in the x direction to write */
		remaining_bits = 8 - bit_pos;		/* number of bits left in byte */
		mask = l_mask_array[bit_pos];		/* get mask for this bit */

		while(y_bits)						/* while there are still bits to write */
    	{
			if((remaining_bits == 8) && (y_bits > 7))
			{
				/* here if we are byte aligned and have at least 1 byte to write */
				/* do the entire byte at once instead of bit by bit */
				while(y_bits > 7)			/* while there are at least 8 more bits to do */
				{
					l_display_array[byte_offset][x] ^= 0xFF;
					byte_offset++;
					y_bits -= 8;
				}
      		}
      		else
      		{
				/* here if not byte aligned or an entire byte does not need written */
				/* thus do bit by bit */
				l_display_array[byte_offset][x] ^= mask;
				if(l_mask_array[0] & 0x80)
				{
					mask >>= 1;
				}
				else
				{
					mask <<= 1;
				}
				y_bits--;
				remaining_bits--;
				if(remaining_bits == 0)
				{
					/* might have bust gotton byte aligned */
					/* so reset for beginning of a byte */
					remaining_bits = 8;
					byte_offset++;
					mask = l_mask_array[0];
				}
			}
		}
	}
}

/*
**
** Draws a line into the display memory starting at left going to
** right, on the given row. No runtime error checking is performed.  
** It is assumed that left is less than right.
**
*/

void lcd_horz_line(unsigned char left, unsigned char right,
		           unsigned char row)
{
	unsigned char bit_pos;
	unsigned char byte_offset;
	unsigned char mask;
	unsigned char col;

  	bit_pos = row & 0x07;			/* get the bit offset into a byte */
  	byte_offset = row >> 3;		    /* get the byte offset into x array */
  	mask = l_mask_array[bit_pos]; 	/* get the mask for this bit */

  	for(col = left; col <= right; col++)
  	{
    	l_display_array[byte_offset][col] |= mask;
  	}
}

/*
**
** Draws a vertical line into display memory starting at the top
** going to the bottom in the given column. No runtime error checking 
** is performed. It is assumed that top is less than bottom and that 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产综合久久久久| 国产精品一区在线| 欧美日韩一区二区三区四区| 一区二区三区资源| 91.成人天堂一区| 麻豆国产一区二区| 久久精品一区二区三区四区| 成人动漫一区二区在线| 亚洲精品成人在线| 欧美日韩综合一区| 麻豆国产精品777777在线| 久久综合一区二区| 成人国产一区二区三区精品| 成人免费一区二区三区视频| 欧美视频在线观看一区二区| 日本vs亚洲vs韩国一区三区二区 | 粉嫩绯色av一区二区在线观看| 亚洲国产成人在线| 欧美色中文字幕| 久久国内精品视频| 综合av第一页| 欧美一区二区视频在线观看| 国产一区二区女| 尤物在线观看一区| 久久综合五月天婷婷伊人| 95精品视频在线| 美女视频黄久久| 亚洲人成网站在线| 日韩欧美一区二区久久婷婷| 成+人+亚洲+综合天堂| 亚洲va欧美va国产va天堂影院| 久久综合国产精品| 色婷婷国产精品久久包臀| 另类调教123区 | 亚洲第一成人在线| 国产亚洲精品免费| 欧美日韩国产高清一区二区| 韩国女主播成人在线观看| 亚洲精品你懂的| 久久无码av三级| 欧美日韩中文一区| 国产成人在线观看| 日韩成人一区二区| 亚洲欧美电影一区二区| 久久久久久久久久久久电影| 欧美日韩成人综合在线一区二区| 国产精品一区不卡| 人人狠狠综合久久亚洲| 亚洲精品视频在线观看免费| 久久久久9999亚洲精品| 欧美丰满一区二区免费视频| 99国内精品久久| 韩国欧美国产一区| 免费观看日韩av| 午夜久久福利影院| 亚洲成人第一页| 91精品国产乱码| 色综合天天在线| 高清免费成人av| 国内精品在线播放| 日产国产高清一区二区三区 | 日韩午夜在线影院| 欧美视频中文一区二区三区在线观看| 国产精品18久久久久久久久久久久| 风间由美一区二区av101| 久久精品国产一区二区三| 五月开心婷婷久久| 亚洲大型综合色站| 亚洲综合色噜噜狠狠| 亚洲免费毛片网站| 亚洲精品视频观看| 亚洲精品福利视频网站| 亚洲视频综合在线| 亚洲少妇最新在线视频| 国产精品理论片在线观看| 久久九九全国免费| 久久亚洲精精品中文字幕早川悠里 | 91在线丨porny丨国产| 福利一区二区在线| 国产福利不卡视频| 成人性生交大片免费看视频在线| 国产东北露脸精品视频| 九九精品视频在线看| 精品一区二区三区免费视频| 捆绑调教美女网站视频一区| 久久黄色级2电影| 国产精品一区二区三区网站| 国产白丝网站精品污在线入口| 国产成人精品1024| 成人午夜又粗又硬又大| 91日韩精品一区| 欧美日韩亚洲综合| 91精品国模一区二区三区| 精品少妇一区二区三区视频免付费 | 首页亚洲欧美制服丝腿| 蜜臀av一区二区在线免费观看 | 国产精品午夜久久| 中文字幕一区二区三区精华液 | 狠狠色狠狠色综合系列| 国产馆精品极品| av影院午夜一区| 欧美日韩免费一区二区三区| 欧美一区二区三区小说| 久久久夜色精品亚洲| 国产精品福利一区二区三区| 亚洲精品中文在线观看| 日本美女一区二区| 国产suv精品一区二区6| 欧美综合一区二区三区| 欧美成人三级电影在线| 国产精品不卡在线观看| 亚洲第一福利视频在线| 韩国在线一区二区| 色嗨嗨av一区二区三区| 精品久久国产字幕高潮| 中文字幕一区二区不卡| 麻豆高清免费国产一区| 99在线精品免费| 日韩免费在线观看| 亚洲欧洲日韩综合一区二区| 三级不卡在线观看| 成人av午夜电影| 日韩午夜在线观看| 国产精品久久久久久久久搜平片| 亚洲人亚洲人成电影网站色| 亚洲成人tv网| 国产风韵犹存在线视精品| 在线观看成人免费视频| 国产亚洲欧美一区在线观看| 亚洲国产精品影院| 国产91高潮流白浆在线麻豆| 69久久夜色精品国产69蝌蚪网| 国产精品久久久久一区| 精品一区二区av| 欧美三区免费完整视频在线观看| 国产亚洲一区二区三区四区| 日韩电影在线免费看| 91色乱码一区二区三区| 久久久久久久一区| 免费成人美女在线观看| 欧美亚洲国产怡红院影院| 欧美经典一区二区三区| 麻豆一区二区三区| 欧美日韩久久一区| 亚洲精品免费播放| 不卡视频免费播放| 国产日韩欧美不卡| 国产真实乱子伦精品视频| 国产真实精品久久二三区| 欧美成人精品3d动漫h| 伊人开心综合网| 成人av资源网站| 久久久久久久久久久久电影| 久久精品国产精品青草| 欧美日韩精品欧美日韩精品一| 亚洲精品成人少妇| 一本色道亚洲精品aⅴ| 国产精品国产三级国产三级人妇 | 国产成人免费xxxxxxxx| 欧美电影免费观看高清完整版在| 日韩专区中文字幕一区二区| 在线观看一区日韩| 一区二区三区四区不卡在线| 91蝌蚪porny成人天涯| 国产精品网站在线观看| 成人妖精视频yjsp地址| 国产日韩av一区| 粉嫩欧美一区二区三区高清影视| 久久久久99精品国产片| 国产999精品久久久久久| 国产人成一区二区三区影院| 国产成人丝袜美腿| 国产亚洲欧美一区在线观看| 国产jizzjizz一区二区| 国产精品区一区二区三| 93久久精品日日躁夜夜躁欧美| ...xxx性欧美| 欧美怡红院视频| 日韩电影在线免费观看| 精品国产人成亚洲区| 国产美女在线精品| 国产精品理论片| 91搞黄在线观看| 丝袜美腿亚洲综合| 精品伦理精品一区| 成人深夜在线观看| 夜夜精品视频一区二区| 欧美日韩国产小视频在线观看| 蜜桃av噜噜一区| 国产女人18毛片水真多成人如厕 | 亚洲国产美女搞黄色| 欧美男男青年gay1069videost| 日韩激情一区二区| www国产亚洲精品久久麻豆| 高清成人在线观看| 亚洲丝袜美腿综合| 欧美一级免费大片| 成人动漫一区二区| 偷拍一区二区三区| 久久久99久久|