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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? at29c020_card.c

?? C51單片機(jī)端
?? C
字號(hào):

/*****************************************************************/
/* This program demonstrates how a sector in one of the 512K X 8 */
/* variants can be programmed. The program first determines */
/* exactly which device is available by reading the device ID. */
/* A sector is then programed with data that is copied from an */
/* SRAM buffer. After waiting for the programming cycle to */
/* complete the data is copied back from the 29C040 to the SRAM */
/* buffer. */
/* */
/* The sector size and programming time are determined */
/* by examining the device ID. The different 512K X 8 devices */
/* have either a 256- or 512-byte sector size and a 10 mS or 20 */
/* mS tWC. */
/*****************************************************************/
/***********************/
/* COMPILER DIRECTIVES */
/***********************/
//.asm
//.linklist
//.symbols
//.endasm

#include "c8051sr.h"
/********************/
/* GLOBAL VARIABLES */
/********************/
unsigned char part_id;          /* DEVICE ID VALUE */
int sector_size;                /* DEVICE SECTOR SIZE */
int twc;                        /* DEVICE PROGRAMMING TIME REQUIRED */
unsigned char data_buffer[512]; /* SRAM DATA BUFFER */
unsigned char block_number;     /* WHICH BLOCK TO PROGRAM */
unsigned int sector_address;    /* ADDRESS WITHIN SECTOR TO PROGRAM */
unsigned int address_pointer;   /* SCRATCH PAD ADDRESS REGISTER */
unsigned char temp_byte;        /* SCRATCH PAD DATA REGISTER */

/***********************/
/* SUPPORT SUBROUTINES */
/***********************/
/********************************************************************/
/* DELAYMS performs a time delay. The variable ticks indicates the */
/* length of the delay in mS. This routine is dependant upon the */
/* clock rate of the 89C51. If a clock rate other than 12 MHz is */
/* used the variable 'count' must be modified. */
/********************************************************************/
void delayms(char ticks)
{
	char count;
	for(ticks = ticks; ticks >= 0; ticks—)
	{
		for (count = 0; count <= 13; count++)
		{
		}
	}
}

