EasyManua.ls Logo

ST ST7 - Page 243

ST ST7
317 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
243/317
8 - C Language and the C Compiler
The effect of this + sign is to remove the optimization for this file, that would normally remove
all the unused variable declarations, which would interfere with the allocation of the registers
to the proper addresses.
The header file looks like the excerpt below:
#pragma DATA_SEG SHORT TIMERA
/* timer A control register 2 */
extern volatile unsigned char TACR2;
/* timer A control register 1 */
extern volatile unsigned char TACR1;
/* timer A status register */
extern volatile unsigned char TASR;
/* timer A input capture 1 high register */
extern volatile unsigned char TAIC1HR;
/* timer A input capture 1 low register */
extern volatile unsigned char TAIC1LR;
/* timer A output compare 1 high register */
extern volatile unsigned char TAOC1HR;
/* timer A output compare 1 low register */
extern volatile unsigned char TAOC1LR;
/* timer A counter high register */
extern volatile unsigned char TACHR;
/* timer A counter low register */
extern volatile unsigned char TACLR;
/* timer A alternate counter high register */
extern volatile unsigned char TAACHR;
/* timer A alternate counter low register */
extern volatile unsigned char TAACLR;
/* timer A input capture 2 high register */
extern volatile unsigned char TAIC2HR;
/* timer A input capture 2 low register */
extern volatile unsigned char TAIC2LR;
/* timer A output compare 2 high register */
extern volatile unsigned char TAOC2HR;
/* timer A output compare 2 low register */
extern volatile unsigned char TAOC2LR;
(.....)
/* Timers A&B Control Register 2 bit definition */
#define OC1E 0x07 // Output compare 1 pin
#define OC2E 0x06 // Output compare 1 pin
#define OPM 0x05 // One pulse mode
#define PWM 0x04 // PWM Mode
#define IEDG2 0x01 // Input edge 2
/* Timers A&B Status Register bit definition */
#define ICF1 0x07 // input capture interrupt bit
#define OCF1 0x06 // output capture interrupt bit
#define TOF 0x05 // overflow interrupt bit
#define ICF2 0x04 // input capture interrupt bit
#define OCF2 0x03 // output capture interrupt bit

Table of Contents

Related product manuals