Another thing you could do, is ICD compile it in micro code studio (for something like a PIC16f876a) and run it to see where it is getting stuck. Of course, you would need a serial port, and a PIC16f876a laying around to test it that way.
It would show you step by step, or animated, something like this:
Walter
You all suspected my usage of PULSIN.
You were correct.
To determine whether to take control itself or let the radio receiver do its thing, my PIC must read the PWM code from the radio receiver channel 3. That PWM comes in only fifty times per second.
I was asking PULSIN to measure that pulse without setting an interrupt for when it sees a rising edge. What are the chances of my PULSIN moment (plus delay waiting according to pulsin_max) seeing something happening only 50 times per second. Answer, not good.
What are the chances of my PIC seeing that pulse when the radio transmitter is not powered? None whatsoever!
So: When testing my car up on blocks in my "lab" and not remembering to turn on my radio transmitter the poor thing spends 99% its time waiting for a pulse that never arrives.
Yep. Turn on the transmitter (even with channel 3 in the autonomous control position) and my SRF05 blinkers flash like crazy. They are being continuously triggered.
I still have a problem with response time, but it is not because the PIC is lacking sensor information.
Ken
I don't think I have changed anything other than remove confusing comments.
Ken
Part of the reason my car keeps hitting the wall is that it is responding too slowly for the speed it is traveling.
Today I carefully calibrated my HPWM 2,xxx,50 commands.
If xxx = 110 the car does not move.
If xxx = 111 the car moves forward, but only on a non-carpeted floor.
If xxx = 112 the car moves forward forcefully but not too fast
xxx = 115 is too fast for my code.
xxx = 125 is full speed which is very fast.
Ken
Here's a video of our car running a hall in our house.
http://video.yahoo.com/watch/7164676/18657928
I moved the front sonic sensors closer to the front of the car and I figured out how to slow down the wheels a bit.
Next thing, I think, is to build a better looking and stronger prototype using a car with more room to attach stuff. What other kinds of sensors should I try and what other kinds of tasks will they help the PIC do?
Again, thank you for all your interest and help.
Ken
Looking good Ken!
Other sensors...
IR - Probably not do much better than the sonic, but they can be setup to "see" light and dark colors. Line follower. Maybe see the white wall...
Hall-effect - Have the car find and park or something on a metal plate, magnetic.
Solar cell or photo diode - Light seeking. You mentioned this at the beginning.
RFID - Place RFID tags along a path and have the car follow. (never done that myself)
Dave
Always wear safety glasses while programming.
Bookmarks