/*****************************************************************/
/* ENTER_ID_MODE is used to put the 29C040 into Software Product */
/* Identification mode. The three step sequence is performed in */
/* assembly because of tBLC requirements of the 29C040. */
/*****************************************************************/
void enter_id_mode()
{
	asm
	mov a,#05h
	mov p1,a
	mov dptr,#4555h
	mov a,#aah
	movx @dptr,a ;write AAh to address 05555h
	mov a,#02h
	mov p1,a
	mov dptr,#4aaah
	mov a,#55h
	movx @dptr,a ;write 55h to address 02AAAh
	mov a,#05h
	mov p1,a
	mov dptr,#4555h
	mov a,#90h
	movx @dptr,a ;write 90h to address 05555h
	.endasm
}
/********************************************************************/
/* LEAVE_ID_MODE is used to remove the 29C040 from Software Product */
/* Identification mode. The three step sequence is performed in */
/* assembly because of tBLC requirements of the 29C040. */
/********************************************************************/
void leave_id_mode()
{
.asm
mov a,#05h
mov p1,a
mov dptr,#4555h
mov a,#aah
movx @dptr,a ;write AAh to address 05555h
mov a,#02h
mov p1,a
mov dptr,#4aaah
mov a,#55h
movx @dptr,a ;write 55h to address 02AAAh
mov a,#05h
mov p1,a
mov dptr,#4555h
mov a,#f0h
movx @dptr,a ;write F0h to address 05555h
.endasm
}
/*********************************************************************/
/* GET_ID is used read the value at location 00001 of the 20C040. */
/* The value read from the device is returned to the calling routine */
/*********************************************************************/
unsigned char get_id()
{
P1 = 0x00; /* read from block 00h */
.asm
mov dptr,#4001h ;read from address 00001h
movx a,@dptr ; (flash offset = 4000h)
.endasm
return(A); /* return data value */
}
/******************************************************************/
/* GET_PART_ID determines the device ID of the 29C040 being used. */
/* The ID value is returned to the calling routine */
/******************************************************************/
unsigned char get_part_id()
{
unsigned char part_id;
enter_id_mode(); /* enter Identification mode */
delayms(20); /* delay 20mS */
part_id = get_id(); /* read device ID from address 1 */
leave_id_mode(); /* exit from Identification mode */
delayms(20); /* delay 20mS */
return(part_id); /* return device ID value */
}
/*****************************************************************/
/* SET_PARAMETERS is used to define what sector size and write */
/* cycle is required for the particular 29C040 being used */
/* The sector size is stored in the global variable SECTOR_SIZE, */
/* and the programming time is stored in the global variable TWC.*/
/*****************************************************************/
void set_parameters(unsigned char part_id)
{
switch(part_id)
{
case 0x5b : sector_size = 512; /* is the device a 29C040 */
twc = 10;
break;
case 0xa4 : sector_size = 256; /* is the device a 29C040A */
twc = 10;
break;
case 0x3b : sector_size = 512; /* is the device a 29LV040 */
twc = 20;
break;
case 0xc4 : sector_size = 256; /* is the device a 29LV040A */
twc = 20;
break;
default : sector_size = 0; /* variables default to 0 */
twc = 0;
}
}
/*****************************************************************/
/* DUMMY_BUFFER_LOAD simply loads the SRAM buffer with the value */
/* passed in IN_VALUE. Although the SRAM buffer has 512 bytes, */
/* only the number of bytes required to fill a sector are loaded.*/
/*****************************************************************/
void dummy_buffer_load(char in_value)
{
int count;
for (count = 0; count <= sector_size; count++)
{
data_buffer[count] = in_value;
}
}
/*****************************************************************/
/* WRITE_SECTOR copies data from the SRAM buffer into the sector */
/* specified in the 29C040. After loading the sector the routine*/
/* paused the required tWC for the programming cycle to complete.*/
/*****************************************************************/
void write_sector()
{
	.asm
	mov a,#05h ;perform 3 step SDP sequence
	mov p1,a
	mov dptr,#4555h
	mov a,#aah
	movx @dptr,a ;write AAh to address 05555h

	mov a,#02h
	mov p1,a
	mov dptr,#4aaah
	mov a,#55h
	movx @dptr,a ;write 55h to address 02AAAh

	mov a,#05h	
	mov p1,a
	mov dptr,#4555h
	mov a,#A0h
	movx @dptr,a ;write A0h to address 05555h

	mov dptr,#_block_number
	movx a,@dptr
	mov P1,a ;set up block address

	mov dptr,#_sector_size ;load sector size
	movx a,@dptr
	mov r0,a
	inc dptr
	movx a,@dptr
	mov r1,a
	mov dptr,#_sector_address ;load first sector address to write
	movx a,@dptr
	add a,#40h
	mov r3,a
	inc dptr
	movx a,@dptr
	mov r2,a
	mov dptr,#_data_buffer ;load pointer to data_buffer
	nextwr: movx a,@dptr ;load data to write to 29C040
	inc dptr ;increment data_buffer pointer
	push dpl
	push dph
	mov dpl,r2
	mov dph,r3
	movx @dptr,a ;write data to 29C040
	inc dptr ;increment flash address pointer
	mov r2,dpl
	mov r3,dph
	pop dph
	pop dpl
	djnz r1,nextwr ;decrement byte counter
	djnz r0,nextwr ; loop until sector has been loaded
	.endasm
	delayms(twc); /* delay for the programming cycle */
}
/********************************************************************/
/* READ_SECTOR copies a sector from the 29C040 into the SRAM buffer */
/* Either 256 or 512 bytes are transfered depending on the size of */
/* the sector. */
/********************************************************************/
void read_sector()
{
unsigned int count;
P1 = block_number; /* initial block # */
address_pointer = sector_address + 0x4000; /*create address pointer*/
for (count = 0; count < sector_size; count++) /*transfer sector to SRAM*/
{
asm
mov dptr,#_address_pointer ;load address pointer's address
movx a,@dptr ;load address pointer high byte
mov b,a
inc dptr
movx a,@dptr ;load address pointer low byte
mov dpl,a
mov dph,b
movx a,@dptr ;read data from 29C040
mov dptr,#_temp_byte
movx @dptr,a ;store data from 29C040 into temp_byte
endasm
data_buffer[count] = temp_byte; /*place data into SRAM*/
address_pointer = address_pointer + 1; /*increment address pointer*/
}
}
/************/
/* MAINLINE */
/************/
main()
{
part_id = get_part_id(); /* GET PART ID */
set_parameters(part_id); /* DETERMINE WRITE PARAMETERS */
dummy_buffer_load(0x55); /* LOAD SRAM BUFFER WITH DUMMY DATA */
block_number = 0x1f; /* SPECIFY BLOCK NUMBER TO WRITE */
sector_address = 0x0400; /* SPECIFY ADDRESS WITHIN BLOCK */
write_sector(); /* COPY SRAM BUFFER TO 29C040 */
read_sector(); /* COPY 29C040 SECTOR TO SRAM */
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩卡一卡二| 7777女厕盗摄久久久| 日韩精品电影一区亚洲| 久久综合久久鬼色中文字| 色香色香欲天天天影视综合网| 日韩电影免费在线看| 自拍视频在线观看一区二区| 欧美一级搡bbbb搡bbbb| 91免费看片在线观看| 久久66热偷产精品| 亚洲一区二三区| 国产精品久久久久久久第一福利 | 91网址在线看| 久久成人av少妇免费| 亚洲成人你懂的| 国产精品久久久久精k8| 久久综合国产精品| 6080yy午夜一二三区久久| av一区二区三区黑人| 国产一区二区三区免费看| 五月天中文字幕一区二区| 亚洲欧洲日韩在线| 国产清纯在线一区二区www| 91精品国产欧美一区二区18| 在线观看日韩高清av| 成人av电影免费观看| 国产成人h网站| 精品无人码麻豆乱码1区2区| 日韩av中文在线观看| 亚洲在线观看免费| 亚洲欧美自拍偷拍| 中文一区二区完整视频在线观看| 精品国产区一区| 日韩一级片网址| 欧美一区二区三区视频免费| 欧美日韩国产色站一区二区三区| 色视频成人在线观看免| av电影一区二区| 99riav久久精品riav| 91在线观看美女| 91麻豆123| 色88888久久久久久影院按摩| www.在线欧美| 91免费在线播放| 欧洲av在线精品| 欧美四级电影网| 欧美日韩高清一区二区三区| 欧美日韩亚洲丝袜制服| 7777女厕盗摄久久久| 91精品国产欧美日韩| 欧美一区二区不卡视频| 日韩欧美视频一区| 精品美女被调教视频大全网站| 欧美成人精品1314www| 久久亚洲精品小早川怜子| 国产色婷婷亚洲99精品小说| 久久久精品tv| 成人欧美一区二区三区视频网页| 亚洲欧美日韩中文播放| 亚洲高清免费一级二级三级| 青青草原综合久久大伊人精品优势| 青青草97国产精品免费观看无弹窗版| 美女看a上一区| 国产精品18久久久久久久久| av毛片久久久久**hd| 91福利区一区二区三区| 在线综合视频播放| 久久婷婷国产综合精品青草 | 久久先锋资源网| 中文字幕一区日韩精品欧美| 亚洲综合成人网| 蜜桃传媒麻豆第一区在线观看| 国产一区二区日韩精品| 99久久婷婷国产综合精品 | 色狠狠一区二区三区香蕉| 欧美日韩亚洲综合一区| 欧美tk丨vk视频| 亚洲欧洲性图库| 日韩精品色哟哟| 高潮精品一区videoshd| 91久久精品一区二区三| 日韩一区二区三区四区| 国产欧美日产一区| 亚洲va欧美va国产va天堂影院| 精品一区二区三区的国产在线播放| 国产成人免费在线视频| 欧美日韩一卡二卡三卡| www久久久久| 一区二区三区欧美日韩| 国产一区二区成人久久免费影院 | 国产69精品久久99不卡| 欧美午夜精品久久久久久超碰| 精品国产伦一区二区三区观看方式 | 久久精工是国产品牌吗| 99久久婷婷国产| 欧美一级一级性生活免费录像| 中文字幕乱码一区二区免费| 午夜电影久久久| 成人国产视频在线观看| 日韩一级黄色大片| 亚洲女女做受ⅹxx高潮| 韩国精品主播一区二区在线观看| 色综合久久综合网97色综合| 久久综合久久鬼色中文字| 亚洲一区二区三区四区在线免费观看 | 中文字幕免费观看一区| 视频一区二区三区中文字幕| www.在线成人| 久久久激情视频| 日本vs亚洲vs韩国一区三区 | 99久久精品免费看| 精品毛片乱码1区2区3区 | 美女脱光内衣内裤视频久久网站 | 欧美第一区第二区| 亚洲国产一二三| 91原创在线视频| 国产欧美日韩精品a在线观看| 美女视频黄 久久| 欧美日韩成人激情| 一二三区精品视频| 91麻豆国产香蕉久久精品| 欧美国产精品中文字幕| 韩国一区二区三区| 这里只有精品99re| 五月激情综合网| 欧美亚洲国产一区在线观看网站| 中文字幕一区二区日韩精品绯色| 国模一区二区三区白浆| 欧美大胆人体bbbb| 美国毛片一区二区三区| 在线综合视频播放| 午夜激情一区二区三区| 欧美怡红院视频| 亚洲韩国一区二区三区| 色婷婷综合激情| 一区二区三区在线影院| 99久久777色| 亚洲黄色片在线观看| 91久久免费观看| 亚洲福利视频一区| 欧美日韩一区二区欧美激情| 亚洲成人综合网站| 欧美精品在线观看播放| 亚洲成人av一区二区三区| 欧美日韩精品综合在线| 婷婷六月综合网| 日韩一级成人av| 国产一区二区福利视频| 中文字幕免费观看一区| 91麻豆精品一区二区三区| 亚洲黄一区二区三区| 欧美美女喷水视频| 免费精品视频最新在线| 久久婷婷综合激情| 成人av资源下载| 一区二区三区色| 777午夜精品视频在线播放| 捆绑调教一区二区三区| 久久久久国色av免费看影院| 国产成人av电影在线观看| 自拍偷拍欧美精品| 欧美日韩亚洲丝袜制服| 久久国产视频网| 欧美激情一区二区三区四区| 91免费精品国自产拍在线不卡| 亚洲精品国产高清久久伦理二区| 欧美日韩日日夜夜| 激情久久五月天| 国产精品久久久久久久久快鸭| 色欧美片视频在线观看| 日韩影院精彩在线| 国产欧美日韩视频在线观看| 91行情网站电视在线观看高清版| 日韩精品电影在线观看| 国产午夜精品在线观看| 91黄色在线观看| 国产自产v一区二区三区c| 亚洲欧美一区二区久久| 日韩精品一区在线| 91理论电影在线观看| 日本系列欧美系列| 国产精品久久久久久久久免费桃花 | 日本道色综合久久| 久久99蜜桃精品| 亚洲欧美一区二区三区国产精品 | 中文字幕av资源一区| 欧美丝袜自拍制服另类| 国产专区欧美精品| 悠悠色在线精品| 久久蜜桃av一区二区天堂| 在线精品视频一区二区三四| 韩国毛片一区二区三区| 亚洲国产成人av| 国产精品午夜在线观看| 日韩一级黄色大片| 在线观看一区二区视频| 高清不卡在线观看av| 免费在线看成人av| 亚洲精品视频在线| 国产偷国产偷精品高清尤物 |