找回密码
 立即注册
楼主: beishen2009

求教 用 11F60XE 直接替换掉 89C516之后 程序异常不断重启 而且 引脚之间互相

[复制链接]
  • 打卡等级:初来乍到
  • 打卡总天数:4
  • 最近打卡:2025-05-01 06:58:22

5

主题

184

回帖

1335

积分

金牌会员

积分
1335
发表于 2024-9-13 10:30:24 | 显示全部楼层
beishe*** 发表于 2024-9-12 08:37
现在可以断定是出在定时器上面 还不知道如何兼容 89c51rd+的 定时器代码 请问有知道的大哥吗 ...

You need to drill into the details.  Which timer(s) do you use ?


截图202409131027231696.jpg



截图202409131028009571.jpg



截图202409131030187331.jpg









回复 支持 反对

使用道具 举报 送花

5

主题

33

回帖

97

积分

注册会员

积分
97
发表于 2024-9-13 10:56:30 | 显示全部楼层
本帖最后由 beishen2009 于 2024-9-13 10:59 编辑

定时器0工作方式1 啊 大哥 求指教啊

void T0_time() interrupt 1        

main(){



TMOD=0X01;                                                //设置定时器0工作方式1
TH0=(65536-50000)/256;                        //重装值,12MHz定时50ms的数值为50000
TL0=(65536-50000)%256;
EA=1;                                                        //开总中断
ET0=1;
外while(1){}

}

回复 支持 反对

使用道具 举报 送花

  • 打卡等级:初来乍到
  • 打卡总天数:4
  • 最近打卡:2025-05-01 06:58:22

5

主题

184

回帖

1335

积分

金牌会员

积分
1335
发表于 2024-9-13 12:29:53 | 显示全部楼层
本帖最后由 jmg 于 2024-9-13 12:57 编辑
beishe*** 发表于 2024-9-13 10:56
定时器0工作方式1 啊 大哥 求指教啊

void T0_time() interrupt 1        

What code is inside your T0 interrupt ?
How close is the interrupt to working ?  If you have 12MHz SysCLK and the correct /12 prescaler, you should have 50ms ?

I am looking at STC8H series, as that is a more modern choice. Because you need to make small changes anyway, it is best to move to cheapest/newest, at the same time.

You are using mode 01, which should be ok, but there is a better reload mode = 00, that does not need interrupt re loading at all.
STC8H:
截图202409131223318213.jpg


Note the reload registers RL_TH0, RL_TL0, need TR0 = 0 to access them, then you set TR0 = 1 after they are loaded.

A quick easy test is to toggle a pin inside the interrupt with simple test code initially.
Note the STC8H has CLKDIV and the STC11F has CLK_DIV that are defined at ISP program time, and the default PORT RESET mode is different.


Addit: If you want the old 8051 pinout, the STC8H will not fit, so the STC11 is better choice. You should define CLK_DIV and RST pin features for STC11
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:初来乍到
  • 打卡总天数:4
  • 最近打卡:2025-05-01 06:58:22

5

主题

184

回帖

1335

积分

金牌会员

积分
1335
发表于 2024-9-13 12:58:10 | 显示全部楼层
本帖最后由 jmg 于 2024-9-13 13:05 编辑

You should also look at the SFR maps



截图202409131300215469.jpg

Note CLK_DIV for SYSCLK and P0M0, P0M1 etc set port behaviors.

I think the default POR values [00] ​​are standrd 8051 BiDirectional port ?
截图202409131258017388.jpg
回复 支持 反对

使用道具 举报 送花

5

主题

33

回帖

97

积分

注册会员

积分
97
发表于 2024-9-13 20:04:21 | 显示全部楼层
谢谢啊  我再试试啊
回复 支持 反对

使用道具 举报 送花

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|深圳国芯人工智能有限公司 ( 粤ICP备2022108929号-2 )

GMT+8, 2025-5-3 17:19 , Processed in 0.130690 second(s), 76 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表