gpt4 book ai didi

assembly - FRDM-KL25z 组装延迟循环导致复位

转载 作者:行者123 更新时间:2023-12-03 12:29:12 27 4
gpt4 key购买 nike

我目前正在使用 FRDM-KL25Z 开发板和使用 Keil MDK-lite (5.14a) 进行编程的项目。我们应该做的是使用三个相应的 LED 和一个按钮创建一个简单的交通灯,以加快灯的变化(不像真正的交通灯那样立即进行,而是在每次延迟后检查)。我遇到的问题是我的程序在模拟器中运行良好,但是在开发板上运行时它几乎立即自行重置。我已将其缩小到我正在使用的循环延迟 30 秒。
找出为什么会发生这种情况或如何在调试器中找到更多信息的任何提示都会很棒。

这是我正在使用的循环的剪辑。

reset   LDR R1, =0x00000002     ;Change light to red
BL changelight ;

LDR R3, =0x00000011 ;Put value into counter (1 loop just to show code works)
d30_1 BL buttonpress ;Check for button press
SUBS R3, #17 ;Subtract # of ticks in loop (17) from counter
CMP R3, #0
BGT d30_1

CMP R6, #1 ;Check for button press
BEQ reset ;Reset to red if pressed
LDR R1, =0x00000010 ;Change light to green
BL changelight ;

LDR R3, =0x05B8d800 ;Put value into counter (5 seconds, the board resets when counter is this high)
d30_2 BL buttonpress ;Check for button press
SUBS R3, #17 ;Subtract # of ticks in loop (17) from counter
CMP R3, #0
BGT d30_2
...

这是分支按钮
buttonpress 
LDR R0, =0x400FF090 ;Put address of PORTC_PDIR into R0
LDR R1, [R0] ;Put value of PORTC_PDIR into R1
LDR R0, =0x00000080 ;Put value of monitored input pin
TST R1, R0 ;Check for button press
BNE nopress ;Break from process if button not pressed
MOVS R6, #1 ;Put 1 in R6 if button has been pressed
nopress BX LR

最佳答案

我在调试时检查了重置控制模块 (RCM)。复位的原因可归因于看门狗定时器计算机正常运行 (COP) 超时。我在初始化中添加了以下内容以解决问题。谢谢 Notlikethat。

;Disable watchdog COP timer
LDR R0, =SIM_COPC ;Load address of SIM_COPC to R0
LDR R1, =0x0 ;Disable watchdog COPT
STR R1, [R0] ;

关于assembly - FRDM-KL25z 组装延迟循环导致复位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33987238/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com