Discussion forum for the BasicX family of microcontroller chips.
So far in May, you have voted 0 times ou of a total of 20 votes by the community.
Please help us clean the archives from unuseful discussion threads by using the voting system! Details here.
Is this thread worth a thumbs up?
Question about Interrupts - naimead - May 11 12:04:00 2005
Hi guys,
I have the following project:two basicX controlling the same servo
motor.What i want to do is the second basicX to be able to take
control in any time.So how should i use the interrupts in this case?
(I have never used this teqnique before so is there any examples you
can point me to?)
thanks
(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com ) Re: Question about Interrupts - Tom Becker - May 12 9:11:00 2005
> ... What i want to do is the second basicX to be able to take
control
[at] any time...
I think you'll need to describe this a little more deeply. Do you need
redundant processors for reliability? On the same physical device? Do
you need to control a device remotely from two places? Why?
Tom
Tom Becker
--... ...--
GTBecker@GTBe... www.RighTime.com
The RighTime Clock Company, Inc., Cape Coral, Florida USA
+1239 540 5700
(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com ) Re: Question about Interrupts - naimead - May 12 20:00:00 2005
Actually I have my first basicX connected to a GPS and my second
connected to many other devices(such as sonars,etc...).What i want
to do,is course correction by the second basicX.
Both of them are connected to the same motors.The main course is
being implemented by the basicX connected to gps and the
second is supposed to interrupt the first one every time there is
a problem(such as too close to a wall)-that is why i need the
interrupts.
(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com ) Re: Question about Interrupts - Mike Perks - May 13 0:16:00 2005
naimead wrote:
> Actually I have my first basicX connected to a GPS
and my second
> connected to many other devices(such as sonars,etc...).What i want
> to do,is course correction by the second basicX.
> Both of them are connected to the same motors.The main course is
> being implemented by the basicX connected to gps and the
> second is supposed to interrupt the first one every time there is
> a problem(such as too close to a wall)-that is why i need the
> interrupts.
>
Although I haven't done this before myself, it would seem that you have
an unusual system architecture. The normal industry practice (may be
even a best practice) is to have one master controller with a control
loop that gathers input from sensors and other controllers, decides what
to do, and then informs the "effectors" or output controllers what do
to. For simple applications only one controller chip is needed. The
multi-tasking capability in BasicX is very helpful in delaying the need
for other controllers. Some people refer to this as "sense and
respond"
and is a key part of many other, even unrelated, architectures such as
IBM's Autonomic Computing (http://tinyurl.com/a8xyl ) software
architecture for system management.
So my first question would be, why isn't one BasicX controller
sufficient and can you offload function to discrete logic first? For
example in my project I have a conflict with Timer1 that means I built
my own PWM generators from NE555 timers.
If you need more than one controller, then you need to carefully design
what function goes on each controller. For example a project might use 4
controllers, 2 for sensor input, 1 for driving motors with PID, and 1
for the master controller. The other part of the design, is the both the
communication protocols and command protocols between the controllers.
Examples of communication protocols include RS232, RS485, SPI, I2C, roll
your own. Command protocols are the details of the command bits,
parameters and data sent across the communication protocol tend to be
application specific.
So for your application it seems that macro-level course control is
provided by the GPS controller and micro-level course control is
provided by the second controller. I would suggest that the second
controller is the master and the GPS controller sends course corrections
to the master. The master is responsible for trying to stay on course
but also ensuring that minor course corrections are made along the way.
Regards,
Mike
(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com ) Re: Question about Interrupts - naimead - May 13 7:20:00 2005
I am planning to simplify things by adding a receiver in my
motors and completely remove the second basicX.
So the architecture i am thinking of would be like that:
gps---basicX---servos
receiver---servos
For the main course responsible would always be the basicX,
but how about if i have to send a correction signal by
the transmitter?Don't I have to use an interrupt to stop
basicX?
(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com ) Re: Question about Interrupts - Mike Perks - May 13 9:25:00 2005
naimead wrote:
> I am planning to simplify things by adding a
receiver in my
> motors and completely remove the second basicX.
> So the architecture i am thinking of would be like that:
>
> gps---basicX---servos
>
> receiver---servos
>
> For the main course responsible would always be the basicX,
> but how about if i have to send a correction signal by
> the transmitter?Don't I have to use an interrupt to stop
> basicX?
>
As I said before you are going to get into trouble if you have two
different controllers both trying to control the motors/servos. The
servo control messages should be inputs to BasicX which then decides
what to do.
However to answer your question - the way to get an interrupt is to use
the WaitForInterrupt system function. There have been some recent
discussions about it in this group. You will need a separate task that
sleeps until an interrupt is received. Make sure that the interrupt task
does not try to do everything - just set some flags and then wait for
the next interrupt. The maximum execution time should be less than one
timer tick otherwise the interrupt task can lose control unless you lock
it via LockTask().
Mike
(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com ) Re: Question about Interrupts - tombhandley - May 13 9:28:00 2005
naimead, in additon to Mike's comments, if you need simple digital
I/O take a look at the PCF8574A I/O Expander which uses the I2C bus.
It provides up to 8 programmable I/O pins with an Interrupt
capability if any input has changed. Also, it provides fairly good
output drive capability for LEDs, etc. In the 'A' version, you can
daisy-chain up to 16 of them. Philips, TI, and others support it and
it's cheap. You can get it in a 16-pin DIP or smaller package. For
more info, check:
http://www.semiconductors.philips.com/pip/PCF8574A.html
I'm about to post a simple BX-24 example on my web site at:
http://home.comcast.net/~tomhandley/bx-24/bx-24.html
Normally when I need custom logic that does not require high speed, I
just program a PIC. In my case, I had an application that required
simple switch inputs from a robot and I re-visited the PCF8574A.
Since I already use sensors with an I2C interface, it's trivial to
use the PCF8574A for digital I/O and get an interrupt. I earlier
posted a BX-24 I2C module which has been tested with a variety of
devices. The PCF8574A example will be posted as a module with a test
program. I should have it up by the end of the weekend.
- Tom
--- In basicx@basi..., "naimead" <naimead@y...> wrote:
> Actually I have my first basicX connected to a GPS
and my second
> connected to many other devices(such as sonars,etc...).What i want
> to do,is course correction by the second basicX.
> Both of them are connected to the same motors.The main course is
> being implemented by the basicX connected to gps and the
> second is supposed to interrupt the first one every time there is
> a problem(such as too close to a wall)-that is why i need the
> interrupts.
(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com ) Re: Question about Interrupts - Carol - May 13 9:12:00 2005
naimead wrote:
> I am planning to simplify things by adding a
receiver in my
> motors and completely remove the second basicX.
> So the architecture i am thinking of would be like that:
>
> gps---basicX---servos
>
> receiver---servos
>
> For the main course responsible would always be the basicX,
> but how about if i have to send a correction signal by
> the transmitter?Don't I have to use an interrupt to stop
> basicX?
>
> *>.
>
>
>No virus found in this incoming message.
>Checked by AVG Anti-Virus.
>Version: 7.0.308 / Virus Database: 266.11.9 - Release Date: 5/12/2005
You wouldn't really need to stop the BasicX but rather have it capable
of running in a couple of different modes. I have one that
programmatically runs in 5 modes. When you first turn it on it is in
what I call mode zero and then other buttons on the rf unit change the
mode to 1, 2, 3 or 4. The functionality produced by pressing other
buttons is completely determined by what mode the BX is currently in.
The modes can be changed at anytime.
You could also allow the boat to run itself until an rf signal is
received on pin twelve. Twelve is the best rf interrupt pin from what I
understand and have personal experience with. A pressing of two buttons
is also desirable from the standpoint of eliminating errors. First
button switches to the mode (alerts the B) and the second button takes
the instruction within some reasonable amount of time... maybe 5 or 10
seconds.
Get a board with the rf receiver and connector pins to the BX already
available.
(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com ) Re: Question about Interrupts - arhodes19044 - May 16 17:12:00 2005
I agree, two bosses cause job conflicts at work.
I can bring to the table an understanding of biological systems
which are probably pretty optimized for fast, precise motor control.
For the most part there is a basic system controlling and
coordinating things at 2 levels. First the spinal cord reflexive
systems (like knee reflexes), then brainstem and cerebellar stuff.
These systems are for highly automatic complex motions and for
coordination of motions. The visual (i.e. external inputs) do not
directly feed into these systems, but this basic stuff (balance,
vision, and to a lesser extent, sensation) are very optimized
pathways from the higher levels.
Then there is the conscious overrides. Like trying to learn how to
use a joystick when the up/down responses are switched. Hard to do
quickly!
Anyway, I think that the 2 processor idea is actually GOOD. But you
need to have only one processor controlling the motors. It then
gets input from certain sensors directly (collision avoidance, speed
sensors, etc)
Then the second processor is the equivalent of your fontal cortex.
It is making the planning and incorporating maps (GPS) and stuff,
and then telling the first processor to do stuff differently (come
to a new orientation, slow down, speed up, and all that stuff).
Just running all the basic stuff is pretty processor intensive, so
it is nice to have a second processor to do the high level stuff is
a great idea. Just let the first one do all the interface to the
servos/motors, etc.
You CAN use an interrupt to tell the first low level proccessor to
look for information on other pins. Probably the communication
between the two needs to be more complex than simple semaphores or
interrupts ALONE. Maybe a serial connection to send more complex
commands to the low level processor. Maybe parallel on several pins
(and a set of handshaking pins). You could easily run out of IO
pins on the low level processor with parallel communication.
-Tony
--- In basicx@basi..., Carol <carolkysela@y...> wrote:
> naimead wrote:
>
> > I am planning to simplify things by adding a receiver in my
> > motors and completely remove the second basicX.
> > So the architecture i am thinking of would be like that:
> >
> > gps---basicX---servos
> >
> > receiver---servos
> >
> > For the main course responsible would always be the basicX,
> > but how about if i have to send a correction signal by
> > the transmitter?Don't I have to use an interrupt to stop
> > basicX?
> >
> >
> >
> > *>.
> >
> >
> >------------------------------
------
> >
> >No virus found in this incoming message.
> >Checked by AVG Anti-Virus.
> >Version: 7.0.308 / Virus Database: 266.11.9 - Release Date:
5/12/2005
> >
> >
> You wouldn't really need to stop the BasicX but rather have it
capable
> of running in a couple of different modes. I have
one that
> programmatically runs in 5 modes. When you first turn it on it is
in
> what I call mode zero and then other buttons on
the rf unit change
the
> mode to 1, 2, 3 or 4. The functionality produced
by pressing
other
> buttons is completely determined by what mode the
BX is currently
in.
> The modes can be changed at anytime.
>
> You could also allow the boat to run itself until an rf signal is
> received on pin twelve. Twelve is the best rf interrupt pin from
what I
> understand and have personal experience with. A
pressing of two
buttons
> is also desirable from the standpoint of
eliminating errors.
First
> button switches to the mode (alerts the B) and the
second button
takes
> the instruction within some reasonable amount of
time... maybe 5
or 10
> seconds.
>
> Get a board with the rf receiver and connector pins to the BX
already
> available.
(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com ) Re: Question about Interrupts - tombhandley - May 17 9:19:00 2005
maimead, I've posted an example of using the PCF8574 I2C I/O expander
on my web site mentioned below.
- Tom
--- In basicx@basi..., "tombhandley" <gr13tbs@c...> wrote:
> naimead, in additon to Mike's comments, if you
need simple digital
> I/O take a look at the PCF8574A I/O Expander which uses the I2C
bus.
> It provides up to 8 programmable I/O pins with an
Interrupt
> capability if any input has changed. Also, it provides fairly good
> output drive capability for LEDs, etc. In the 'A' version, you can
> daisy-chain up to 16 of them. Philips, TI, and others support it
and
> it's cheap. You can get it in a 16-pin DIP or
smaller package. For
> more info, check:
>
> http://www.semiconductors.philips.com/pip/PCF8574A.html
>
> I'm about to post a simple BX-24 example on my web site at:
>
> http://home.comcast.net/~tomhandley/bx-24/bx-24.html
>
> Normally when I need custom logic that does not require high speed,
I
> just program a PIC. In my case, I had an
application that required
> simple switch inputs from a robot and I re-visited the PCF8574A.
> Since I already use sensors with an I2C interface, it's trivial to
> use the PCF8574A for digital I/O and get an interrupt. I earlier
> posted a BX-24 I2C module which has been tested with a variety of
> devices. The PCF8574A example will be posted as a module with a
test
> program. I should have it up by the end of the
weekend.
>
> - Tom
>
> --- In basicx@basi..., "naimead" <naimead@y...> wrote:
> > Actually I have my first basicX connected to a GPS and my second
> > connected to many other devices(such as sonars,etc...).What i
want
> > to do,is course correction by the second
basicX.
> > Both of them are connected to the same motors.The main course is
> > being implemented by the basicX connected to gps and the
> > second is supposed to interrupt the first one every time there is
> > a problem(such as too close to a wall)-that is why i need the
> > interrupts.
(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )