Here is my code as seen by WINDOWS notepad application. It does not make the PBP commands into capitals.
Were is the big delay?
Ken
Here is my code as seen by WINDOWS notepad application. It does not make the PBP commands into capitals.
Were is the big delay?
Ken
WOW!!! That is cool!!! Very nice job so far.
After a quick look at the code I see a lot of things going on between range checks.
Just wondering what would happen it you setup a timer to trigger an interrupt routine.
The interrupt routine would be the range check. That way the range would be know almost instantly for corrections.
Or add range checking in between the IF/ENDIF statements. Places like this
Code:aftermain: gosub skidandreverse frontfreetostopreverse = frontfreetostopreversesetup if rangefront < frontfree then 'turn left as there is something ahead in front gosub SteerFullLeft goto main endif IF rangeright = 0 then endif if rangeright > outertrack then 'turn right as we are too far away gosub SteerHalfRight endif if rangeright < desiredtrack and oldrangeright < rangeright then gosub SteerStraight endif if rangeright > desiredtrack and oldrangeright > rangeright then gosub SteerStraight endif
Dave
Always wear safety glasses while programming.
I thought that a PIC runs at micro second speed. I thought that a loop clean through all my code would be indistinguishable by my human eyes.
The SRF05 have little red lights that flash each time they are pulsed. While the PIC is running the little flashes come about one per second.
How can that be? What is consuming the time?
Where can I get some information about the relation between PBP commands and real 16RF887 machine language code?
Ken
I am not good at figuring execution times but there is a thread around here some place talking about it... i can not find it
I do see a 200 pause, add that to the IF/THENs...
On the bench just to see you could remove some of the code and see it the LEDs blink faster. A primitive way yes. All I can say at the moment.
Dave
Always wear safety glasses while programming.
What about PULSIN?
It has 16 bit resolution and at 4MHz, the PULSIN resolution is 10uS.
If you DON'T receive a pulse doesn't the PIC wait for 65535 x 10uS (0.655 seconds) before it "moves along" to something else?
Perhaps you need a define to determine the max PULSIN time?
IE:
PULSIN_MAX 1000 'Maximum counts allowed before pulsin times out
Just a thought.
steve
Is it possible to place the car on a stand and the camra above it. Then have an object approaching form the side and back again so we could see the reaction of your sytem.
Then I would suggest the ue of he PID routines of Henrik that are on this link to obtain smooth control: http://www.picbasic.co.uk/forum/showthread.php?t=5874
Ioannis
Inline code is probably faster than subroutine based code. I commented out all the HPWM subroutines and substituted in place of their calls the HPWM statements themselves.
My guess is that the SRF05's are blinking faster. That is very good.
I checked the SRF05 responses. They seem to be immediately after the one millisecond trigger pulse. PULSIN should not be timing out, but that is a vulnerability worth considering.
Ken
Bookmarks