📄 ex5_eeprom.lst
字号:
236: else
237: {
238: printf0("\nOut of range!\r");
002a cc0000 LDD #"\012Out of range!\015"
002d 160000 JSR printf0
239: status=DISABLE;
240: }
241: }
242: else
243: status=DISABLE;
0030 6980 CLR 0,SP
244: printf0("\n\r");
0032 cc0000 LDD #"\012\015"
0035 160000 JSR printf0
245:
246: if (status==ENABLE)
0038 e680 LDAB 0,SP
003a 04212e DBNE B,*+49 ;abs = 006b
247: {
248: printf0("EEPROM start address to be programmed ($400 default)= \r");
003d cc0000 LDD #"EEPROM start address to be programmed ($400 default)= \015"
0040 160000 JSR printf0
249: if(input_word(eeprom_addi)==OK)
0043 ec83 LDD 3,SP
0045 160000 JSR input_word
0048 042118 DBNE B,*+27 ;abs = 0063
250: {
251: if((*eeprom_addi>=0x400)&&(*eeprom_addi<0x1000))
004b ee83 LDX 3,SP
004d ec00 LDD 0,X
004f 830400 SUBD #1024
0052 8c0bff CPD #3071
0055 2206 BHI *+8 ;abs = 005d
252: status=ENABLE;
0057 c601 LDAB #1
0059 6b80 STAB 0,SP
005b 2008 BRA *+10 ;abs = 0065
253: else
254: {
255: printf0("\nOut of range!\r");
005d cc0000 LDD #"\012Out of range!\015"
0060 160000 JSR printf0
256: status=DISABLE;
257: }
258: }
259: else
260: status=DISABLE;
0063 6980 CLR 0,SP
261: printf0("\n\r");
0065 cc0000 LDD #"\012\015"
0068 160000 JSR printf0
262: }
263: if (status==ENABLE)
006b e680 LDAB 0,SP
006d 042128 DBNE B,*+43 ;abs = 0098
264: {
265: printf0("No. of word to be programmed (Dec) = \r");
0070 cc0000 LDD #"No. of word to be programmed (Dec) = \015"
0073 160000 JSR printf0
266: if(input_dec(&ebyte)==OK)
0076 1a85 LEAX 5,SP
0078 b754 TFR X,D
007a 160000 JSR input_dec
007d 042118 DBNE B,*+27 ;abs = 0098
267: {
268: if (((ebyte)==DOT)||((ebyte)==ESC))
0080 e685 LDAB 5,SP
0082 c12e CMPB #46
0084 2704 BEQ *+6 ;abs = 008a
0086 c11b CMPB #27
0088 2604 BNE *+6 ;abs = 008e
269: status=DISABLE;
008a 6980 CLR 0,SP
008c 2004 BRA *+6 ;abs = 0092
270: else
271: status=ENABLE;
008e c601 LDAB #1
0090 6b80 STAB 0,SP
272: printf0("\n\r");
0092 cc0000 LDD #"\012\015"
0095 160000 JSR printf0
273: }
274: }
275: if (status==ENABLE)
0098 e680 LDAB 0,SP
009a 042112 DBNE B,*+21 ;abs = 00af
276: eeprom_program_cmd(*eram_addi, *eeprom_addi, (unsigned int) ebyte);
009d ee81 LDX 1,SP
009f ec00 LDD 0,X
00a1 3b PSHD
00a2 ee85 LDX 5,SP
00a4 ec00 LDD 0,X
00a6 3b PSHD
00a7 e689 LDAB 9,SP
00a9 87 CLRA
00aa 160000 JSR eeprom_program_cmd
00ad 1b84 LEAS 4,SP
277: }
00af 1b8a LEAS 10,SP
00b1 3d RTS
278:
279: /*******************************************************************
280: * EEPROM erase subroutine
281: * Description : Erase EEPROM long word (4 bytes)
282: * : User input EEPROM start address and no. of word to be
283: * : erased
284: * Example : Erase 4 long words from EEPROM (0x600)
285: * input : eeprom_addi=0x600, no_of word=0x4
286: * modify : eeprom content (0x600-0x610)=0xff
287: *********************************************************************/
288: void eeprom_erase()
289: {
Function: eeprom_erase
Source : D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\sources\ex5_eeprom.c
Options : -DNON_BANK -Env"GENPATH=D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31;D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\bin;D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\cmd;D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\prm;D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\sources;C:\Program Files\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\LIB;C:\Program Files\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\SRC;C:\Program Files\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\INCLUDE" -Env"LIBPATH=C:\Program Files\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\INCLUDE" -Env"OBJPATH=D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\bin" -Env"TEXTPATH=D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\bin" -Lasm=%n.lst -ObjN="D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\S12_Ex5_EEPROM_ICD_CW31_Data\FCS\ObjectCode\ex5_eeprom.c.o" -Ol0
0000 1b9a LEAS -6,SP
290: unsigned int *address,add;
291: byte status=DISABLE,ebyte;
292:
293: address=&add;
0002 1a84 LEAX 4,SP
0004 6e81 STX 1,SP
294:
295: printf0("EEPROM start address to be Erase (hex) (0x400-0xfff) = \r");
0006 cc0000 LDD #"EEPROM start address to be Erase (hex) (0x400-0xfff) = \015"
0009 160000 JSR printf0
296: if(input_word(address)==OK)
000c ec81 LDD 1,SP
000e 160000 JSR input_word
0011 042118 DBNE B,*+27 ;abs = 002c
297: {
298: if((*address>=0x400)&&(*address<0x1000))
0014 ee81 LDX 1,SP
0016 ec00 LDD 0,X
0018 830400 SUBD #1024
001b 8c0bff CPD #3071
001e 2206 BHI *+8 ;abs = 0026
299: status=ENABLE;
0020 c601 LDAB #1
0022 6b80 STAB 0,SP
0024 2008 BRA *+10 ;abs = 002e
300: else
301: {
302: printf0("\nOut of range!\r");
0026 cc0000 LDD #"\012Out of range!\015"
0029 160000 JSR printf0
303: status=DISABLE;
304: }
305: }
306: else
307: status=DISABLE;
002c 6980 CLR 0,SP
308: printf0("\n\r");
002e cc0000 LDD #"\012\015"
0031 160000 JSR printf0
309:
310: if (status==ENABLE)
0034 e680 LDAB 0,SP
0036 042128 DBNE B,*+43 ;abs = 0061
311: {
312: printf0("No. of long word (4 bytes) to be erased (Dec) = \r");
0039 cc0000 LDD #"No. of long word (4 bytes) to be erased (Dec) = \015"
003c 160000 JSR printf0
313: if(input_dec(&ebyte)==OK)
003f 1a83 LEAX 3,SP
0041 b754 TFR X,D
0043 160000 JSR input_dec
0046 042118 DBNE B,*+27 ;abs = 0061
314: {
315: if (((ebyte)==DOT)||((ebyte)==ESC))
0049 e683 LDAB 3,SP
004b c12e CMPB #46
004d 2704 BEQ *+6 ;abs = 0053
004f c11b CMPB #27
0051 2604 BNE *+6 ;abs = 0057
316: status=DISABLE;
0053 6980 CLR 0,SP
0055 2004 BRA *+6 ;abs = 005b
317: else
318: status=ENABLE;
0057 c601 LDAB #1
0059 6b80 STAB 0,SP
319: printf0("\n\r");
005b cc0000 LDD #"\012\015"
005e 160000 JSR printf0
320: }
321: }
322: if (status==ENABLE)
0061 e680 LDAB 0,SP
0063 04210d DBNE B,*+16 ;abs = 0073
323: eeprom_erase_cmd(*address, (unsigned int) ebyte);
0066 ee81 LDX 1,SP
0068 ec00 LDD 0,X
006a 3b PSHD
006b e685 LDAB 5,SP
006d 87 CLRA
006e 160000 JSR eeprom_erase_cmd
0071 1b82 LEAS 2,SP
324: }
0073 1b86 LEAS 6,SP
0075 3d RTS
325:
326:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -