32位8051的 T0/T1/T2/T3/T4 都是 24位定时器,8位预分频+16位自动重装载
32位8051 的 T0/T1/T2/T3/T4 都是 24位定时器,8位预分频 +16位自动重装载
要允许访问 XFR
深圳国芯人工智能有限公司-工具软件 (stcai.com)
void Timer0_Isr(void) interrupt 1
{
}
void Timer0_Init(void) //2秒@24.000MHz
{
TM0PS = 0x3D; //设置定时器时钟预分频 ( 注意:并非所有系列都有此寄存器,详情请查看数据手册 )
AUXR &= 0x7F; //定时器时钟12T模式
TMOD &= 0xF0; //设置定时器模式
TL0 = 0xFC; //设置定时初始值
TH0 = 0x03; //设置定时初始值
TF0 = 0; //清除TF0标志
TR0 = 1; //定时器0开始计时
ET0 = 1; //使能定时器0中断
}
要允许访问 XFR
启动下图中的 8位预分频,就是 24位定时器
深圳国芯人工智能有限公司-产品_STC32系列 (stcai.com)
启动下图中的 8位预分频,就是 24位定时器
启动下图中的 8位预分频,就是 24位定时器
启动下图中的 8位预分频,就是 24位定时器
启动下图中的 8位预分频,就是 24位定时器
TM0PS 在哪查看? 前行者 发表于 2024-9-28 22:09
TM0PS 在哪查看?
24位定时器 + 定时器时钟12T模式 ---> 27.5位定时器???
STC8H系列,也开始配置 24位定时器了:
https://www.stcaimcu.com/data/download/Datasheet/STC8H.pdf
Using 8051U and 24 bit timer question.
Using TM0PS for a very slow tick, and Timer0 in 8-but auto-reload mode, can this 8048 emulation code work, it needs live run-time reading and update of TL0 register.
MOV A,TL0
ADD A,R0
MOV TL0,A; SW advance TL0
W059E:
MOV A,TL0
MOV R1,A
W05A0:
MOV A,TL0
XRL A,R1
JZ W05A0; waits one tick
Is that code ok in 8051U 8-bit reload mode ? (TH0 unused = 0), to then match timer in the very old 8048.
There is mention of RL_TL0, but that only exists in 16 bit reload, and does not exist in 8 bit reload, correct?
Will Run time change as done in code above of TL0 work ok ?
页:
[1]