Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
MrMikey83 said:So..theres no way to use normal input PINS to bring in my PWM signals?
MrMikey83 said:Which command is that Nigel? I took a look at the site, but unless I missed something, only found PWM out info.
~Mike
MrMikey83 said:This morning, I found out that the PWM signal from my radio receiver is only going up to about .7 volts. Is this correct? Do i need to pull it up to 5 volts?
~Mike
MrMikey83 said:My meter can read Pulse width and the output ranges from about 1mS to 2mS.
while (1)
{
if(PWMin == 1)
{
timeUP = TCNT0;
}
else
{
timeDOWN = TCNT0;
}
pulse = (timeDOWN - timeUP) / 500;
printf("|%d|", TCNT0);
printf("%d|", pulse);
printf("%d|", ov_counter);
putchar(13);
delay_ms(300);
};
}
MrMikey83 said:Nigel, So do you think the signal from the receiver is like a PWM where the entire pulse is the same each time except the high is shortened or lengthened...or does it just change frequency all together?
MrMikey83 said:OK, so what do you think is wrong with my code above thats making it not work?
~Mike
while(1)
{
while (PWMin = 0) {} /* wait for input to go high*/
timeUPStart = TCNT0; /* capture the time when the signal when high*/
while (PWMin = 1) {} /* wait for the signal to go low*/
timeUPEnd = TCNT0; /* capture when the pulse goes low*/
Pulse = timeUPEnd - timeUPStart; /*be careful deviding this so you don't end up with 0: 250 / 500 = 0 in integer math*/
}