sci_drv.c

来自「ST72T63游戏杆源程序」· C语言 代码 · 共 62 行

C
62
字号
/**************** (c) 1998  SGS-Thomson Microelectronics **********************

PROJECT  :       EVALUATION BOARD - ST7 SCI DEMO SYSTEM
COMPILER :       ST7 HICROSS C (HIWARE)
MODULE  :        sci_drv.c
CREATION DATE :  10/10/98
AUTHOR :         Cyril Troise
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
                                   UPS Project
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

******************************************************************************/


/* EXTERNAL DECLARATIONS *****************************************************/
/* List of all the variables defined in another module and used in this one. */
/* MODEL => #include {file_name}.h                                           */
#include "map_7263.h"                 /* Declaration of the SCI HW registers.*/
#include "lib_bits.h"                      /* Bit handling macro definitions.*/
#include <hidef.h>
#include "Sci_drv.h"
#include "usr_var.h"
                                                                          
/*-----------------------------------------------------------------------------
ROUTINE NAME : SCI_Tx
INPUT/OUTPUT : Buffer @, Number of data bytes to transmit / None.
DESCRIPTION  : Transmit data buffer via SCI.
COMMENTS     : Least significant bit first.
-----------------------------------------------------------------------------*/ 
void SCI_Tx (char *buff_add,char Nb)
{        
/* The reception is disabled, no data must be sent to the ST7. If data are   */
/* to be received during this part, the RE bit must be set and the user will */
/* have to use interruptions. If these advises are not respected,a wrong     */
/* byte might be detected when going back in reception mode.                 */

  //SCICR2 = CR2_TX_VAL;            /* Set SCI peripheral in transmission mode.*/
  //for(;Nb>0;Nb--)            /* Loop to send the Nb bytes of the data buffer.*/
 // {  
   // SCIDR = *(buff_add+(Nb-1));
   // while (!(SCISR & 0x80)) asm   nop;       /* Wait for the end of the byte */                                             /* transmission.                */
  //}
 // SCICR2 = CR2_RX_INT;             /* Reception only mode with interrupts.   */ 
}

/*-----------------------------------------------------------------------------
ROUTINE NAME : SCI_Rx
INPUT/OUTPUT : Buffer @, Number of data bytes to receive / None.
DESCRIPTION  : Receive in data buffer via SCI.
COMMENTS     : Least significant bit first.
-----------------------------------------------------------------------------*/ 
void SCI_Rx (char Nb)
{
   for (TEMP=2; TEMP<=Nb; TEMP++)
   {
        while (!ValBit(SCISR,5));
               Mess_RXD[TEMP] = SCIDR;
   }
}
  
/*** (c) 1998  SGS-Thomson Microelectronics ****************** END OF FILE ***/

⌨️ 快捷键说明

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