AN1105 STMicroelectronics, AN1105 Datasheet - Page 36

no-image

AN1105

Manufacturer Part Number
AN1105
Description
ST7 PCAN PERIPHERAL DRIVER
Manufacturer
STMicroelectronics
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
AN1105W-12-RR
Quantity:
13 804
Part Number:
AN1105W-22-RR
Manufacturer:
SANYO
Quantity:
8 570
Part Number:
AN1105W-TR
Manufacturer:
PANASONIC
Quantity:
27 995
Part Number:
AN1105W-TR
Manufacturer:
STANLEY
Quantity:
20 000
ST7 pCAN PERIPHERAL DRIVER
ADC_Init();
if ((CAN_First_Init())==CAN_INIT_FAILURE) //Initializes the CAN peripheral
TIMA_Init();//Initializes the timer
_asm(“RIM”);// EnableInterrupts;
Finished! Now compile the entire code and run the software. Once the while {1} loop is en-
tered, the microcontroller will run non-stop until it is shut down, reacting to every event, saving
data in our buffer, sending data periodically and answering remote requests.
If you own a CAN bus simulation tool, you can monitor messages being received and sent by
the ST7.
The next section of this application note will explain in detail the driver architecture and all soft-
ware functions (including internal functions).
2.2.5 IMPORTANT: Reentrant Functions
If the memory model you chose for compiling your application does not use the physical stack
but simulates it in RAM, you CANNOT allow functions to be reentrant.
The COSMIC compiler will generate an error if it finds some code that could be reentrant. For
example, this may occur if you use a subroutine inside both an initialization function and an in-
terrupt routine.
This is, of course, not a real error, but the compiler does not know this and prevents you from
going further.
To fix this problem with the COSMIC compiler, use the following trick:
– Change the name of the function in your code, in the call that makes the error appear.
36/100
}
/*
/*----------------------------
while (1) /*
{
}
{
}
return;
//Initializes the ADC
-------------------
-------------------
LOOP
--------------------------*/
*/
*/

Related parts for AN1105