/* ******************************************************************************** SIEMENS C511/C513 STARTER KIT -------------------------------------------------------------------------------- PROGRAM ssc1_sl -------------------------------------------------------------------------------- MODUL NAME ssc1_sl.c -------------------------------------------------------------------------------- DESCRIPTION This program is an example for a SSC application, running on a C511/C513 microcontroller. The controller is configured to run in slave mode. The controller uses the first byte, received via SSC as a multiplier. The following bytes, received via SSC, are multiplied with this factor and sent back to the SSC master. -------------------------------------------------------------------------------- FUNCTIONS void main(void) ; -------------------------------------------------------------------------------- NOTE No precautions are implemented for data range overflow. No handshake between SSC master and SSC slave is implemented. -------------------------------------------------------------------------------- ENVIRONMENT The program runs on the C511/C513 Starter Kit board miniCON-513. The program is dedicated for the SAB-C513A-H microcontroller in socket U5. The program can be programmed into its E2PROM with prg51x.exe programming monitor. -------------------------------------------------------------------------------- VERSION V1.0 -------------------------------------------------------------------------------- COMPILER Keil PK51 Eval V5.02 -------------------------------------------------------------------------------- SEE ALSO ssc1_ma.c -------------------------------------------------------------------------------- DATE 16/10/95 -------------------------------------------------------------------------------- MODIFICATIONS none ******************************************************************************** */ /*********************** Compiler Includes ******************************/ #include /*********************** C513 SFR Includes ******************************/ #include "sfr_c513.h" /*********************** miniCON-513 Includes ******************************/ #include "board513.h" /*********************** Prototypes ******************************/ void main (void); /*********************** Program Code ******************************/ void main(void) { int ssc_receive; int mul_factor; /* SSC configuration: SCEN = 1: SSC subsystem enabled TEN = 1: full duplex mode enabled MSTR = 0: slave mode selected CPOL = 1: SCLK idle state is high CPHA = 1: first data bit is shifted out with first SCLK edge and sampled with the second clock edge BRS2-BRS0: divide factor is set to 8; baudrate = 1.5 MBaud */ SSCCON = 0xD9; while (!TC); /* wait for completion of first SSC transfer */ mul_factor = SRB; /* first SSC receive value is multiplier */ ssc_receive = 1; /* initialize ssc_receive to 1, so multiplier is sent back to the SSC master */ /* endless loop : receive multiplicand via SSC, execute multiplication send back result */ while (1) { STB = ssc_receive * mul_factor; while (!TC); ssc_receive = SRB; } }