📄 ex5_eeprom.lst
字号:
0004 6c86 STD 6,SP
145:
146: ram_add=(int*)eram_addi;
0006 ee8c LDX 12,SP
0008 6e84 STX 4,SP
147: eeprom_add=(int*)eeprom_addi;
000a ee8a LDX 10,SP
000c 6e82 STX 2,SP
148: eclkdiv = 0x49;
000e c649 LDAB #73
0010 7b0110 STAB 272
149:
150: DisableInterrupts;
0013 1410 SEI
151:
152: estat=pviol+accerr; //movb #$30,$115 ; clear previous command error
0015 c630 LDAB #48
0017 7b0115 STAB 277
153: while(count!=no_of_word)
001a 203a BRA *+60 ;abs = 0056
154: {
155: *eeprom_add=*ram_add; //; get data and put it to EEPROM
001c ee84 LDX 4,SP
001e ec00 LDD 0,X
0020 ee82 LDX 2,SP
0022 6c00 STD 0,X
156: ecmd=prog; //; initiate PROGRAM COMMAND
0024 c620 LDAB #32
0026 7b0116 STAB 278
157: estat=cbeif; //; begin command
0029 8680 LDAA #128
002b 7a0115 STAA 277
158: if(((estat&pviol)==pviol)||((estat&accerr)==accerr))
002e 1e01152005 BRSET 277,#32,*+10 ;abs = 0038
0033 1f01151008 BRCLR 277,#16,*+13 ;abs = 0040
159: printf0("EEprom programming error\n\r"); //display eree_program_error
0038 cc0000 LDD #"EEprom programming error\012\015"
003b 160000 JSR printf0
003e 2005 BRA *+7 ;abs = 0045
160: else
161: while((estat&ccif)==0x00); // wait for command to complete
0040 1f011540fb BRCLR 277,#64,*+0 ;abs = 0040
162:
163: count++;
0045 ee86 LDX 6,SP
0047 08 INX
0048 6e86 STX 6,SP
164: eeprom_add++;
004a ee82 LDX 2,SP
004c 1a02 LEAX 2,X
004e 6e82 STX 2,SP
165: ram_add++;
0050 ee84 LDX 4,SP
0052 1a02 LEAX 2,X
0054 6e84 STX 4,SP
0056 ec86 LDD 6,SP
0058 ac80 CPD 0,SP
005a 26c0 BNE *-62 ;abs = 001c
166: }
167: EnableInterrupts;
005c 10ef CLI
168: }
005e 1b88 LEAS 8,SP
0060 3d RTS
169:
170:
171: /*******************************************************************
172: * EEPROM erase command subroutine
173: * Description : Erase EEPROM long word (4 bytes)
174: * : Input EEPROM start address and no. of word to be
175: * : erased
176: * Example : Erase 4 long words from EEPROM (0x600)
177: * input : eeprom_addi=0x600, no_of word=0x4
178: * modify : eeprom content (0x600-0x610)=0xff
179: *********************************************************************/
180: void eeprom_erase_cmd(int eeprom_addi, int no_of_long_word)
181: {
Function: eeprom_erase_cmd
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 6caa STD 6,-SP
182: int *eeprom_add,count=0;
0002 c7 CLRB
0003 87 CLRA
0004 6c84 STD 4,SP
183:
184: eeprom_add=(int*)eeprom_addi;
0006 ee88 LDX 8,SP
0008 6e82 STX 2,SP
185: eclkdiv = 0x49;
000a c649 LDAB #73
000c 7b0110 STAB 272
186:
187: DisableInterrupts;
000f 1410 SEI
188:
189: estat=pviol+accerr; //movb #$30,$115 ; clear previous command error
0011 c630 LDAB #48
0013 7b0115 STAB 277
190: while(count!= no_of_long_word)
0016 204c BRA *+78 ;abs = 0064
191: {
192: *eeprom_add=0; // to erase the data at EEPROM
0018 ee82 LDX 2,SP
001a c7 CLRB
001b 87 CLRA
001c 6c00 STD 0,X
193: ecmd=erase; //; initiate ERASE COMMAND
001e c640 LDAB #64
0020 7b0116 STAB 278
194: estat=cbeif; //; begin command
0023 58 ASLB
0024 7b0115 STAB 277
195: if(((estat&pviol)==pviol)||((estat&accerr)==accerr))
0027 1e01152005 BRSET 277,#32,*+10 ;abs = 0031
002c 1f01151018 BRCLR 277,#16,*+29 ;abs = 0049
196: {
197: printf0("EEprom programming error in \n\r"); //display eree_program_error
0031 cc0000 LDD #"EEprom programming error in \012\015"
0034 160000 JSR printf0
198: hex_asc((byte)(eeprom_addi>>8));
0037 e688 LDAB 8,SP
0039 160000 JSR hex_asc
199: hex_asc((byte)(eeprom_addi));
003c e689 LDAB 9,SP
003e 160000 JSR hex_asc
200: printf0("\n\r"); //display lf
0041 cc0000 LDD #"\012\015"
0044 160000 JSR printf0
201: }
0047 2005 BRA *+7 ;abs = 004e
202: else
203: while((estat&ccif)==0x00); // wait for command to complete
0049 1f011540fb BRCLR 277,#64,*+0 ;abs = 0049
204:
205: count++;
004e ee84 LDX 4,SP
0050 08 INX
0051 6e84 STX 4,SP
206: eeprom_add+=2; //int pointer increment
0053 ee82 LDX 2,SP
0055 1a04 LEAX 4,X
0057 6e82 STX 2,SP
207: eeprom_addi+=4; //eeprom_addi increment by 4 (long)
0059 ee88 LDX 8,SP
005b 1a04 LEAX 4,X
005d 6e88 STX 8,SP
208: tx_char0('.');
005f c62e LDAB #46
0061 160000 JSR tx_char0
0064 ec84 LDD 4,SP
0066 ac80 CPD 0,SP
0068 26ae BNE *-80 ;abs = 0018
209: }
210: EnableInterrupts;
006a 10ef CLI
211: }
006c 1b86 LEAS 6,SP
006e 3d RTS
212:
213:
214: /*******************************************************************
215: * EEPROM program subroutine
216: * Description : User input RAM area and EEPROM area to be copied
217: * : Input RAM,EEPROM start address and no. of word to be
218: * : programmed
219: * Example : Copy 4 words from RAM(0x1000) to EEPROM (0x600)
220: * input : eram_addi=0x1000, eeprom_addi=0x600, no_of word=0x4
221: * modify : eeprom content
222: *********************************************************************/
223: void eeprom_program()
224: {
Function: eeprom_program
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 1b96 LEAS -10,SP
225: unsigned int *eeprom_addi,add0,*eram_addi,add1;
226: byte status=DISABLE,ebyte;
227:
228: eeprom_addi=&add0;
0002 1a88 LEAX 8,SP
0004 6e83 STX 3,SP
229: eram_addi=&add1;
0006 1a86 LEAX 6,SP
0008 6e81 STX 1,SP
230:
231: printf0("RAM start address (0x1000-0x12ff)= \r");
000a cc0000 LDD #"RAM start address (0x1000-0x12ff)= \015"
000d 160000 JSR printf0
232: if(input_word(eram_addi)==OK)
0010 ec81 LDD 1,SP
0012 160000 JSR input_word
0015 042118 DBNE B,*+27 ;abs = 0030
233: {
234: if((*eram_addi>=0x1000)&&(*eram_addi<0x1300))
0018 ee81 LDX 1,SP
001a ec00 LDD 0,X
001c 831000 SUBD #4096
001f 8c02ff CPD #767
0022 2206 BHI *+8 ;abs = 002a
235: status=ENABLE;
0024 c601 LDAB #1
0026 6b80 STAB 0,SP
0028 2008 BRA *+10 ;abs = 0032
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -