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

📄 sci.lst

📁 该程序是ST7MC驱动三洋压缩机(交流)
💻 LST
📖 第 1 页 / 共 3 页
字号:
ANSI-C/cC++ Compiler for ST7 V-5.0.7, Aug 21 2001

    1:  /******************************************************************************
    2:  COPYRIGHT 2002 STMicroelectronics
    3:  Source File Name : sci.c 
    4:  Group            : IPSW,CMG-IPDF
    5:  Author           : MCD Application Team
    6:  Date First Issued: 5/3/2002
    7:  ********************************Documentation**********************************
    8:  General Purpose - Contains source code for all the functions of SCI
    9:  
   10:  ********************************Revision History*******************************
   11:  _______________________________________________________________________________
   12:  Date :5/3/2002			Release:1.0
   13:  Date March 2004		Release:2.0: customized for ST7MC; now uses the HW 
   14:  registers description coming with STVD7 3.0
   15:       	
   16:    
   17:  ******************************************************************************/
   18:  
   19:  #include "ST7FMC2N6.h"	/* ST7FMC peripherals Hardware Registers declaration */
   20:  #include "Sci.h"                                   /*Declaration of functions*/
   21:  
   22:  
   23:  /*---------------------Select the mode of communication ---------------------*/
   24:  
   25:  #define SCI_POLLING_TX                            /*Polling mode transmission*/           
   26:  #define SCI_POLLING_RX                               /*polling mode reception*/               
   27:  //#define SCI_ITDRV_WITHOUTBUF_TX 	                                     
   28:                            /*Interrupt driven without buffer transmission mode*/
   29:  //#define SCI_ITDRV_WITHOUTBUF_RX		                             
   30:                               /*Interrupt driven without buffer reception mode*/                                                                 
   31:  
   32:  
   33:  
   34:  static volatile unsigned char SCI_Error;    /*Declaration of Global Variables*/
   35:  static volatile unsigned char SCI_MY_DATA;
   36:  static const volatile unsigned char *PtrToSCIBuffTx; 
   37:  static volatile unsigned char *PtrToSCIBuffRx;
   38:  static volatile unsigned char SCI_Tx_Buff;
   39:  static volatile unsigned char SCI_Tx_String;
   40:  static volatile unsigned int SCI_Rx_Buff;
   41:  static volatile unsigned char SCI_Rx_String;
   42:  static volatile unsigned char SCI_Pol_Stat;  
   43:  
   44:  
   45:  void PrintUnsignedInt( unsigned int x )
   46:  {

Function: PrintUnsignedInt
Source  : ..\..\source\sci.c
Options : -Cc -F7 -Lasm=%n.lst -Ml -N -Os -Ou -Of -Ol0 -OnPMNC -Or

  0000 b701     LD    _PrintUnsignedIntp0:1,A
  0002 bf00     LD    _PrintUnsignedIntp0,X
   47:          char b[6], *s = b + 5;
  0004 a600     LD    A,#b:5
  0006 b701     LD    s:1,A
   48:  
   49:          *s-- = '\0';
  0008 5f       CLR   X
  0009 4d       TNZ   A
  000a 2601     JRNE  *3 ;abs = 000d
  000c 5a       DEC   X
  000d 4a       DEC   A
  000e b701     LD    s:1,A
  0010 bf00     LD    s,X
  0012 a600     LD    A,#b:5
  0014 b701     LD    _SEX:1,A
  0016 4f       CLR   A
  0017 3f00     CLR   _SEX
  0019 92c700   LD    [_SEX.w],A
   50:          do
   51:          {
   52:                  *s-- = (char)(x % 10 + '0');
  001c be00     LD    X,_PrintUnsignedIntp0
  001e 89       PUSH  X
  001f b601     LD    A,_PrintUnsignedIntp0:1
  0021 88       PUSH  A
  0022 a60a     LD    A,#10
  0024 5f       CLR   X
  0025 cd0000   CALL  _IMODU
  0028 ab30     ADD   A,#48
  002a 9097     LD    Y,A
  002c b601     LD    A,s:1
  002e be00     LD    X,s
  0030 bf00     LD    _SEX,X
  0032 b701     LD    _SEX:1,A
  0034 2601     JRNE  *3 ;abs = 0037
  0036 5a       DEC   X
  0037 4a       DEC   A
  0038 b701     LD    s:1,A
  003a bf00     LD    s,X
  003c 909f     LD    A,Y
  003e 92c700   LD    [_SEX.w],A
   53:                  x /= 10;
  0041 be00     LD    X,_PrintUnsignedIntp0
  0043 89       PUSH  X
  0044 b601     LD    A,_PrintUnsignedIntp0:1
  0046 88       PUSH  A
  0047 5f       CLR   X
  0048 a60a     LD    A,#10
  004a cd0000   CALL  _IDIVU
  004d b701     LD    _PrintUnsignedIntp0:1,A
  004f bf00     LD    _PrintUnsignedIntp0,X
   54:          } while( x );
  0051 b601     LD    A,_PrintUnsignedIntp0:1
  0053 ba00     OR    A,_PrintUnsignedIntp0
  0055 26c5     JRNE  *-57 ;abs = 001c
   55:          
   56:          SCI_PutString( s+1 );
  0057 b601     LD    A,s:1
  0059 ab01     ADD   A,#1
  005b 9097     LD    Y,A
  005d b600     LD    A,s
  005f a900     ADC   A,#0
  0061 97       LD    X,A
  0062 909f     LD    A,Y
  0064 cc0000   JP    SCI_PutString
   57:  }
   58:  
   59:  void PrintUnsignedChar( unsigned char x )
   60:  {

Function: PrintUnsignedChar
Source  : ..\..\source\sci.c
Options : -Cc -F7 -Lasm=%n.lst -Ml -N -Os -Ou -Of -Ol0 -OnPMNC -Or

  0000 b700     LD    _PrintUnsignedCharp0,A
   61:          char b[4], *s = b + 3;
  0002 a600     LD    A,#b:3
  0004 b701     LD    s:1,A
   62:  
   63:          *s-- = '\0';
  0006 5f       CLR   X
  0007 4d       TNZ   A
  0008 2601     JRNE  *3 ;abs = 000b
  000a 5a       DEC   X
  000b 4a       DEC   A
  000c b701     LD    s:1,A
  000e bf00     LD    s,X
  0010 a600     LD    A,#b:3
  0012 b701     LD    _SEX:1,A
  0014 4f       CLR   A
  0015 3f00     CLR   _SEX
  0017 92c700   LD    [_SEX.w],A
   64:          do
   65:          {
   66:                  *s-- = (char)(x % 10 + '0');
  001a 5f       CLR   X
  001b 89       PUSH  X
  001c b600     LD    A,_PrintUnsignedCharp0
  001e 88       PUSH  A
  001f a60a     LD    A,#10
  0021 cd0000   CALL  _IMODS
  0024 ab30     ADD   A,#48
  0026 9097     LD    Y,A
  0028 b601     LD    A,s:1
  002a be00     LD    X,s
  002c bf00     LD    _SEX,X
  002e b701     LD    _SEX:1,A
  0030 2601     JRNE  *3 ;abs = 0033
  0032 5a       DEC   X
  0033 4a       DEC   A
  0034 b701     LD    s:1,A
  0036 bf00     LD    s,X
  0038 909f     LD    A,Y
  003a 92c700   LD    [_SEX.w],A
   67:                  x /= 10;
  003d 5f       CLR   X
  003e 89       PUSH  X
  003f b600     LD    A,_PrintUnsignedCharp0
  0041 88       PUSH  A
  0042 a60a     LD    A,#10
  0044 cd0000   CALL  _IDIVU
  0047 b700     LD    _PrintUnsignedCharp0,A
  0049 26cf     JRNE  *-47 ;abs = 001a
   68:          } while( x );
   69:          
   70:          SCI_PutString( s+1 );
  004b b601     LD    A,s:1
  004d ab01     ADD   A,#1
  004f 9097     LD    Y,A
  0051 b600     LD    A,s
  0053 a900     ADC   A,#0
  0055 97       LD    X,A
  0056 909f     LD    A,Y
  0058 cc0000   JP    SCI_PutString
   71:  }
   72:  
   73:  void PrintSignedChar( signed char x )
   74:  {

Function: PrintSignedChar
Source  : ..\..\source\sci.c
Options : -Cc -F7 -Lasm=%n.lst -Ml -N -Os -Ou -Of -Ol0 -OnPMNC -Or

  0000 b700     LD    _PrintSignedCharp0,A
   75:  		char b[5], *s = b + 4;
  0002 a600     LD    A,#b:4
  0004 b701     LD    s:1,A
   76:  
   77:  	*s-- = '\0';
  0006 5f       CLR   X
  0007 4d       TNZ   A
  0008 2601     JRNE  *3 ;abs = 000b
  000a 5a       DEC   X
  000b ad7a     CALLR *124 ;abs = 0087
  000d a600     LD    A,#b:4
  000f b701     LD    _SEX:1,A
  0011 4f       CLR   A
  0012 3f00     CLR   _SEX
  0014 92c700   LD    [_SEX.w],A
   78:  
   79:  	if (x >= 0)
  0017 be00     LD    X,_PrintSignedCharp0
  0019 2b14     JRMI  *22 ;abs = 002f
   80:  	{
   81:  		do
   82:  		{
   83:  			*s-- = (char)(x % 10 + '0');
  001b ad4e     CALLR *80 ;abs = 006b
  001d 2601     JRNE  *3 ;abs = 0020
  001f 5a       DEC   X
  0020 ad32     CALLR *52 ;abs = 0054
  0022 26f7     JRNE  *-7 ;abs = 001b
   84:  			x /= 10;
   85:  		} while( x );
   86:  		*s-- = '+';
  0024 ad58     CALLR *90 ;abs = 007e
  0026 2601     JRNE  *3 ;abs = 0029
  0028 5a       DEC   X
  0029 ad5c     CALLR *94 ;abs = 0087
  002b a62b     LD    A,#43
   87:  	}
  002d 2012     JRT   *20 ;abs = 0041
   88:  	else
   89:  	{
   90:  		do
   91:  		{
   92:  			*s-- = (char)(x % 10 + '0');
  002f ad3a     CALLR *60 ;abs = 006b
  0031 2601     JRNE  *3 ;abs = 0034
  0033 5a       DEC   X
  0034 ad1e     CALLR *32 ;abs = 0054
  0036 26f7     JRNE  *-7 ;abs = 002f
   93:  			x /= 10;
   94:  		} while( x );
   95:  		*s-- = '-';
  0038 ad44     CALLR *70 ;abs = 007e
  003a 2601     JRNE  *3 ;abs = 003d
  003c 5a       DEC   X
  003d ad48     CALLR *74 ;abs = 0087
  003f a62d     LD    A,#45
  0041 92c700   LD    [_SEX.w],A
   96:  	}  
   97:  	SCI_PutString( s+1 );
  0044 b601     LD    A,s:1
  0046 ab01     ADD   A,#1
  0048 9097     LD    Y,A
  004a b600     LD    A,s
  004c a900     ADC   A,#0
  004e 97       LD    X,A
  004f 909f     LD    A,Y
  0051 cc0000   JP    SCI_PutString
  0054 ad31     CALLR *51 ;abs = 0087
  0056 909f     LD    A,Y
  0058 92c700   LD    [_SEX.w],A
  005b b600     LD    A,_PrintSignedCharp0
  005d cd0000   CALL  _SEXT16
  0060 89       PUSH  X
  0061 88       PUSH  A
  0062 5f       CLR   X
  0063 a60a     LD    A,#10
  0065 cd0000   CALL  _IDIVS
  0068 b700     LD    _PrintSignedCharp0,A
  006a 81       RET   
  006b b600     LD    A,_PrintSignedCharp0
  006d cd0000   CALL  _SEXT16
  0070 89       PUSH  X
  0071 88       PUSH  A
  0072 a60a     LD    A,#10
  0074 5f       CLR   X
  0075 cd0000   CALL  _IMODS
  0078 ab30     ADD   A,#48
  007a 9097     LD    Y,A
  007c 2000     JRT   *2 ;abs = 007e
  007e b601     LD    A,s:1
  0080 be00     LD    X,s
  0082 bf00     LD    _SEX,X
  0084 b701     LD    _SEX:1,A
  0086 81       RET   
  0087 4a       DEC   A
  0088 b701     LD    s:1,A
  008a bf00     LD    s,X
  008c 81       RET   
   98:  }
   99:  
  100:  /*-----------------------------------------------------------------------------
  101:  ROUTINE NAME : SCI_Init
  102:  INPUT        : 1.SCI_DEFAULT_PARAM1, SCI_WORDLENGTH_9,SCI_ODPARITY_SELECT,
  103:  				 SCI_EVPARITY_SELECT or SCI_WAKEUP_ADDR
  104:                 2.SCI_MUTE_ENABLE,SCI_BREAK_ENABLE,SCI_DEFAULT_PARAM2
  105:  OUTPUT       : None	 		 
  106:  DESCRIPTION  : Initializes the SCI in the required mode
  107:  COMMENTS     : Must be called before starting any sci operation
  108:  -----------------------------------------------------------------------------*/
  109:  void SCI_Init ( SCI_Type_Param1  Init_Value1, SCI_Type_Param2  Init_Value2)
  110:  {   

Function: SCI_Init
Source  : ..\..\source\sci.c
Options : -Cc -F7 -Lasm=%n.lst -Ml -N -Os -Ou -Of -Ol0 -OnPMNC -Or

  0000 b701     LD    _SCI_Initp0:1,A
  0002 bf00     LD    _SCI_Initp0,X
  111:      unsigned char temp;	
  112:      
  113:      SCICR1 = SCI_DEFAULT_PARAM1;                         /*Load Default value*/
  0004 3f00     CLR   SCICR1
  114:      SCICR2 = SCI_DEFAULT_PARAM2;
  0006 3f00     CLR   SCICR2
  115:      temp = SCISR;                    /*Clear all the flags in Status register*/
  0008 b600     LD    A,SCISR
  116:      temp = SCIDR;
  000a b600     LD    A,SCIDR
  117:      SCIDR = SCI_DEFAULT_PARAM1;
  000c 3f00     CLR   SCIDR
  118:      SCICR1 |= Init_Value1;                    /*Sets SCI in the required mode*/
  000e b601     LD    A,_SCI_Initp1:1
  0010 ba00     OR    A,SCICR1
  0012 b700     LD    SCICR1,A
  119:      SCICR2 |= Init_Value2;
  0014 b601     LD    A,_SCI_Initp0:1
  0016 ba00     OR    A,SCICR2
  0018 b700     LD    SCICR2,A
  120:      SCI_Pol_Stat = SCI_Error = 0;               /*Initializes globalvariables*/
  001a 4f       CLR   A
  001b c70000   LD    SCI_Error,A
  001e c60000   LD    A,SCI_Error
  0021 c70000   LD    SCI_Pol_Stat,A
  121:      SCI_Tx_Buff = 0;
  0024 4f       CLR   A
  0025 c70000   LD    SCI_Tx_Buff,A
  122:      SCI_Tx_String = 0;
  0028 c70000   LD    SCI_Tx_String,A
  123:      SCI_Rx_Buff = SCI_Rx_String = 0; 		
  002b c70000   LD    SCI_Rx_String,A
  002e c60000   LD    A,SCI_Rx_String
  0031 c70001   LD    SCI_Rx_Buff:1,A
  0034 5f       CLR   X
  0035 cf0000   LD    SCI_Rx_Buff,X
  124:  }
  0038 81       RET   
  125:  /*-----------------------------------------------------------------------------
  126:  ROUTINE NAME : SCI_Mode
  127:  INPUT        : SCI_TX_ENABLE or SCI_RX_ENABLE
  128:  OUTPUT       : None
  129:  DESCRIPTION  : Selects the transmitter or receiver mode for SCI
  130:  COMMENTS     : None
  131:  -----------------------------------------------------------------------------*/
  132:  void SCI_Mode(SCI_Mode_Type SCI_Mode_Param)
  133:  {       

Function: SCI_Mode
Source  : ..\..\source\sci.c
Options : -Cc -F7 -Lasm=%n.lst -Ml -N -Os -Ou -Of -Ol0 -OnPMNC -Or

  134:      SCICR2 |= SCI_Mode_Param;          /*Selects Transmitter or Receiver mode*/
  0000 ba00     OR    A,SCICR2
  0002 b700     LD    SCICR2,A

⌨️ 快捷键说明

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