| Electronic Components Datasheet Search |
|
AN1105 Datasheet(PDF) 34 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1105 Datasheet(HTML) 34 Page - STMicroelectronics |
|
34 / 100 page ![]() 34/100 ST7 pCAN PERIPHERAL DRIVER CAN_Buffer periodic_transmission; In the TIMA_Init() function, make sure the following lines are included: TACR1=0x40 TACR2=0x08 TAOC1HR=0x3A TAOC1LR=0x98 and finally, #asm LD _TAOC2HR,A; /* Write the Output Compare 2 high register to disable the OC2 */ LD A,_TASR /* Clear the flags in case it is already set. To Clear */ LD A,_TAOC1LR /* OC1F flag: Read Status Register and Access OC1R low byte, clearing OC1F flag */ LD A,_TAOC2LR /* OC2F flag: Read Status Register and Access OC2R low byte,clearing OC2F flag*/ LD _TAOC2HR,A//No access to low byte: OutputCompare 2 ITs disabled #endasm Note: The explanation of the code written here concerns timer programming and is beyond the scope of this document. Its purpose is to configure timer A to trigger a timer interrupt every 15 ms. Further explanations of timer functions can be found in the microcontroller datasheet. Then we have to fill in the IT function of the timer: void TIMA_Interrupt(void) { u16 output_value; if (ValBit(TASR,OCF1)) { TASR; output_value = ((unsigned int)TAOC1HR << 8)| TAOC1LR; } output_value += 0x3A98; TAOC1HR = output_value >>8; TAOC1LR = (unsigned char) output_value; //Note: The code above is only meant to update the value for the next IT //Now comes the code that interests us if (!periodic_transmission.message_in_queue) //Checks if the message is already //in the transmission queue { periodic_transmission.msg_identifier=0x4020; periodic_transmission.data_size=DLC1; periodic_transmission.CAN_Msg_data[0]=ADC_Get(0x00); |
|
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 |