Multi external interupts on one pin ?

manie

Senior Member
In order to easily handle more than one serin/serout events from external 08M and 28x1 to 40x1 master I need to use interupts and then decipher which chip is trying to communicate with the 40x1. In addition there is the serin/serout from/to the Polygon RF units. Comms from the chips will be hardwire, and via interupt request. Comms to/from the PC via the RF units will happen within the 40x1 code on a "I'm waiting for x seconds for an answer..." basis. Time-out then takes the code to the next step, this works already so no problem there.

Can I make ineterupt requests from various other Picaxe's (08m,28x1) to the same pin on the 40x1 master ? example:

08M----------(to pinxx)
|
-----------40x1 pinxx (as interupt input)
|
28x1---------(also to pinxx)
Manie
 
Last edited:

SilentScreamer

Senior Member
You could do the interrupt, then use serout/serin to tell the 40X1 which chip is trying to communicate then send data to the 40X1
 

manie

Senior Member
Thats what I thought. Now to find a good "encode/decode" algorithm to send_to/receive_from the correct chip.
Thanks
Manie
 

alband

Senior Member
If you are willing to use more inputs then yu can do this...

Say you have three whatever's that need to interrupt the 40X1 (assuming that RF unit can behave like another PICAXE).

Each of them is connected to pin0 and one other different pin either pin1, pin2 or pin3.

Code:
setint %00000001,%00000001

interrupt:
if pin1 = 1 then
let b0 = 1
endif
if pin2 = 1 then
let b0 = 2
endif
if pin3 = 1 then
let b0 = 3
endif
Note in this example you can't use
Code:
if pin# = 1 then RF

RF: serin...
because the interrupt routine must terminate and should be jumped out of. :rolleyes:
Basically, each input chip interrupts the chip 40X1 on a common interrupt pin and then "tells" the 40X1 which it is by the states of three other pins. There must be an easier way of checking which other pin is high than above, but I don't know the command.:rolleyes:
 

manie

Senior Member
Or maybe the 08M talks to the 28x1 which talks to the 40x1 for itself and as relay for the 08M ? There is no speed urgency as the 08M will handle keyboard input etc, the 28x1 will handle something else all at a leisurely once/twice a minute at max.

Any thoughts ?
Manie

Edit
Alband: saw your post late, the input pins are now getting scarce, I have one input pin and one analogue pin free on the 40x1, maybe I can use that rotary encoder from e-bay on the wind direction ? How many pins will that use ?

Manie
 
Last edited:

lbenson

Senior Member
>input pins are now getting scarce

At the rate things are growing, maybe time for i/o expansion, e.g., the MCP23017 i2C I/O expander with 16 i/o. Or make more things into wireless message senders.
 

BeanieBots

Moderator
You can have as many interrupt sources on one pin as you like.
Simply diode OR them. The problem is knowing which one wants service or if more than one 'requests' at the same time.
 

alband

Senior Member
perhaps that analogue pin?
Have the common interrupt pin, but have each external chip give a slightly different logic level using a POT on the interrupt out pin. Or if that isn't possible use a short PWM sent to the analogue input on the 40X1.
Basically, assign each input a logic level read on the analogue pin.
 

BeanieBots

Moderator
Neat idea Alband. An R-2R ladder on the analogue input would identify any combination of sources up to a maximum of about 16 without too much fuss.
 

manie

Senior Member
Alband: BB: Yes, that could be neat, never thought I'd start running out of pins on the 40x1 though.... any plans for a 60x1 in the near future ?? Along with the 28x1 thats already 68 pins possibly in use ! Doubt if I'll use all of them though... LOL LOL LOL
Manie
 

alband

Senior Member
I have two 40X1's in use currently and I've run out of I/O's!
Some would might call it wastefull, I prefer to think of it as generosity towards Rev Ed:p;)
 

manie

Senior Member
>input pins are now getting scarce

At the rate things are growing, maybe time for i/o expansion, e.g., the MCP23017 i2C I/O expander with 16 i/o. Or make more things into wireless message senders.
I do have the three 1mW Xbee's still lying around here, they were replaced by the 10mW Polygon units for the main PC(in home) to Controller(in chook-house) comms. That wau I'd need just one Txd/Rxd set of pins which is there already..... Hhhhhmmmmmmmmmmmmm ??

I also think Alband has a good idea on the one ADC still available, maybe combine the Xbee Txd/Rxd with an Xbee analogue(pwm??) on the ADC pin to identify the sender ? Hmmmmmm ??

Any thoughts on that guys ?
Manie
 

alband

Senior Member
I'm not sure about this and would think someone who has a deeper understanding of the code would know; Anyway I reckon PWM wouldn't be too that much use. It would have to be leveled out by some capacitors to give a smooth voltage, but since it is for such a short time , would be prone to errors whilst the capacitors discharge at the end of the PWM command.

Again I'm not sure (not a good day) but wouldn't it be possible to put a resistor set-up on a normal output pin, so that it give a slightly different value than just logic high. E.g. having a 10k on the output from the 08M, a 22K on the output of the 28X1 and a 33K on the ouput of the RF module?:confused:
 
Top