📄 flash_example.lst
字号:
*** ERROR C141 IN LINE 165 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
166 1 *Temp = 0xAA; /* write data 0xAA to the address */
167 1 Temp = (BYTE far *)0xA0002AAA; /* set up address to be A000:2AAAh */
*** ERROR C141 IN LINE 167 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
168 1 *Temp = 0x55; /* write data 0x55 to the address */
169 1 Temp = (BYTE far *)0xA0005555; /* set up address to be A000:5555h */
*** ERROR C141 IN LINE 169 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
170 1 *Temp = 0x80; /* write data 0x80 to the address */
171 1 Temp = (BYTE far *)0xA0005555; /* set up address to be A000:5555h */
*** ERROR C141 IN LINE 171 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
172 1 *Temp = 0xAA; /* write data 0xAA to the address */
173 1 Temp = (BYTE far *)0xA0002AAA; /* set up address to be A000:2AAAh */
*** ERROR C141 IN LINE 173 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
174 1 *Temp = 0x55; /* write data 0x55 to the address */
175 1 Temp = Dst /* set up starting address to be erased */
176 1 *Temp = 0x30; /* write data 0x30 to the address */
*** ERROR C202 IN LINE 176 OF ..\SRC\FLASH_EXAMPLE.C: 'Dst': undefined identifier
*** ERROR C141 IN LINE 176 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near '='
177 1
178 1 Delay_25_Milli_Seconds(); /* check DATABOOK for the most */
179 1 /* accurate value -- Tse */
180 1 }
181
182
183 /************************************************************************/
184 /* PROCEDURE: Program_One_Byte */
185 /* */
186 /* This procedure can be used to program ONE byte of date to the */
187 /* 39SF040. */
188 /* */
189 /* NOTE: It is mandatory that the sector containing the byte to be */
190 /* programmed was ERASED first. */
191 /* */
192 /* Input: */
193 /* SrcByte The BYTE which will be written to the 39SF040. */
194 /* Dst DESTINATION address which will be written with the */
195 /* data passed in from SrcByte */
196 /* */
197 /* Output: */
198 /* None */
199 /************************************************************************/
200
201 void Program_One_Byte (BYTE SrcByte, BYTE far *Dst)
*** ERROR C141 IN LINE 201 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near '*', expected ')'
202 {
203 1 BYTE far *SourceBuf;
*** ERROR C231 IN LINE 203 OF ..\SRC\FLASH_EXAMPLE.C: 'far': redefinition
*** ERROR C141 IN LINE 203 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near '*'
204 1 BYTE far *DestBuf;
*** ERROR C231 IN LINE 204 OF ..\SRC\FLASH_EXAMPLE.C: 'far': redefinition
*** ERROR C141 IN LINE 204 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near '*'
205 1 int Index;
206 1
207 1 DestBuf = Dst;
C51 COMPILER V7.20 FLASH_EXAMPLE 02/01/2007 15:50:57 PAGE 5
*** ERROR C202 IN LINE 207 OF ..\SRC\FLASH_EXAMPLE.C: 'Dst': undefined identifier
208 1
209 1 Temp = (BYTE far *)0xA0005555; /* set up address to be A000:555h */
*** ERROR C202 IN LINE 209 OF ..\SRC\FLASH_EXAMPLE.C: 'Temp': undefined identifier
*** ERROR C141 IN LINE 209 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
210 1 *Temp = 0xAA; /* write data 0xAA to the address */
*** ERROR C202 IN LINE 210 OF ..\SRC\FLASH_EXAMPLE.C: 'Temp': undefined identifier
211 1 Temp = (BYTE far *)0xA0002AAA; /* set up address to be A000:2AAAh */
*** ERROR C202 IN LINE 211 OF ..\SRC\FLASH_EXAMPLE.C: 'Temp': undefined identifier
*** ERROR C141 IN LINE 211 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
212 1 *Temp = 0x55; /* write data 0x55 to the address */
*** ERROR C202 IN LINE 212 OF ..\SRC\FLASH_EXAMPLE.C: 'Temp': undefined identifier
213 1 Temp = (BYTE far *)0xA0005555; /* set up address to be A000:5555h */
*** ERROR C202 IN LINE 213 OF ..\SRC\FLASH_EXAMPLE.C: 'Temp': undefined identifier
*** ERROR C141 IN LINE 213 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
214 1 *Temp = 0xA0; /* write data 0xA0 to the address */
*** ERROR C202 IN LINE 214 OF ..\SRC\FLASH_EXAMPLE.C: 'Temp': undefined identifier
215 1 *DestBuf = SrcByte; /* transfer the byte to destination */
216 1 Check_Toggle_Ready(DestBuf); /* wait for TOGGLE bit to get ready */
217 1 }
218
219
220 /************************************************************************/
221 /* PROCEDURE: Program_One_Sector */
222 /* */
223 /* This procedure can be used to program a total of 4096 bytes of data */
224 /* to the SST's 39SF040. */
225 /* */
226 /* Input: */
227 /* Src SOURCE address containing the data which will be */
228 /* written to the 39SF040. */
229 /* Dst DESTINATION address which will be written with the */
230 /* data passed in from Src */
231 /* */
232 /* Output: */
233 /* None */
234 /************************************************************************/
235
236 void Program_One_Sector (BYTE far *Src, BYTE far *Dst)
237 {
238 1 BYTE far *Temp;
239 1 BYTE far *SourceBuf;
240 1 BYTE far *DestBuf;
241 1 int Index;
242 1
243 1 SourceBuf = Src;
244 1 DestBuf = Dst;
245 1
246 1 Erase_One_Sector(Src); /* erase the sector first */
247 1
248 1 for (Index = 0; Index < SECTOR_SIZE; Index++)
249 1 {
250 2 Temp = (BYTE far *)0xA0005555; /* set up address to be A000:555h */
251 2 *Temp = 0xAA; /* write data 0xAA to the address */
252 2 Temp = (BYTE far *)0xA0002AAA; /* set up address to be A000:2AAAh*/
253 2 *Temp = 0x55; /* write data 0x55 to the address */
254 2 Temp = (BYTE far *)0xA0005555; /* set up address to be A000:5555h*/
255 2 *Temp = 0xA0; /* write data 0xA0 to the address */
256 2 Temp = DestBuf;
257 2 /* save the original Destination address */
258 2 *DestBuf++ = *SourceBuf++;
259 2 /* transfer data from source to destination */
C51 COMPILER V7.20 FLASH_EXAMPLE 02/01/2007 15:50:57 PAGE 6
260 2 Check_Toggle_Ready(Temp);
261 2 /* wait for TOGGLE bit to get ready */
262 2 }
263 1 }
264
265
266 /************************************************************************/
267 /* PROCEDURE: Check_Toggle_Ready */
268 /* */
269 /* During the internal program cycle, any consecutive read operation */
270 /* on DQ6 will produce alternating 0's and 1's i.e. toggling between */
271 /* 0 and 1. When the program cycle is completed, DQ6 of the data will */
272 /* stop toggling. After the DQ6 data bit stops toggling, the device is */
273 /* ready for next operation. */
274 /* */
275 /* Input: */
276 /* Dst must already set-up by the caller */
277 /* */
278 /* Output: */
279 /* None */
280 /************************************************************************/
281
282 void Check_Toggle_Ready (BYTE far *Dst)
283 {
284 1 BYTE Loop = TRUE;
285 1 BYTE PreData;
286 1 BYTE CurrData;
287 1 unsigned long TimeOut = 0;
288 1
289 1 PreData = *Dst;
290 1 PreData = PreData & 0x40;
291 1 while ((TimeOut< 0x07FFFFFF) && (Loop))
292 1 {
293 2 CurrData = *Dst;
294 2 CurrData = CurrData & 0x40;
295 2 if (PreData == CurrData)
296 2 Loop = FALSE; /* ready to exit the while loop */
297 2 PreData = CurrData;
298 2 TimeOut++;
299 2 }
300 1 }
301
302
303 /************************************************************************/
304 /* PROCEDURE: Check_Data_Polling */
305 /* */
306 /* During the internal program cycle, any attempt to read DQ7 of the */
307 /* last byte loaded during the page/byte-load cycle will receive the */
308 /* complement of the true data. Once the program cycle is completed, */
309 /* DQ7 will show true data. */
310 /* */
311 /* Input: */
312 /* Dst must already be set-up by the caller */
313 /* TrueData this is the original (true) data */
314 /* */
315 /* Output: */
316 /* None */
317 /************************************************************************/
318
319 void Check_Data_Polling (BYTE far *Dst, BYTE TrueData)
320 {
321 1 BYTE Loop = TRUE;
C51 COMPILER V7.20 FLASH_EXAMPLE 02/01/2007 15:50:57 PAGE 7
322 1 BYTE CurrData;
323 1 unsigned long TimeOut = 0;
324 1
325 1 TrueData = TrueData & 0x80;
326 1 while ((TimeOut< 0x07FFFFFF) && (Loop))
327 1 {
328 2 CurrData = *Dst;
329 2 CurrData = CurrData & 0x80;
330 2 if (TrueData == CurrData)
331 2 Loop = FALSE; /* ready to exit the while loop */
332 2 TimeOut++;
333 2 }
334 1 }
335
C51 COMPILATION COMPLETE. 0 WARNING(S), 43 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -