The only way that RB0 can be high is if vLeft is never executed.
I just noticed that you are setting ADCON1 equal to 7, this leaves port A pins as analogue. When configured as analogue they always read zero! Try changing it to ADCON1=0x0f;
The only way that RB0 can be high is if vLeft is never executed.
I just noticed that you are setting ADCON1 equal to 7, this leaves port A pins as analogue. When configured as analogue they always read zero! Try changing it to ADCON1=0x0f;
Btw Mike, I asked my colleague ystd, he mentioned about having a timer that counts quicker than this, so instead of having 1 range (between 14 and 15 also between 15 and 16), I could do something he mentioned, timer and prescaler and with my ext osc I can adjust how much pulses there are to count the Pulse Width or Ton of my PWM Signal.
He tells me that this will increase the accuracy of my light kit, and then.. I have to count also the number of Toff. So it is like double-checking simulation, and logically speaking sum of both two must be the Tperiod which is 16ms from my receiver. So, in order to do so, I will come back later after I read the tuts about timers etc. Hope you will help me again, as always thanks!!!
Someone on my forum did something similar; **broken link removed**
Essentially the signals are servo signals and they are transmitted at around 50Hz (every 20mS). The signal ranges from 1000uS to 2000uS and tells the target servo channel where the servo is meant physically be aligned too
I made up a user library in Swordfish to make things easier for him, and it can be utilized like this;
Code:
Device = 18F2550
Clock = 20
Dim Result1 as Word
Dim Result2 as Word
Include "Pulse.bas"
// Start of main program..
While True
Result1 = PulseIn(0) // read portc.0 for a servo signal pulse
Result2 = PulseIn(1) // read portc.1 for a servo signal pulse
.
.
.
Wend
The result is a value from 0-2000 (the time frame for the period of the servo signal in uS)
It worked really well for him, and he used it to turn LED landing lights/spotlights on and off with his RC plane initially.. after that he went on to use it for something other nifty little ideas (not just R/C plane use)
If your interested then let me know on the thread I linked above, and I will throw it on that forum