Two steps forward, One step backward
Not much luck reading DT_INTS-14. I do not understand ASM and all the macros that have been written.
Soooo I installed the two blinky programs and they both looked correct. I activated the LOGIC TOOL from PICKIT2 and looked carefully at the 20millisec square wave. Close enough for government work. Next I changed the
Quote:
TOGGLE PORTC.6 'CONNECTED TO METER
command to
Quote:
PWM PORTD.7, 127, 1
and hooked up Channel 2 of the LOGIC TOOL to PORTD.7.
I expected to see a single pulse every 20millisec. I even hoped that the pulse would be 1.5millisec long.
I see many pulses seemingly not related to the edges of the interrupt driven 50Hz square wave. I would show you all a picture, but my FastStone Capture is screwed up.
Is there any PWM-like command that makes one pulse ranging from 1millisec to 2millisec in 256 gradations?
Ken
I've come to a screeching halt
"Verification of Program Memory failed at address 0x00000000"
I tried some old code that I KNOW loaded. Not today.
I swapped out the PIC. That was not the problem. I reseated all the patch wires. That made no difference.
I restarted the PICKIT2 programmer. That did not help.
I tried with a PICKIT2 board - the one on which I ran the blinkys - no problem. It liked to load and blink.
Where do I start?
Ken
Seems litte different than the HPWM technique
I took my interrupt driven car to the gym this morning. It behaved about the same as my old HPWM design. When going slowly it just barely made the left turns at the corners. It did seem to go straight with less wiggle, but it still hit the wall occasionally.
It appears that the problem is reaction time. My delving into an interrupt driven system was motivated by the guess that randomly (in time) changing the HPWM command might be confusing the electronic speed control. On this account I detect little difference.
Another reason for regularly timed SONAR triggers was to take advantage of PID control. I have not coded that experiment. I am not convinced quicker reaction time will result.
I partially solved the TOGGLE problem by inserting the following code right after 'main:'. This system does not toggle control between PIC and RC, but it does stop (Brake) the car when the radio transmitter is turned ON. It is not a nice picture - a 75 year old man running around a gymnasium trying to tackle an out-of-control RC car.
The code samples channel3. This is the steering PWM signal from the car's radio receiver. There are pulses on that line as soon as the transmitter is activated.
main:
switchtoPIC = 2
WHILE switchtoPIC >= 2
COUNT channel3, 65, switchtoPIC
WHEELS = Brake
WEND
I am not sure what to do now. The reaction time seems quick enough on the bench.
Infrared distance detector?
Back a couple weeks one of you mentioned using infrared distance detector instead of a sonar detector. How do I find that posting? What was he product's name? How does it work? Or am I mistaken.
Ken
Yes, Frits' code was not interrupt driven
You are correct. I got the whole idea from Frits. I have learned some since then.
1. His cars were 1/12 scale toy level cars. They are not fast by RC standards. They have only bang bang steering and wheel control. They are small. They do not have enough room for much electronics to be added. Frits removed the RC receiver. I tried the Frits thing on a 1/10. I was not successful. The 1/10 car is much faster than the 1/12 car. This video shows the difference.
http://www.youtube.com/watch?v=Emsf46WpctI
I have been asking for suggestions for a 'game' that can be played with the 1/10 Toy level cars. They are $50 each vs $200 for a model level car.
I thought up the 'swarm the teacher with the light bulb' game to be played with multiple light sensing diodes on the roofs of the cars. I have been diverted by this idea of interrupt driven model level control.
Thanks for everything.
KEn
Can't get to the gym for a couple of days.
My gymnasium has no electricity. Need bright sunny day to take video. Tomorrow is Thanksgiving and the following day is occupied by family stuff.
The model car does not skid. The toy car does.
In my older model level car, the receiver created no pulses on channel3 input when the transmitter was off. My newer model level car, somehow has noise on that line. The circuits are the same. I have not been able to figure out the difference.
I started trying to code my 1/10 toy car to do a skid turn then I realized that it's real problem is the subtle issue of staying parallel to the wall. I think you have a real good idea asking me to see whether I can control that car with its RC inside my gym.
Thanks for the encouragement. I have been bumping my head for a while.
Ken