完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,SMT设置为门控计数器模式,信号输入连接到比较器输出,窗口连接到逻辑单元。所有输入都用示波器检查,但是SMT计数器总是0。怎么了?MCC生成的SMT init:void SMT1_Initialize(void){//WPOL高/上升沿启用;STP翻转到24'h000000;SPOL高/上升沿启用;EN启用;SMT1PS 1:1预分频器;CPOL上升沿;SMT1CON0=0x80;//SMT1REPEAT重复数据获取;SMT1MODE门控计数器;SMT1GO禁用;SMT1CON1=0x49;//SMT1CPWUPSMT1CPELC1_OUT_OUT_OUT_sync;SMT1SIG=0x01;//SMT1CPRUPSMT1CPRUPSMT1CPRUPSMT1T1T1T1PR0;SMT1CPRUPSMT1T1CPRUPSMT1T1PR更新完成;RST1SMT1STAT1STAT1STAT1T1T1T1T1T1R1UPSMT1T1T1T1T1T1RR1更新完成;SMT1STASTASTAT1STAT1STAT1STAT=0X00;//SMT1STASTASTASTASTASTASTASTASTASTASTAT1STAT;SMT1CLT1CLT1CLCSELFOSC;//SMT1CLT1CLT1CLT1CLT1CLT1CLC1OUK=0x00;//SMT1T1CLT1CLT1CLT1CLT1CLSMT1PR 0;SMT1PRH=0x00;//SMT1PR 0;SMT1PRL=0x00;/ /启用SMT1脉冲宽度获取中断。PIE4BITS.SMT1PWAIE=1;//通过写入SMTXGO位SMT1CON1BITS.SMT1GO=1启动SMT模块;} THX,Bela
以上来自于百度翻译 以下为原文 Hi, SMT set up to gated counter mode, Signal In connected to comparator out, Window connected to logic cell. All input checked with oscilloscope, but SMT counter always 0. What a wrong? MCC generated SMT init: void SMT1_Initialize(void) { // WPOL high/rising edge enabled; STP rolls over to 24'h000000; SPOL high/rising edge enabled; EN enabled; SMT1PS 1:1 Prescaler; CPOL rising edge; SMT1CON0 = 0x80; // SMT1REPEAT Repeat Data Acquisition; SMT1MODE Gated counter; SMT1GO disabled; SMT1CON1 = 0x49; // SMT1CPWUP SMT1CPW1 update complete; SMT1CPRUP SMT1PR1 update complete; RST SMT1TMR1 update complete; SMT1STAT = 0x00; // SMT1CSEL FOSC; SMT1CLK = 0x00; // SMT1WSEL CLC1OUT; SMT1WIN = 0x09; // SMT1SSEL C1_OUT_sync; SMT1SIG = 0x01; // SMT1PR 0; SMT1PRU = 0x00; // SMT1PR 0; SMT1PRH = 0x00; // SMT1PR 0; SMT1PRL = 0x00; // Enabling SMT1 pulse width acquisition interrupt. PIE4bits.SMT1PWAIE = 1; // Start the SMT module by writing to SMTxGO bit SMT1CON1bits.SMT1GO = 1; } Thx, Bela |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
5171 浏览 9 评论
2001 浏览 8 评论
1931 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3176 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2228 浏览 5 评论
737浏览 1评论
622浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
509浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
635浏览 0评论
533浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-26 01:16 , Processed in 1.230695 second(s), Total 78, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号