I was not thinking. I am already using PULSIN to measure the echo from the sonar pinging. My code goes round and round. All I want is the signal from channel 3 on the RC receiver that toggles from RC control to PIC control and visa versa.
ken
I was not thinking. I am already using PULSIN to measure the echo from the sonar pinging. My code goes round and round. All I want is the signal from channel 3 on the RC receiver that toggles from RC control to PIC control and visa versa.
ken
Hey Ken,
It sounds like the car moves pretty fast!
I'm not really familiar with RC car drive mechanisms. Is the motor connected to the wheels directly, or with belts or gears.. or?
Is there a way to change the gearing to make the top speed more manageable for your purpose? Or maybe run the motor on a lower voltage to mellow it out a bit and slow things down?
As far as the PIC resetting, it would be helpful to see a schematic of your circuitry. Got voltage regulators for your PIC?
You should probably have a fairly large electrolytic capacitor (maybe a few hundred to a couple thousand uF) in parallel with one or more ceramic caps of .001 to .1 uF placed fairly close to your PIC as well as on the input side of your regulator if you've got a motor running on the same battery as your PIC.
And probably a .001uF cap across right across the motor terminals would be beneficial as well?
DC motors can generate a lot of noise and trash as well as draw large current surges that can drop the battery voltage below "acceptable" levels.
Got a schematic of your PIC and motor drive circuitry to refresh our memory?
Sound like you're making good progress!
steve
Another reset culprit is stack overflow. If you have too many nested gosubs, or gosubs without returns, the PIC will reset.
Today I took the proto to Main Street. We have a park that is surrounded by an old (Victorian?) cast iron fence seated in a straight curb that runs next to the sidewalk. A perfect spot to test Proto's ability to follow a wall.
It did very well. In that environment I could run and keep up
So, feeling confident, I took it to a store front that had inset entrance doors. It could follow the in going wall below the plate glass then turn left when it got to the doors themselves.
WRONG! It did not turn at all. It crashed straight into the right hand glass door.
Then it stopped working correctly. It behaved very strangely. NUTS.
Seven hours later I realized the impact had moved the forward looking proximity sensor. It was now reacting to that thing-a-ma-gig to which the 'C' clip is attached for holding on the plastic car body.
I had not calibrated the numeric proximity sensor responses relative to the speed of the car. I have now more than doubled the "WATCHOUT" threshold for the front facing sensor.
Technical question. How many nested subroutines brings down the code. Any idea?
Ken
I have forgotten most everything I ever knew about v=iR.
Is there any reason that you all can recall why I should not just put the a digital 16F887 output pin directly into one of the input lines of the SN7407N?
Ken
How does HPWM work when the pulses are set for 50 per second (20msec) period and the code loops more quickly than that. ie the next HPWM command happens before the last one got a chance to count out the 20 msec.
Is it obvious if I study the ASM code? I wish I could find a compact library so I could read ASM easily.
Ken
The hardware parts of the PIC run independant of the code.
That is one of the reasons we use interrupts. Gives the code a chance to see what the hardware is doing.
I do not think reading ASM will help much. The chip does not really care about the language.
Dave
Always wear safety glasses while programming.
I don't know if I understand the question. To set HPWM at 20ms, you need to slow your pic down to 0.5 Mhz (if you are using the hardware PWM). But then you only get about 32 different settings from 1ms to 2ms. Maybe you are asking what happens to the servo when you send the 1.5ms pulses quicker than 50 hertz?
How are you doing it Ken?
Last edited by ScaleRobotics; - 10th March 2010 at 05:04.
Bookmarks