1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,
我想用STM8S003K3的timer2实现衰落的LED。要求不是使用默认的PWM输出引脚而是使用普通的GPIO引脚。所以我想使用更新和比较TIM2的中断功能来写入普通GPIO引脚的高电平和低电平。这个想法类似于默认的PWM输出,但只是手动改变中断功能中GPIO的输出电平。 我的问题是为什么我只能找到1个TIM2捕获/比较中断函数映射与IRQ no。 14(IRQ no.15和16保留)。有3个TIM2通道,这意味着必须有3个独立中断功能。我可以使用保留的IRQ号码。用于中断功能? 这是STM8S0003K / F3的手册: http://www.st.com/content/ccc/resource/technical/document/datasheet/42/5a/27/87/ac/5a/44/88/DM00024550.pdf/files/DM00024550.pdf/jcr:内容/翻译/ en.DM00024550.pdf 在第7章中,您可以找到中断向量映射。 提前致谢。 博 #stm8s-interrupt#capture-compare 以上来自于谷歌翻译 以下为原文 Hi all, I would like to realize the fading LED using timer2 of STM8S003K3. The requirement is not to use the default PWM output pin but the normal GPIO pin. So I want to use the update and compare interrupt functions of TIM2 to write High and Low of the normal GPIO pins. The idea is similar to the default PWM output but just manually change the output level of the GPIO in the interrupt function. My question is why I can only find 1 TIM2 capture/compare interrupt function mapping with IRQ no. 14 (IRQ no.15 and 16 are reserved). There are 3 TIM2 channels which means there must be 3 independt interrupt functions. May I use the reserved IRQ no. for the interrupt functions? Here is the handbook of STM8S0003K/F3: http://www.st.com/content/ccc/resource/technical/document/datasheet/42/5a/27/87/ac/5a/44/88/DM00024550.pdf/files/DM00024550.pdf/jcr:content/translations/en.DM00024550.pdf In chapter 7, you can find the interrupt vector mapping. Thanks in advance. Bo #stm8s-interrupt #capture-compare |
|
相关推荐
4个回答
|
|
>>
有3个TIM2通道,这意味着必须有3个独立的中断功能。为什么?你不能使用TIM2_SR1来区分源并相应地处理/分配吗? http://www.st.com/content/ccc/resource/technical/document/reference_manual/9a/1b/85/07/ca/eb/4f/dd/CD00190271.pdf/files/CD00190271.pdf/jcr:内容/翻译/ en.CD00190271.pdf 以上来自于谷歌翻译 以下为原文 >> There are 3 TIM2 channels which means there must be 3 independent interrupt functions.Why? Can't you differentiate the source using TIM2_SR1 and handle/dispatch accordingly? http://www.st.com/content/ccc/resource/technical/document/reference_manual/9a/1b/85/07/ca/eb/4f/dd/CD00190271.pdf/files/CD00190271.pdf/jcr:content/translations/en.CD00190271.pdf |
|
|
|
因此,如果我启用所有3个通道的捕获/比较中断,哪个通道将调用中断功能? Ofc我可以读取相应的TIM2_SR1标志来检查是否发生了相应的中断。
因为我的代码很大而且衰落的LED需要快速的响应时间,所以我想使用中断函数来响应比较中断,只要它发生,而不是等待检查标志的代码行。 我是否正确理解比较中断和中断功能?非常感谢。 博 以上来自于谷歌翻译 以下为原文 So if I enable the capture/compare interrupt of all 3 channels, which channel will invoke the interrupt function? Ofc I can read the corresponding TIM2_SR1 flag to check if the corresponding interrupt has occured. Because my code is large and the fading LED needs fast response time, I want to use the interrupt function to react to the compare interrupt as long as it occurs, instead of waiting for the code line where the flag is checked. Do I understand the compare interrupt and the interrupt function correctly? Thanks very much. Bo |
|
|
|
>>
因此,如果我启用所有3个通道的捕获/比较中断,哪个通道将调用中断功能? 所有这些都将使用相同的中断,使用if语句检查状态寄存器中的位,并快速处理每个可能的源,然后离开中断处理程序。 即 void TIM2_IRQHandler(void) { 如果(CC1) { } 如果(CC2) { } 如果(CC3) { } } 以上来自于谷歌翻译 以下为原文 >> So if I enable the capture/compare interrupt of all 3 channels, which channel will invoke the interrupt function? All of them will use the same interrupt, use an if statement to check the bit in the status register, and quickly handle each possible source, and then leave the interrupt handler. ie void TIM2_IRQHandler(void) { if (CC1) { } if (CC2) { } if (CC3) { } } |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2723 浏览 1 评论
3237 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1807 浏览 1 评论
3646 浏览 6 评论
6034 浏览 21 评论
1334浏览 4评论
209浏览 3评论
197浏览 3评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
350浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
442浏览 2评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-21 19:35 , Processed in 1.320644 second(s), Total 84, Slave 68 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号