Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.NET

X  

AN1105 Datasheet(PDF) 34 Page - STMicroelectronics

Part # AN1105
Description  ST7 pCAN PERIPHERAL DRIVER
PDF  100 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN1105 Datasheet(HTML) 34 Page - STMicroelectronics

Back Button AN1105 Datasheet HTML 30Page - STMicroelectronics AN1105 Datasheet HTML 31Page - STMicroelectronics AN1105 Datasheet HTML 32Page - STMicroelectronics AN1105 Datasheet HTML 33Page - STMicroelectronics AN1105 Datasheet HTML 34Page - STMicroelectronics AN1105 Datasheet HTML 35Page - STMicroelectronics AN1105 Datasheet HTML 36Page - STMicroelectronics AN1105 Datasheet HTML 37Page - STMicroelectronics AN1105 Datasheet HTML 38Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 34 / 100 page
background image
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);



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100


Datasheet Download

Go To PDF Page


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


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
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