完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
嗨,我用的是简易脉冲v1.1,一种通过指尖感应脉冲并输出数字脉冲的传感器。我想创建一个中断,它为持续时间x设置一个定时器,并在每次读取5V的数字脉冲时递增计数器,然后重置计数器并等待持续时间y,然后重复该过程。此外,根据计数的脉冲数,我想控制伺服电机。谢谢您。下面是用于将servo.void main(){TRISB=0x00;//PortB移动为Output的延迟例程,而(1){//Gear 1 if(RB0=1){_.(350);RB0=0;}//Gear 2 if(RB0=1){_.(1330);RB0=0;}//Gear 3 if(RB0=1){.(2150);RB0=0;}}}
以上来自于百度翻译 以下为原文 Hi, I am using easy pulse v1.1, a sensor that senses your pulses through you fingertip and outputs them an digital pulses. I want to create an interrupt that sets a timer for duration x and increment the counter every time it reads a digital pulse of 5V and then resets the the counter and wait for duration y and then repeat the process. Also, according to the number of pulses that were counted, I want to control the servomotor. Thank you. Below is the delay routine for moving the servo. void main (){ TRISB = 0x00; //PortB as Output while(1){ //Gear 1 if (RB0=1) { _delay(350); RB0 = 0; } //Gear 2 if (RB0=1) { _delay(1330); RB0 = 0; } //Gear 3 if (RB0=1) { _delay(2150); RB0 = 0; } } |
|
相关推荐
1个回答
|
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
503 浏览 0 评论
5812 浏览 9 评论
2350 浏览 8 评论
2237 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3544 浏览 3 评论
1159浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1121浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
888浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
503浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-13 22:48 , Processed in 0.670564 second(s), Total 72, Slave 55 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
4657