?? w29c040drv.lst
字號:
C51 COMPILER V7.10 W29C040DRV 03/30/2007 10:59:28 PAGE 1
C51 COMPILER V7.10, COMPILATION OF MODULE W29C040DRV
OBJECT MODULE PLACED IN w29c040drv.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE w29c040drv.c LARGE BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <stdio.h>
2 #include <reg52.h>
3 #include "ext_var.h"
4 #include "comm.h"
5 #include "SerialPort.h"
6 #include "w29c040drv.h"
7
8
9 // FLASH W29C020 Tester
10 // Wei Cheng Hung
11 // 2007-2
12 //#include <REGX51.H>
13
14
15 /*
16 W29C040 共 512K,分8段,每段64K,每段又有256頁,每頁256字節(jié).
17 */
18
19
20
21 #define Sector_Addr_Port P3 //ADDR17_Port=P3_5,ADDR16_Port=P3_4
22 #define Page_Addr_Port P2
23 #define InPage_Addr_Port P0
24 #define Data_Port P1
25 //#define Flash_CE P3_3
26 //#define Flash_WE P3_6
27 //#define Flash_OE P3_7
28 //#define IO6 P1_6
29
30 sbit Flash_CE = P3^3;
31 sbit Flash_WE = P3^6;
32 sbit Flash_OE = P3^7;
33 sbit IO6 = P1^6;
34 sbit P3_0=P3^0;
35 sbit P3_1=P3^1;
36
37
38 /**********************************************************************
39 * 函 數 名: WriteState
40 * 功能描述: 寫狀態(tài)
41 * 函數說明:
42 * 調用函數:
43 * 全局變量:
44 * 輸 入: 無
45 * 返 回: 無
46 * 設 計 者: wangyong 日期:2007-03-29
47 * 修 改 者: wangyong 日期:2007-03-29
48 * 版 本:
49 **********************************************************************/
50 void WriteState(void)
51 {
52 1 bit new_bit,old_bit;
53 1
54 1 IO6=1; // Set IO6 for Input
55 1 Flash_CE=0;
C51 COMPILER V7.10 W29C040DRV 03/30/2007 10:59:28 PAGE 2
56 1 Flash_OE=0;
57 1 new_bit=IO6;
58 1 Flash_OE=1;
59 1 Flash_CE=1;
60 1 do
61 1 {
62 2 old_bit=new_bit;
63 2 Flash_CE=0;
64 2 Flash_OE=0;
65 2 new_bit=IO6;
66 2 Flash_OE=1;
67 2 Flash_CE=1;
68 2 }
69 1 while(new_bit!=old_bit);
70 1 }
71
72
73 /**********************************************************************
74 * 函 數 名: WriteByte
75 * 功能描述: 寫一個字節(jié)
76 * 函數說明:
77 * 調用函數:
78 * 全局變量:
79 * 輸 入: SectorAddr--段地址
80 PageAddr--頁地址
81 InPageAddr--頁內地址
82 * 返 回: 無
83 * 設 計 者: wangyong 日期:2007-03-29
84 * 修 改 者: wangyong 日期:2007-03-29
85 * 版 本:
86 **********************************************************************/
87 void WriteByte(uchar SectorAddr,uchar PageAddr,uchar InPageAddr,uchar WriteData)
88 {
89 1 uchar ADDR;
90 1
91 1 ADDR=SectorAddr<<4;//盢ADDR17,ADDR16
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -