In order to make sense of interrupt driven controls I need to know which PBP commands are 'blocking'. Why? During the blocking time no PWM pulses and no SONAR triggers are being emitted.
Ken
In order to make sense of interrupt driven controls I need to know which PBP commands are 'blocking'. Why? During the blocking time no PWM pulses and no SONAR triggers are being emitted.
Ken
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
Interrupts are the way around blocking commands. With interrupts, you can be listening for 4 separate pulses in, while pulsing 4 separate pulses out, while listening for the sonar ping, and blinking a few led's, etc, etc. With PicBasic commands alone, you are still stuck at pulsin, listening for a single pin for x duration. Don't get me wrong, blocking sounds so bad, but what it really does, is give the user a simple way do some complex things, with a single line of code. And without having to read about 50 extra pages of the data sheet. This is one of the best features of PicBasic. But there is a time for interrupts. Pulsin, Pulsout, PWM, serin, serout, freqout, count, debug, debugout are a few blocking commands.
That said, they will not block an interrupt. An interrupt, does what it does best. It butts in an interrupts, gets out, and then whatever PicBasic command it was in the middle of completes.
http://www.scalerobotics.com
Up to this moment I have not seen any specifications of the cars.
What speed they reach, how fast thay accelerate and how fast do they stop.
If youhave this figures then you may do the calculations about reaction time and maximum speed to reach in order to hit the brakes in time, before crashing on the walls.
Ioannis
You are right about the specs on the RC cars. I do not know that they officially exist. My car weights exactly four pounds. Has good rubber tires with plenty of friction against the gymnasium floor. I have been told that it is good for at least twenty miles per hour, but I have no means to verify it. The car is a HPI-Racing 1/10 Scale, 4 wheel drive, Sprint model.
Regarding the blocking commands. All I want to know is which ones block TMR1 and hence TMR1 based interrupts? Judging from my LOGIC TOOL images PULSIN blocks. True?
Ken
I thought I read somewhere that most of the commands which involve time, like Pulsin, Pulsout, etc, use timer1. But I can't find anything documenting that. Maybe someone can correct this for me? I did a little testing, and if you put your 20 ms timer on Timer2, it will be unaffected by pulsout, and I expect pulsin as well. These blocking commands DO NOT block an interrupt. For instance, you can have a pause 10000 in your main, while an interrupt gives you a heartbeat LED indication every second. But they will interfere if they are trying to load the same timer with a value.
EDIT: Turns out I was way off base here. Here Darrel corrects me:
The only PicBasic command that uses a timer is HPWM, which uses Timer2.
No PBP commands use Timer1 unless you tell it to.
And all PBP commands are blocking (while they execute).
They might interface with harware peripherals that are doing other things at the same time, but the statements themselves are blocking.
As you pointed out though, they don't block interrupts.
And it's the commands that do software based timing that get disturbed by the interrupts.
PAUSE, PULSIN/OUT, RCTIME, SEROUT/IN(2) etc.
They stop keeping time while the interrupt code executes, so all that time gets lost.
When using interrupts, you should use Hardware Timers to do things like PAUSE or PULSIN, and the USART instead if SEROUT/IN(2).
And when not using interrupts, use the easier versions (PBP), or still use the hardware which are the NON-BLOCKED functions.
You can do PULSIN with the CCP module at the same time you're sending serial data to a PC without any interrupts.
Last edited by ScaleRobotics; - 27th November 2010 at 06:48.
http://www.scalerobotics.com
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.
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
Ken, Sorry, I'm not very good at thinking up games. Follow the light sounds like fun to me. I have a lot of things I want to comment about your current effort, but time won't let me right now. I will tonight. Let me say this though, I think you are on the right path.
I wonder if you can do some testing for us. I want to help you get better control over the car, but need some parameters.
1. How close can you get to a wall at top speed and still be able to execute a turn?
2. How close do you want to be to the right wall?
3. At what percentage of speed can you still make a hard left without the car skiding?
4. If the Tx is NOT on, will there be any pulse from the RX?
Maybe you can put some tape lines on the floor and film that section of the floor to capture speed and distance from the wall. Of course this will be under manual control, So we will also get to see your reflexes-lol
I for 1 believe you can get the car to go much faster and be WAY more accurate!!
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
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
Bookmarks