//**************************************************************************** // @Module Asynchronous / Synchronous Serial Interface (ASC) // @Filename ASC.C // @Project phytec //---------------------------------------------------------------------------- // @Controller Siemens C167CR-L // // @Compiler Tasking C166 V5.0 // // @Codegenerator DAvE 1-0-0 // // @Description This file contains all functions that use the ASC // // //---------------------------------------------------------------------------- // @Date 04.02.98 08:50:18 // //**************************************************************************** //**************************************************************************** // @Project Includes //**************************************************************************** #include "MAIN.H" // USER CODE BEGIN (ASC_General,1) // USER CODE END //*************************************************************************** // @Global Variables //*************************************************************************** // USER CODE BEGIN (ASC_General,2) // USER CODE END //**************************************************************************** // @Function void ASC_vInit(void) // //---------------------------------------------------------------------------- // @Description This function initializes the ASC component. It effects all // necessary configurations of the SFR, depending on the selected // operating mode. The configuration determines whether the ASC // interrupts are to be released, and the priority of the // released interrupt. // //---------------------------------------------------------------------------- // @Returnvalue none // //---------------------------------------------------------------------------- // @Parameters none // //---------------------------------------------------------------------------- // @Date 04.02.98 08:50:18 // //**************************************************************************** void ASC_vInit(void) { /// 8-bit data asynchronous operation /// one stop bit /// divide clock by reload value + constant /// receiver disabled S0CON = 0x0001; // ASC baudrate reload register /// baudrate = 9615,38 Baud S0BG = 0x0040; /// enable transmit interrupt /// transmit interrupt priority level(ILVL) = 14 /// transmit interrupt group level (GLVL) = 0 S0TIC = 0x0078; /// use PEC channel 0 for ASC transmit interrupt /// - count = 3 /// - byte transfer /// - increment source pointer PECC0 = 0x0503; /// User defined source pointer is selected for PECC Channel 0 DSTP0 = 0xFEB0; P3 |= 0x0400; // set P3.10 output latch (TXD0) DP3 |= 0x0400; /// set P3.10 direction control (TXD0 output) // USER CODE BEGIN (ASC_Init,1) // DO NOT FORGET TO SET THE SOURCE-POINTER FOR PECC CHANNEL 0 // USER CODE END S0R = 1; // enable baudrate generator } //**************************************************************************** // @Function interrupt (S0TINT) void ASC_viIsrTx(void) // //---------------------------------------------------------------------------- // @Description This is the transmit interrupt service routine for the ASC0. // It is called when the sending of data is terminated // (S0TIR is set). // Note: // It is important that the user adds to this function with // Application Specific Code. User Code sections are available // in the function for this purpose. // //---------------------------------------------------------------------------- // @Returnvalue none // //---------------------------------------------------------------------------- // @Parameters none // //---------------------------------------------------------------------------- // @Date 04.02.98 08:50:18 // //**************************************************************************** interrupt (S0TINT) void ASC_viIsrTx(void) { // USER CODE BEGIN (ASC_IsrTx,1) // USER CODE END } // USER CODE BEGIN (ASC_General,3) // USER CODE END