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。

...

 

Control Register

Counting controller

Counting clock preprocessing controller

Counting value controller

 

 

 

 

 

 

 

Timer0

timer0_ctrl

bit[31:16]Reserved

bit[15:14] :Timer clock selection

0: System clock (default)

1: STC 90KHZ clock

bit13 :Operation method

0:Single operation (default)

1:Repeat the operation

bit12 : Reserved

bit11 :Switch control

0:Turn off the counter

1:Start counter

bit[10:0] :Reserved

timer0_reload

bit[31:16]保留Reserved

bit[15:0]

16位计数预值设置16-bit count preset value setting

 

 

timer0_cnt

bit[31:16]保留Reserved

bit[15:0]

16位计数值16-bit count value

 

 

 

 

 

 

 

 

timer1

timer1_ctrl

bit[31:16]保留Reserved

bit[15:14] :计数时钟选择 :Timer clock selection

0: 系统时钟System clock (default)

1: STC 90KHZ 时钟clock

bit13 :操作方式 :Operation method

0:单次操作0:Single operation (default)

1:重复操作

bit12保留Reserved

bit11 :开关控制

0:关闭计数器

1:启动计数器

bit[10:0] :保留 :Reserved

timer1_reload

bit[31:16]保留Reserved

bit[15:0]

16位计数预值设置16-bit count preset value setting

 

 

timer1_cnt

bit[31:16]保留Reserved

bit[15:0]

16位计数值16-bit count value

 

 

 

 

 

 

timer2

timer2_ctrl

bit[31:6]保留Reserved

bit[5:2] :计数时钟选择 :Timer clock selection

0: 系统时钟System clock (default)

1: STC 90KHZ 时钟clock

bit1 :操作方式 :Operation method

0:单次操作(default)

1:重复操作

bit1保留Reserved

bit0 :开关控制

0:关闭计数器

1:启动计数器

timer2_reload

bit[31:16]保留

bit[15:0]

16位计数预值设置16-bit count preset value setting

 

timer2_pres_val

bit[31:16]保留

bit[15:0]

16位计数时钟预值设置

 

timer2_cnt

bit[31:16]保留

bit[15:0]

16位计数值16-bit count value

 

 

 

 

 

 

timer3

timer3_ctrl

bit[31:6]保留Reserved

bit[5:2] :计数时钟选择 :Timer clock selection

0: 系统时钟System clock (default)

1: STC 90KHZ 时钟clock

bit1 :操作方式 :Operation method

0:单次操作(default)

1:重复操作

bit1保留Reserved

bit0 :开关控制

0:关闭计数器

1:启动计数器

timer3_reload

bit[31:16]保留

bit[15:0]

16位计数预值设置16-bit count preset value setting

 

timer3_pres_val

bit[31:16]保留

bit[15:0]

16位计数时钟预值设置

 

timer3_cnt

bit[31:16]保留

bit[15:0]

16位计数值16-bit count value

 

安装目录 \SP7021\workspace\sp7021\include 文件夹下的regmap_q628.h定义了这四个寄存器,如下图红色:

...

    unsigned int stc_config;     // 12.7

    unsignedint timer0_ctrl;    // 12.8

    unsignedint timer0_cnt;     // 12.9

    unsignedint timer1_ctrl;    // 12.10

    unsignedint timer1_cnt;     // 12.11

    unsigned int timerw_ctrl;    // 12.12

...

    unsigned int stc_63_48;      // 12.15

   unsignedint timer2_ctl;     // 12.16

    unsignedint timer2_pres_val;// 12.17

    unsignedint timer2_reload;  // 12.18

    unsignedint timer2_cnt;     // 12.19

    unsignedint timer3_ctl;     // 12.20

    unsignedint timer3_pres_val;// 12.21

    unsignedint timer3_reload;  // 12.22

    unsignedint timer3_cnt;     // 12.23

    unsigned int stcl_0;         // 12.24

...

    unsigned int atc_2;          // 12.29

    unsignedint timer0_reload;  // 12.30

    unsignedint timer1_reload;  // 12.31

};

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

...