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

📄 sci.lst

📁 该程序是ST7MC驱动三洋压缩机(交流)
💻 LST
📖 第 1 页 / 共 3 页
字号:
  135:  }
  0004 81       RET   
  136:  /*-----------------------------------------------------------------------------
  137:  ROUTINE NAME : SCI_Forced_Clear_Flag
  138:  INPUT        : None
  139:  OUTPUT       : None  	
  140:  DESCRIPTION  : Clears all status flag performs both read and write operation 
  141:  COMMENTS     : Can be used if clearing of all status flag is needed
  142:  -----------------------------------------------------------------------------*/
  143:  void SCI_Forced_Clear_Flag( void )
  144:  {

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

  145:      unsigned char Temp_Variable,temp;     
  146:  	
  147:      Temp_Variable = SCICR2; 
  0000 b600     LD    A,SCICR2
  148:      SCICR2 = 0x00;      
  0002 3f00     CLR   SCICR2
  149:      temp = SCISR;                       /*Clears all flags in status register*/
  0004 be00     LD    X,SCISR
  150:      SCIDR = 0x00; 
  0006 3f00     CLR   SCIDR
  151:      SCICR2 = Temp_Variable;
  0008 b700     LD    SCICR2,A
  152:  } 
  000a 81       RET   
  153:  /*-----------------------------------------------------------------------------
  154:  ROUTINE NAME : SCI_IT_Enable
  155:  INPUT        : SCI_IDLE_LINE,SCI_RECEIVE_OVERRUN,SCI_TRANSMIT_REGISTER_READY,
  156:                 SCI_FRAME_TRANSMITTED,SCI_PARITY_ERROR
  157:  OUTPUT	     : None	
  158:  DESCRIPTION  : Reset the interrupt masking
  159:  COMMENTS     : None
  160:  -----------------------------------------------------------------------------*/
  161:  void SCI_IT_Enable ( SCI_IT_Type SCI_IT_Param)
  162:  {      

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

  163:      SCICR1 |= (unsigned char)(SCI_IT_Param & SCI_PARITY_ERROR);   
  0000 97       LD    X,A
  0001 a401     AND   A,#1
  0003 ba00     OR    A,SCICR1
  0005 b700     LD    SCICR1,A
  164:                                               /*Enables the required interrupt*/
  165:      SCICR2 |= (unsigned char)(SCI_IT_Param & (~SCI_PARITY_ERROR)) ; 
  0007 9f       LD    A,X
  0008 a4fe     AND   A,#254
  000a ba00     OR    A,SCICR2
  000c b700     LD    SCICR2,A
  166:  }                                                                                  
  000e 81       RET   
  167:  
  168:  /*-----------------------------------------------------------------------------
  169:  ROUTINE NAME    : SCI_Select_Baudrate
  170:  INPUT           : SCI_PR_X+SCI_TR_Y+SCI_RR_Z
  171:  OUTPUT          : None
  172:  DESCRIPTION     : Selects possible baudrate for transmission and reception
  173:  COMMENTS        : Values are to be precalculated by the user
  174:  -----------------------------------------------------------------------------*/
  175:  void SCI_Select_Baudrate (SCI_Baudrate_Type Baudrate_Presc)
  176:  {

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

  177:      SCIBRR =0x00;
  0000 3f00     CLR   SCIBRR
  178:      SCIBRR |= Baudrate_Presc;            /*Loads the required value in SCIBRR*/
  0002 ba00     OR    A,SCIBRR
  0004 b700     LD    SCIBRR,A
  179:  }
  0006 81       RET   
  180:  
  181:  /*-----------------------------------------------------------------------------
  182:  ROUTINE NAME    : SCI_Extend_BaudRate
  183:  INPUT           : SCI_PR_X+SCI_TR_Y+RR_Z,ETPR,ERPR 
  184:  OUTPUT          : None
  185:  DESCRIPTION     : Selects the possible baudrate with extended prescalar	
  186:  COMMENTS        : Values are to be precalculated by the user
  187:  -----------------------------------------------------------------------------*/
  188:  #if (defined SCI_72F521 | defined SCI_72F62)
  189:  void SCI_Extend_Baudrate (SCI_Baudrate_Type Baudrate_Presc,
  190:                                           unsigned char ETPR,unsigned char ERPR)
  191:  {
  192:      SCIBRR = 0x00;
  193:      SCIBRR |= Baudrate_Presc;               /*Loads the required value SCIBRR*/
  194:      SCIETPR = ETPR;                    /*loads the required value in SCIETPR */
  195:      SCIERPR = ERPR;                    /*loads the required value in SCIERPR */
  196:  }  
  197:  #endif
  198:  /*-----------------------------------------------------------------------------
  199:  ROUTINE NAME    : SCI_PutByte
  200:  INPUT           : Tx_DATA
  201:  OUTPUT          : None		
  202:  DESCRIPTION     : Transmits a single data byte
  203:  COMMENTS        : None
  204:  -----------------------------------------------------------------------------*/
  205:  void SCI_PutByte (unsigned char Tx_DATA)
  206:  {  

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

  207:      unsigned char temp;
  208:      
  209:  #ifdef SCI_POLLING_TX
  210:      temp = SCISR;                          /*Loads the byte to be transmitted*/
  0000 be00     LD    X,SCISR
  211:      SCIDR = Tx_DATA;
  0002 b700     LD    SCIDR,A
  212:  #endif
  213:  
  214:  #ifdef SCI_ITDRV_WITHOUTBUF_TX	
  215:      SCI_Tx_Buff = 1;                               /*Loads the default value */
  216:      SCI_Tx_String = 0;
  217:      temp = SCISR; 
  218:      SCIDR = Tx_DATA;                       /*Loads the byte to be transmitted*/
  219:      SCICR2 |= (unsigned char)TDRE;  //Enable INterrupt
  220:  #endif
  221:  }
  0004 81       RET   
  222:  /*-----------------------------------------------------------------------------
  223:  ROUTINE NAME    : SCI_IsTransmitCompleted
  224:  INPUT           : None    
  225:  OUTPUT          : TRUE or FALSE	
  226:  DESCRIPTION     : Checks if the transmission is completed or not
  227:  COMMENTS        : Must be called after Put_Byte or Put_Buffer or Put_String
  228:  -----------------------------------------------------------------------------*/
  229:  BOOL SCI_IsTransmitCompleted(void)
  230:  {

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

  231:  #if defined SCI_POLLING_TX
  232:      if(SCISR & SCISR_TC_OR)                      /*Checks if transmission is completed*/
  0000 0d0003   BTJF  SCISR,#6,*6 ;abs = 0006
  233:      {
  234:          return (TRUE);
  0003 a601     LD    A,#1
  0005 81       RET   
  235:      }
  236:      else 
  237:      {
  238:          return(FALSE);
  0006 4f       CLR   A
  239:      }
  240:  #else
  241:  #if defined SCI_ITDRV_WITHOUTBUF_TX 
  242:     if (SCI_Tx_String == 1)
  243:     {
  244:          if((*PtrToSCIBuffTx == '\0') && (SCISR & SCISR_TDRE_OR)) 
  245:          {
  246:              return (TRUE);
  247:          }
  248:          else
  249:          {
  250:             return (FALSE);
  251:          }
  252:     }
  253:     else if (SCI_Tx_Buff == 0)
  254:     {
  255:          return (TRUE);
  256:     }
  257:     else
  258:     {
  259:          return (FALSE);
  260:     }
  261:  
  262:  #else
  263:         return(TRUE);                                 /*Dummy return statement*/
  264:  #endif    
  265:  #endif
  266:  }
  0007 81       RET   
  267:  /*-----------------------------------------------------------------------------
  268:  ROUTINE NAME    : SCI_IT_Disable
  269:  INPUT           : SCI_IDLE_LINE,SCI_RECEIVE_OVERRUN,SCI_TRANSMIT_REGISTER_READY
  270:                   ,SCI_FRAME_TRANSMITTED,SCI_PARITY_ERROR
  271:  OUTPUT          : None
  272:  DESCRIPTION     : Disables the interrupt due to a particular flag
  273:  COMMENTS        : None
  274:  -----------------------------------------------------------------------------*/
  275:  void SCI_IT_Disable(SCI_IT_Type SCI_IT_Param)
  276:  { 

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

  277:     SCICR2 &= (unsigned char)(~(SCI_IT_Param & (~SCI_PARITY_ERROR)));  
  0000 97       LD    X,A
  0001 a4fe     AND   A,#254
  0003 43       CPL   A
  0004 b400     AND   A,SCICR2
  0006 b700     LD    SCICR2,A
  278:                                              /*disables the selected interrupt*/
  279:     SCICR1 &= (unsigned char)(~(SCI_IT_Param & SCI_PARITY_ERROR));     
  0008 9f       LD    A,X
  0009 a401     AND   A,#1
  000b 43       CPL   A
  000c b400     AND   A,SCICR1
  000e b700     LD    SCICR1,A
  280:  }
  0010 81       RET   
  281:  
  282:  /*-----------------------------------------------------------------------------
  283:  ROUTINE NAME    : SCI_PutBuffer
  284:  INPUT           : *PtrtoBuffer,NbOfBytes
  285:  OUTPUT          : None
  286:  DESCRIPTION     : Transmits  data from the user buffer in polling mode and 
  287:                    starts transmission in interrupt driven with buffer mode
  288:  COMMENTS        : None
  289:  -----------------------------------------------------------------------------*/
  290:  void SCI_PutBuffer (const unsigned char *PtrtoBuffer, unsigned char NbOfBytes)
  291:  {  

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

  0000 b700     LD    _SCI_PutBufferp0,A
  292:      unsigned char temp;
  293:  #ifdef SCI_POLLING_TX
  294:      for (; NbOfBytes > 0 ; NbOfBytes--)
  0002 2014     JRT   *22 ;abs = 0018
  295:      { 
  296:     	    temp = SCISR;
  0004 b600     LD    A,SCISR
  297:          SCIDR = *PtrtoBuffer;              /*Loads the byte to be transmitted*/
  0006 92c600   LD    A,[_SCI_PutBufferp1.w]
  0009 b700     LD    SCIDR,A
  298:          while (!(SCI_IsTransmitCompleted()));  
  000b ad00     CALLR SCI_IsTransmitCompleted
  000d 4d       TNZ   A
  000e 27fb     JREQ  *-3 ;abs = 000b
  299:                                     /*Waits for the completion of transmission*/
  300:          PtrtoBuffer++;               /*Moves the pointer to the next location*/
  0010 3c01     INC   _SCI_PutBufferp1:1
  0012 2602     JRNE  *4 ;abs = 0016
  0014 3c00     INC   _SCI_PutBufferp1
  0016 3a00     DEC   _SCI_PutBufferp0
  0018 b600     LD    A,_SCI_PutBufferp0
  001a 26e8     JRNE  *-22 ;abs = 0004
  301:      } 
  302:  #endif
  303:  
  304:  #ifdef SCI_ITDRV_WITHOUTBUF_TX  
  305:      PtrToSCIBuffTx  = PtrtoBuffer; /*copies the user data to global variables*/    
  306:      SCI_Tx_Buff = NbOfBytes;
  307:      SCI_Tx_String = 0;
  308:      temp = SCISR;
  309:      SCIDR = *PtrToSCIBuffTx;        /*First byte is transmitted to generate the
  310:                                                                      interrupt*/
  311:     SCICR2 |= (unsigned char)TDRE;  //Enable INterrupt                                                                      
  312:  #endif
  313:  }
  001c 81       RET   
  314:  /*-----------------------------------------------------------------------------
  315:  ROUTINE NAME    : SCI_PutString
  316:  INPUT           : *PtrtoString
  317:  OUTPUT          : None
  318:  DESCRIPTION     : Transmits the user string in polling mode and starts 
  319:                    transmission in interrupt driven mode
  320:  COMMENTS        : None
  321:  -----------------------------------------------------------------------------*/
  322:  void SCI_PutString(const unsigned char *PtrtoString)
  323:  {   

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

  0000 b701     LD    _SCI_PutStringp0:1,A
  0002 bf00     LD    _SCI_PutStringp0,X
  324:      unsigned char Val = *PtrtoString, temp;
  0004 92c600   LD    A,[_SCI_PutStringp0.w]
  0007 b700     LD    Val,A
  325:  
  326:  #ifdef SCI_POLLING_TX 
  327:      while (Val != '\0')                        /*Checks for the end of string*/
  0009 2017     JRT   *25 ;abs = 0022
  328:      {
  329:          Val= *PtrtoString;					
  000b 92c600   LD    A,[_SCI_PutStringp0.w]
  000e b700     LD    Val,A
  330:          temp = SCISR;        
  0010 be00     LD    X,SCISR
  331:          SCIDR = *PtrtoString;        /*Copies the character to be transmitted*/
  0012 92c600   LD    A,[_SCI_PutStringp0.w]
  0015 b700     LD    SCIDR,A
  332:          while(!(SCI_IsTransmitCompleted()));   
  0017 ad00     CALLR SCI_IsTransmitCompleted
  0019 4d       TNZ   A
  001a 27fb     JREQ  *-3 ;abs = 0017
  333:                                 /*waits for the completion of the transmission*/
  334:          PtrtoString++;               /*Moves the pointer to the next location*/
  001c 3c01     INC   _SCI_PutStringp0:1
  001e 2602     JRNE  *4 ;abs = 0022
  0020 3c00     INC   _SCI_PutStringp0
  0022 b600     LD    A,Val
  0024 26e5     JRNE  *-25 ;abs = 000b
  335:      }	
  336:  #endif
  337:  
  338:  #ifdef SCI_ITDRV_WITHOUTBUF_TX 
  339:      PtrToSCIBuffTx = PtrtoString;   /*Copies the adress of the user string into
  340:                                                            the global variable*/
  341:      SCI_Tx_String = 1;               /*copies default value to recognize string 
  342:                                       transmission in the interrupt subroutine*/
  343:      SCI_Tx_Buff = 0;                                     
  344:      temp = SCISR;
  345:      SCIDR = *PtrToSCIBuffTx;/*transmits first character to generate interrupt*/
  346:      SCICR2 |= (unsigned char)TDRE;  //Enable INterrupt
  347:  #endif
  348:  } 
  0026 81       RET   
  349:  /*-----------------------------------------------------------------------------
  350:  ROUTINE NAME    : SCI_9thBit_TxRx
  351:  INPUT           : TRUE or FALSE
  352:  OUTPUT          : TRUE or FALSE
  353:  DESCRIPTION     : Writes the 9th bit to be transmitted in the SCICR1 register 
  354:                    and returns the 9th bit received
  355:  COMMENTS        : 9 bit mode must be enabled.
  356:  -----------------------------------------------------------------------------*/
  357:  BOOL SCI_9thBit_TxRx(BOOL Bit9_Val)
  358:  {

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

  359:      if (Bit9_Val == TRUE)              /*If 9th bit is to be transmittes as 1*/
  0000 4a       DEC   A
  0001 2604     JRNE  *6 ;abs = 0007
  360:      {
  361:          SCICR1 |= 0x40;
  0003 1c00     BSET  SCICR1,#6
  362:      }
  0005 2002     JRT   *4 ;abs = 0009
  363:      else
  364:      {
  365:          SCICR1 &= 0xBF;
  0007 1d00     BRES  SCICR1,#6
  366:      }
  367:      if (SCICR1 & 0x80)                      /*If the 9th bit is received as 1*/
  0009 0f0003   BTJF  SCICR1,#7,*6 ;abs = 000f
  368:      {
  369:          return (TRUE);
  000c a601     LD    A,#1
  000e 81       RET   
  370:      }
  371:      else
  372:      {
  373:          return (FALSE);
  000f 4f       CLR   A
  374:      }
  375:  }					
  0010 81       RET   
  376:  /*-----------------------------------------------------------------------------
  377:  ROUTINE NAME    : SCI_GetByte

⌨️ 快捷键说明

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