⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex3_utility.lst

📁 基于摩托罗拉S12标准源程序 包括:SCIO,Timer
💻 LST
📖 第 1 页 / 共 5 页
字号:
  175:  *			  :
  176:  * Example     : 0x32 <=> 50 
  177:  * Input 	  : 0x32 (cdata)
  178:  * Output	  : 5 0 (ascii)
  179:  * Modify      : N/A
  180:  * Return      : void
  181:  ********************************************************************/ 
  182:  void hex_clk_dec(unsigned char data)
  183:  {

Function: hex_clk_dec
Source  : D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\sources\ex3_utility.c
Options : -DNON_BANK -Env"GENPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\cmd;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\prm;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb 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\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Env"TEXTPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Lasm=%n.lst -ObjN="D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\S12_Ex4_Portb_ICD_CW31_Data\Flash_Application\ObjectCode\ex3_utility.c.o" -Ol0

  0000 37           PSHB  
  184:  	div_t static digit;
  185:  
  186:  	digit=int_div((int)data,10);
  0001 cc0000       LDD   #digit
  0004 3b           PSHD  
  0005 e682         LDAB  2,SP
  0007 87           CLRA  
  0008 3b           PSHD  
  0009 c60a         LDAB  #10
  000b 0700         BSR   int_div
  000d 1b84         LEAS  4,SP
  187:  	tx_char0(digit.quot+'0'); 
  000f f60000       LDAB  digit:1
  0012 cb30         ADDB  #48
  0014 0700         BSR   tx_char0
  188:  	tx_char0(digit.rem+'0'); 	
  0016 f60000       LDAB  digit:3
  0019 cb30         ADDB  #48
  001b 0700         BSR   tx_char0
  189:  }
  001d 32           PULA  
  001e 3d           RTS   
  190:  
  191:  
  192:  /*******************************************************************
  193:  * Wait for receiving char subroutine
  194:  * Description : Waiting for rx char
  195:  *			  :
  196:  * Example     : N/A  
  197:  * Input 	  : N/A
  198:  * Output	  : N/A
  199:  * Modify      : N/A
  200:  * Return      : char
  201:  ********************************************************************/ 
  202:  byte rx_char0()
  203:  {

Function: rx_char0
Source  : D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\sources\ex3_utility.c
Options : -DNON_BANK -Env"GENPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\cmd;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\prm;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb 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\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Env"TEXTPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Lasm=%n.lst -ObjN="D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\S12_Ex4_Portb_ICD_CW31_Data\Flash_Application\ObjectCode\ex3_utility.c.o" -Ol0

  204:  	char data;
  205:  	
  206:  	while( (SC0SR1 & 0x20)==0);
  0000 4fcc20fc     BRCLR 204,#32,*+0 ;abs = 0000
  207:      data = SC0SR1;
  0004 d6cc         LDAB  204
  208:  	return(SC0DRL);
  0006 d6cf         LDAB  207
  209:  }
  0008 3d           RTS   
  210:  
  211:  /*******************************************************************
  212:  * Wait for receiving char subroutine
  213:  * Description : Waiting for rx char and display page information
  214:  *			  :
  215:  * Example     : N/A  
  216:  * Input 	  : menu_page
  217:  * Output	  : N/A
  218:  * Modify      : N/A
  219:  * Return      : char
  220:  ********************************************************************/ 
  221:  byte menurx_char0(char menu_page)
  222:  { 

Function: menurx_char0
Source  : D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\sources\ex3_utility.c
Options : -DNON_BANK -Env"GENPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\cmd;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\prm;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb 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\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Env"TEXTPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Lasm=%n.lst -ObjN="D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\S12_Ex4_Portb_ICD_CW31_Data\Flash_Application\ObjectCode\ex3_utility.c.o" -Ol0

  0000 37           PSHB  
  223:  	char data;
  224:  	
  225:  	while( (SC0SR1 & 0x20)==0)
  0001 2007         BRA   *+9 ;abs = 000a
  226:  	{
  227:  	  delay1();
  0003 0700         BSR   delay1
  228:  	  disp_info(menu_page);		//display corresponding menu info 
  0005 e680         LDAB  0,SP
  0007 160000       JSR   disp_info
  000a 4fcc20f5     BRCLR 204,#32,*-7 ;abs = 0003
  229:  	} 
  230:  	data = SC0SR1;
  000e d6cc         LDAB  204
  231:  	return(SC0DRL);
  0010 d6cf         LDAB  207
  232:  }
  0012 32           PULA  
  0013 3d           RTS   
  233:  
  234:  /*******************************************************************
  235:  * Check user abort data display subroutine
  236:  * Description : Checking whether user abort or not
  237:  *			  :
  238:  * Example     : N/A  
  239:  * Input 	  : SC0SR1 empty?
  240:  * Output	  : 3 2 (ascii)
  241:  * Modify      : N/A
  242:  * Return      : status [OK for (DOT or ESC) or NOTOK for others chars]
  243:  ********************************************************************/ 
  244:  byte check_user_abort()
  245:  {

Function: check_user_abort
Source  : D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\sources\ex3_utility.c
Options : -DNON_BANK -Env"GENPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\cmd;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\prm;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb 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\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Env"TEXTPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Lasm=%n.lst -ObjN="D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\S12_Ex4_Portb_ICD_CW31_Data\Flash_Application\ObjectCode\ex3_utility.c.o" -Ol0

  246:  	char data;
  247:  	
  248:  	if((SC0SR1 & 0x20)!=0)
  0000 4fcc200d     BRCLR 204,#32,*+17 ;abs = 0011
  249:      {
  250:         data=SC0DRL;
  0004 d6cf         LDAB  207
  251:         if(data==DOT||data==ESC)
  0006 c12e         CMPB  #46
  0008 2704         BEQ   *+6 ;abs = 000e
  000a c11b         CMPB  #27
  000c 2603         BNE   *+5 ;abs = 0011
  252:           return(OK);
  000e c601         LDAB  #1
  0010 3d           RTS   
  253:         else 
  254:           return(NOTOK);  
  255:      }
  256:      else
  257:        return(NOTOK);
  0011 c7           CLRB  
  258:  }
  0012 3d           RTS   
  259:  
  260:  /*******************************************************************
  261:  * Transmit out 1 char (ASCII) subroutine
  262:  * Description : Transmit out upper and lower 4 bit of char as ascii
  263:  *             : via RS232
  264:  *			  :
  265:  * Example     : 0x32  
  266:  * Input 	  : 0x32 (cdata)
  267:  * Output	  : 3 2 (ascii)
  268:  * Modify      : N/A
  269:  * Return      : void
  270:  ********************************************************************/ 
  271:  void send_asc(byte cdata)
  272:  {

Function: send_asc
Source  : D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\sources\ex3_utility.c
Options : -DNON_BANK -Env"GENPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\cmd;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\prm;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb 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\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Env"TEXTPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Lasm=%n.lst -ObjN="D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\S12_Ex4_Portb_ICD_CW31_Data\Flash_Application\ObjectCode\ex3_utility.c.o" -Ol0

  273:  	if(cdata>9)
  0000 c109         CMPB  #9
  0002 2303         BLS   *+5 ;abs = 0007
  274:  	  tx_char0(cdata+'0'+7);
  0004 cb37         ADDB  #55
  0006 8f           SKIP2 
  275:  	else
  276:  	  tx_char0(cdata+'0');	  	
  0007 cb30         ADDB  #48
  0009 060000       JMP   tx_char0
  277:  }
  278:  
  279:  /*******************************************************************
  280:  * Convert HEX to ASCII subroutine
  281:  * Description : Convert hex to ascii and send out via RS232
  282:  *			  :
  283:  * Example     : 0x32  
  284:  * Input 	  : 0x32 (cdata)
  285:  * Output	  : 3 2 (ascii)
  286:  * Modify      : N/A
  287:  * Return      : void
  288:  ********************************************************************/ 
  289:  void hex_asc(byte cdata)
  290:  {

Function: hex_asc
Source  : D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\sources\ex3_utility.c
Options : -DNON_BANK -Env"GENPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\cmd;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\prm;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb 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\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Env"TEXTPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Lasm=%n.lst -ObjN="D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\S12_Ex4_Portb_ICD_CW31_Data\Flash_Application\ObjectCode\ex3_utility.c.o" -Ol0

  0000 37           PSHB  
  291:  	send_asc((cdata>>4)&0x0f);
  0001 54           LSRB  
  0002 54           LSRB  
  0003 54           LSRB  
  0004 54           LSRB  
  0005 0700         BSR   send_asc
  292:  	send_asc((cdata)&0x0f);	
  0007 e680         LDAB  0,SP
  0009 c40f         ANDB  #15
  000b 0700         BSR   send_asc
  293:  }
  000d 32           PULA  
  000e 3d           RTS   
  294:  
  295:  /*******************************************************************
  296:  * Convert HEX to ASCII with additional spaces subroutine
  297:  * Description : Convert hex to ascii and send out spaces followed
  298:  *             : via RS232
  299:  *			  :
  300:  * Example     : 0x32  
  301:  * Input 	  : 0x32 (cdata), 3(space)
  302:  * Output	  : 3 2 _ _ _ (ascii)
  303:  * Modify      : N/A
  304:  * Return      : void
  305:  ********************************************************************/ 
  306:  void hex_asc_sp(byte cdata, byte space)
  307:  {

Function: hex_asc_sp
Source  : D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\sources\ex3_utility.c
Options : -DNON_BANK -Env"GENPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\cmd;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\prm;D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb 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\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Env"TEXTPATH=D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\bin" -Lasm=%n.lst -ObjN="D:\Profiles\r63492.FSL\My Documents\技术资料\培训教材\HCS12\S12 Ex4 Portb ICD CW31\S12_Ex4_Portb_ICD_CW31_Data\Flash_Application\ObjectCode\ex3_utility.c.o" -Ol0

  0000 6bad         STAB  3,-SP
  308:  	int	i;
  309:  	
  310:  	hex_asc(cdata);
  0002 e685         LDAB  5,SP
  0004 0700         BSR   hex_asc
  311:  	for (i=0;i<space;i++)
  0006 c7           CLRB  
  0007 87           CLRA  
  0008 6c81         STD   1,SP
  000a 200a         BRA   *+12 ;abs = 0016
  312:  		tx_char0(' ');
  000c c620         LDAB  #32
  000e 160000       JSR   tx_char0
  0011 ee81         LDX   1,SP
  0013 08           INX   
  0014 6e81         STX   1,SP
  0016 e680         LDAB  0,SP
  0018 87           CLRA  
  0019 ac81         CPD   1,SP
  001b 2eef         BGT   *-15 ;abs = 000c
  313:  }
  001d 1b83         LEAS  3,SP
  001f 3d           RTS   
  314:  
  315:  /*******************************************************************
  316:  * Input int (dec) subroutine
  317:  * Description : Get the data(word) from user   
  318:  *             :   
  319:  *			  :
  320:  * Example     : N/A 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -