| Electronic Components Datasheet Search |
|
AN1445 Datasheet(PDF) 2 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1445 Datasheet(HTML) 2 Page - STMicroelectronics |
|
2 / 7 page ![]() 2/7 USING THE ST7 SPI TO EMULATE A 16-BIT SLAVE Figure 2. Data Register Block diagram 2 SOFTWARE Figure 3. C code (COSMIC C Compiler) for the interrupt routine DATA REGISTER INTERNAL BUS MISO MOSI READ REGISTER 8-BIT SHIFT REGISTER @interrupt @nostack void SPI_Interrupt(void) { volatile TwoBytes twobytesDR; if (ValBit(SPISR,SPIF)) // if a byte is received (SPIF=1) + first step to clear int flags { twobytesDR.b_form.low=SPIDR; //1st byte storage while(ValBit(SPISR,SPIF)); twobytesDR.b_form.high=SPIDR; //2nd byte storage } else // then MODF flag caused the interrupt -> add your own code here { SPICR=0xC4; // second step to clear MODF flag: write access to SPICR (init value) } } 2 |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |