AN1105 STMicroelectronics, AN1105 Datasheet - Page 35

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
//We have given a transmission order here, that will be called on every
//timer IT if the message is not already in the transmission queue.
//The data is filled each time with the value of the A/D converter data
//register. For info. about the ADC, please see the datasheet.
}
IMPORTANT: Please note that WHEN USED OUTSIDE AN INTERRUPT ROUTINE, AND
ONLY THEN, the transmission request MUST NOT BE INTERRUPTED. So, disable all ITs
before a function call (SIM) and re-enable them afterwards (RIM) in the last step of the main.c
file.
In the adc.c file, enter also the following code:
In the ADC_Init routine:
ADCCSR=0x20;//Starts the ADC peripheral
and write a function:
u8 ADC_Get(u8 channel)
{
ADCCSR |= channel;
return ADCDR;
}
Our application is almost entirely written now. Our last step is to fill the main.c file, to allow the
entire program to run.
At the beginning of the file add:
#include “lib.h“
#include “adc.h“
#include “tima.h“
#include “can.h“
#include “can_custom.h”
Then complete the main function as follows:
void main(void)
{
_asm(“SIM”); //Disable interrupts
/*
/*------------------- I N I T I A L I S A T I O N -------------------------*/
/*
CAN_Transmit_Request(&periodic_transmission);
}
-----------------------------
-----------------------------
ST7 pCAN PERIPHERAL DRIVER
*/
*/
35/100

Related parts for AN1105