Well we differ on what we see when looking at the standard signal so I will leave that alone
I measure 1 signal pulse off one channel every 20ms no matter how long the pulse width is.
So say we have a 1.5ms HIGH pulse width. we get a rising edge and high for 1.5ms then for 18.5 its low. then repeats. If the high pulse is 1ms then its low for 19 so the new rising edge is always at the 20ms mark. that make sense? Talking single channel here no reset pulse when channels are done.
The new signal im messing with I can get a pulse that repeats between 5ms and 20ms depending on how long the pulse width is... and the pulse is low.
Hard to explain.
The new one has much longer pulses and they are LOW. (so I guess not really pulses just delays between the 1ms pulse)
Say we have a 10ms pulse... It goes low for 10ms then high for set time think its 1ms. then low to 10ms again. That would make 2 pulses in a 21ms range instead of 2 pulses in a 20ms range. With a 15ms pulse it would equal 2 pulses in a 31ms range.
Maybe im not explaining it correctly but on a standard the rising edge always starts at a set point every 20ms measuring 1 channel.
So basically I am using the freq off the new one and thats working instead of the width. I don't know how else to explain it. If I knew the proper terms maybe it would make more sense lol.
I do have another question tho
On a 4mhz chip how long would this take to add 1 and get back to while?
while GPIO.4=0
Nosig = Nosig + 1
wend
Last edited by geckogrotto; - 27th February 2007 at 04:00.
So, in my world:
one channel, idles low, 1-2 ms high going pulse, repeats every 20ms, no matter the high going pulse width
In your world:
one channel, idles high, 5-20ms low going pulse, repeats every 15-30ms depending on the low going pulse, minimum of 10ms idling high...
Is that good? Sure, you can get a freq off that.
And what I meant by the end result was...what is this whole thing running off of, what's it supposed to do in the end? Is this a new egg frying machine
As far as measuring the time in the above example, one way I do it is to write a program that is only the above example. I label every line. When done, I go back into the generated .lst file, find those labels, and write down the hex address for each label. Most instructions take 1 cycle (ie. 1us @ 4mhz clock rate), jumps, goto's, branches, etc. take 2 cycles (ie. 2us @ 4mhz clock). So, in your example (and I'm guessing here):
while GPIO.4=0 a 'bit test, skip if clear' instruction 1 or 2 cycles depending
Nosig = Nosig + 1 an 'add' instruction, 1 cycle
wend[/QUOTE] a 'jump' or 'goto', should be 2 cycles
So, this could be anywhere from 4 to 5 cycles depending on conditions. However, there are also bank bits to set sometimes if your code goes over code boundaries (not applicable in the 18F world) which will add 1 or 2 cycles. So, now you're at anywhere from 4 to 7 cycles per loop. Best way to figure it out is how I described it earlier. Or use MPLAB's IDE simulator and use the 'stopwatch' function. Or just build a prototype that'll work off it and toggle an led and 'scope those leds for freq.
Ugg I typed up a reply but it didn't get posted.
Basically I get the same results as you do on the standard servo signal and the new results on the new one.
I'm not doing anything amazing or anything just trying to adapt a cheapo Tx Rx to a standard servo signal whoo hoo.
Also thanks for the help on the time, I don't need it that specific so 5us is close enough. Whats a few millionths of a second between friends hehe
Bookmarks