Skip to main content
Visitor II
October 21, 2004
Question

How do use STVD7 Head files ???

  • October 21, 2004
  • 2 replies
  • 810 views
Posted on October 21, 2004 at 09:42

How do use STVD7 Head files ???

    This topic has been closed for replies.

    2 replies

    hongluoAuthor
    Visitor II
    October 21, 2004
    Posted on October 21, 2004 at 07:11

    Hello all:

    I'm a beginner.

    I want to use the head file in ''C:\Program Files\STMicroelectronics\st7toolset\include\ST72F324J6.h''.

    But I don't know how do go to use,especial following code:

    /* System Integrity Control/Status Register */

    STVD7_EXTERN volatile unsigned char SICSR @0x2b;

    define SICSR_WDGRF 0 /* Watchdog Reset Flag */

    define SICSR_WDGRF_OR (1 << SICSR_WDGRF)

    define SICSR_LVDRF 4 /* LVD Reset Flag */

    define SICSR_LVDRF_OR (1 << SICSR_LVDRF)

    define SICSR_AVDF 5 /* Voltage Detector Flag */

    define SICSR_AVDF_OR (1 << SICSR_AVDF)

    define SICSR_AVDIE 6 /* Voltage Detector Interrupt */

    define SICSR_AVDIE_OR (1 << SICSR_AVDIE)

    define SICSR_AVDS 7 /* Voltage Detection Selection */

    define SICSR_AVDS_OR (1 << SICSR_AVDS)

    could anybody help me,please?

    Visitor II
    October 21, 2004
    Posted on October 21, 2004 at 09:42

    Here is an example using the ADC of the ST7Lite09. I hope it is clear enough.

    Best regards.

    /* ---------------------- (c) 2003 STMicroelectronics ------------------- */

    /*********************************************************/

    /* This program uses the ST7FLITE09. It configures the ADC to convert on */

    /* channel AIN1 (PB1), scales the value read on 4 bits and sends the result */

    /* on PA0/1/2/3. */

    /* With the simulator, use the ADC_Stimuli.in file as input stimuli and plot */

    /* the AdcValue variable, PA0/1/2/3 and PB1 pins, run the simulator and */

    /* visualize the results with the plotter. */

    /****************************************************/

    /* Include file provided by STVD7 describing the registers mapping. */

    #define __DEFINE_REGISTERS_STVD7_INCLUDE__

    #include

    #undef __DEFINE_REGISTERS_STVD7_INCLUDE__

    /* Define Macros for bit manipulation. */

    #define SetBit(VAR,BIT_NUM) ( (VAR) |= (1<

    #define ClrBit(VAR,BIT_NUM) ( (VAR) &= ((1<

    #define ValBit(VAR,BIT_NUM) ( (VAR) & (1<

    #define BitIsClear(VAR,BIT_NUM) ( 0 == ValBit(VAR,BIT_NUM) )

    #define BitIsSet(VAR,BIT_NUM) ( !BitIsClear(VAR,BIT_NUM) )

    /* Global variable */

    unsigned char AdcValue;

    /*******************************************************/

    void main(void)

    {

    /* Configures port A0/1/2/3/4 as output. */

    PADDR = 0x1F;

    PAOR = 0x1F;

    PADR = 0x00;

    /* Enables the ADC on AIN1. */

    ADCCSR = ( ADCCSR_ADON_OR | ADCCSR_CH0_OR );

    while(1)

    {

    /* Waits for the end of the conversion. */

    while(BitIsClear(ADCCSR, ADCCSR_EOC));

    /* Reads the A/D value. */

    AdcValue = ADCDR;

    /* Divide it in order to have it on 5 bits */

    /* and writes it on the PortA. */

    PADR = AdcValue >> 3;

    /*******************************/

    }

    }