Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This experiment uses the HDMI display and timer counter function of the Plus1 7021 platform to introduce the basic programming method, which involves interrupt use. The Plus1 7021 system provides four general-purpose 16-bit count timers, timer0 to timer3. When the preset value is reached, the corresponding interrupt signal is generated by each timer。

...

The corresponding 32-bit registers are described in detail, please refer to the online technical documentation provided as follows:

10. General Purpose Timers

Here is a brief introduction to the meaning of related registers, as shown in the following table:

...

The regmap_q628.h under the installation directory \SP7021\workspace\sp7021\ include folder defines these four registers, as marked in red below:

regmap_q628.h

struct stc_regs {

    unsigned int stc_15_0;       // 12.0

    unsigned int stc_31_16;      // 12.1

    unsigned int stc_64;         // 12.2

    unsigned int stc_divisor;    // 12.3

    unsigned int rtc_15_0;       // 12.4

    unsigned int rtc_23_16;      // 12.5

    unsigned int rtc_divisor;    // 12.6

    unsigned int stc_config;     // 12.7

    unsigned int timer0_ctrl;    // 12.8 Timer Register

    unsigned int timer0_cnt;     // 12.9 Timer Register

    unsigned int timer1_ctrl;    // 12.10 Timer Register

    unsigned int timer1_cnt;     // 12.11 Timer Register

    unsigned int timerw_ctrl;    // 12.12

    unsigned int timerw_cnt;     // 12.13

    unsigned int stc_47_32;      // 12.14

    unsigned int stc_63_48;      // 12.15

    unsigned int timer2_ctl;     // 12.16 Timer Register

    unsigned int timer2_pres_val;// 12.17 Timer Register

    unsigned int timer2_reload;  // 12.18 Timer Register

    unsigned int timer2_cnt;     // 12.19 Timer Register

    unsigned int timer3_ctl;     // 12.20 Timer Register

    unsigned int timer3_pres_val;// 12.21 Timer Register

    unsigned int timer3_reload;  // 12.22 Timer Register

    unsigned int timer3_cnt;     // 12.23 Timer Register

    unsigned int stcl_0;         // 12.24

    unsigned int stcl_1;         // 12.25

    unsigned int stcl_2;         // 12.26

    unsigned int atc_0;          // 12.27

    unsigned int atc_1;          // 12.28

    unsigned int atc_2;          // 12.29

    unsigned int timer0_reload;  // 12.30 Timer Register

    unsigned int timer1_reload;  // 12.31 Timer Register

};

#define STC_REG     ((volatile struct stc_regs *)RF_GRP(12, 0))

...