3 external interrupts needed for older avr

Go To Last Post
27 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everyone,

 

I have an older board with a 90s1200 on it. It operates as an infrared repeater in my entire house.

Runs on 5 volts. It is wired through my unused phone lines.

 

This allows me to use a very nice backlit IR remote control in another area of the house.

 

The interrupt uses INT0 on the falling edge and sends the IR pulses in the ISR.

The system has worked for more than 10 years and it's still working great.

 

I want to add 2 more zones to the repeater, but there is only one external interrupt.

 

I don't want to change the avr to a newer one if I can get away with it.

The avr is smd and i would rather not remove it or I will be making a new board.

 

I thought of using a 74AC125 with outputs connected to INT0.

 

Any thoughts?

 

Is there a better way?

Any helpful ideas will be appreciated.

 

Thank you

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Let me get this straight:  You don't want to drop in a pin-compatible current model buck or two AVR model to replace one that is brain-dead and has not been seen in the wild for about 20 years. Yet you contemplate tacking on another TTL chip?

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OP's restriction appears to be the result of his skill level at soldering and desoldering SMD.

Iluvatar is the better part of Valar.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know the chip, but if you have a timer that can generate an interrupt on some counting event, that should work.  Say e.g. an 8-bit counter and you preload the counter to 255, then a single external clock pulse (your "interrupt" pulse) will roll the counter over to 0 and trigger an overflow, which can be set to cause an interrupt.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The other standard technique is to OR the 3 signals together (using appropriate logic polarity, so if all negative-going, use a 3-input AND gate), then have the ISR code check some other status inputs to determine which interrupt code to run.

Last Edited: Wed. Jul 31, 2019 - 04:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I see there's also an analog comparator interrupt.  So that could be your 3rd, by wiring one of the inputs to Vcc/2 and the other is your 0 or Vcc interrupt signal.

Last Edited: Wed. Jul 31, 2019 - 04:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:

Let me get this straight:  You don't want to drop in a pin-compatible current model buck or two AVR model to replace one that is brain-dead and has not been seen in the wild for about 20 years. Yet you contemplate tacking on another TTL chip?

 

 

yes that is correct. 

The avr is not brain dead, as I mentioned it works great.

Just asking a simple question, that is all.

 

Again, all I am wondering is if there was an alternative.

I don't want to rewrite the code since I have no idea where the original source is.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kk6gm wrote:

The other standard technique is to OR the 3 signals together (using appropriate logic polarity, so if all negative-going, use a 3-input AND gate), then have the ISR code check some other status inputs to determine which interrupt code to run.

 

good answer, thank you.

 

The ISR is exactly the same no matter which interrupt pin is triggered. So if i can find a simple IC as you mentioned above, that is all I need.

 

I have to add 2 wires to the circuit anyways. (for the other two zones)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you using photodiodes as the pickup?  Maybe you can combine them so that if any gets a pulse, it appears at the single output. 

 

Lets see your detector circuit.    You might only need a few resistors, or maybe an or gate (if the signals are normally low) and gate (if the opto signals are normally high)

 

Brute-force combining works well, only if only one opto beam is used at a time, other wise a "scanner" approach is needed

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was thinking of using a 74AC125.

 

Edit: the schematic was incorrect before, now it's fixed.

 

Last Edited: Wed. Jul 31, 2019 - 08:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The 90S1200 was the first AVR.  It had nothing but 16 or so I/O pins and maybe a timer, but no UART, I2C.   The modern pin-out equivalent is the Tiny2313.  But your board has a SOIC surface mount chip. Best left alone.

 

The 3 input AND gate 74HC11 with the output tied to the INT0 would work if you are sure that only one zone would be active at a time.

The 74HC125 would need three I/O pins for enabling the gates.   HC125 are enabled with low logic so when the AVR is reset, all the inputs would be disabled because the ports are at logic 1 and DDR=input on reset.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

Are you using photodiodes as the pickup?  Maybe you can combine them so that if any gets a pulse, it appears at the single output. 

 

I am using three 425-1156-ND. Presently only one is being used and is wired to INT0. When the sensor goes low, the circuit outputs 56 KHz IR across the room to the device. This has been working for more than 10 years, and it works great.

 

avrcandies wrote:

Lets see your detector circuit.    You might only need a few resistors, or maybe an or gate (if the signals are normally low) and gate (if the opto signals are normally high)

 

Sorry it's been so long I don't have the schematic, I can draw one up if I get some time.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:

The 3 input AND gate 74HC11 with the output tied to the INT0 would work if you are sure that only one zone would be active at a time.

 

Thank you for the advice, I will try it.

 

Simonetta wrote:

The 74HC125 would need three I/O pins for enabling the gates.   HC125 are enabled with low logic so when the AVR is reset, all the inputs would be disabled because the ports are at logic 1 and DDR=input on reset.

 

If you look at the above schematic, I have the "A" inputs tied to GND and the "B" input is coming from the sensor.

So if the sensor goes low, the output is low. If the sensor goes high then, the output is floating.

I figured this wouldn't affect the other outputs, but I have little knowledge of these devices.

 

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:
The 3 input AND gate 74HC11 with the output tied to the INT0 would work if you are sure that only one zone would be active at a time.

This is a critical issue if the interrupts are edge triggered, as a 2nd interrupt signal that occurs before the first interrupt signal is cleared will not generate an interrupt.

 

The problem will not occur if the interrupts are level triggered.

Last Edited: Wed. Jul 31, 2019 - 07:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To use the '125s as you have shown, you need to wire the chip inputs to HI, not GND, to generate low-going interrupt signals to the AVR.  You also need a pullup on the output (the INT0 AVR pin).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:

The 3 input AND gate 74HC11 with the output tied to the INT0 would work if you are sure that only one zone would be active at a time.

 

It looks like as long as one input is low, the output is low. 

The other two inputs are "don't care".

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kk6gm wrote:

To use the '125s as you have shown, you need to wire the chip inputs to HI, not GND, to generate low-going interrupt signals to the AVR.  You also need a pullup on the output (the INT0 AVR pin).

I am confused. The function Table shows A = L, B = L then output is LOW

which is what the INT0 is looking for.

 

The sensor is wired to "A".

The "B" input is tied to GND.

The "A" input is either low or high.

 

If the "B" input is high the output will never go low.

 

However if the "A" input is high then the output will be floating.

(correct me if i am wrong, but this won't affect the other outputs since three of them will be joined together)

 

Am I missing something here?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

newbie123 wrote:

I am confused. The function Table shows A = L, B = L then output is LOW

which is what the INT0 is looking for.

What you showed in post #10 were inverting buffers (circles on outputs).  What you show in post #17 are non-inverting buffers (no circles on outputs).

 

I look up the '125 and it is non-inverting, so the drawing in #10 is wrong.  So in that case, yes, leave the inputs wired to GND (and add the pullup).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kk6gm wrote:

I look up the '125 and it is non-inverting, so the drawing in #10 is wrong.  So in that case, yes, leave the inputs wired to GND (and add the pullup).

 

Sorry I just drew that schematic quickly and I missed that.

My fault.

 

The library I used is obviously wrong.

 

If the pullup is enabled in the code would I still need an external resistor?

 

Thanks again.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Internal pullup will be enough.  Adding an external pullup just gives you more noise immunity.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the drawing in #10 has been corrected.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The interrupt uses INT0 on the falling edge and sends the IR pulses in the ISR.

 

For active-low input at relatively low speeds and only one active at a time (if I understand the application correctly), you should be able to get away a "wired or" configuration using little more than a couple of diodes:

 

 

 

Come to think of it, don't most IR receiver modules have "open-collector" outputs?  In that case, you shouldn't even need the diodes...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:

Come to think of it, don't most IR receiver modules have "open-collector" outputs?  In that case, you shouldn't even need the diodes...

 

Thanks for the tip, I will try it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The datasheet does show open collector !!

However, it appears the chip output is low when there is no light.   The datasheet makes this almost impossible to determine!!, one wave form somewhat suggests it.

If it is normally low with no light, the nyou cant wire them in parallel.  If normally high, you can.

 

If normally low, you can wire each output with a pullup & take each output through its own diode to a common pint with a pulldown.   Thne any high  unit will pull the common point high.

 

Remotes tend to broadcast the message over & over as long as you hold the key, so that might be helpful, in case of interference.

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Wed. Jul 31, 2019 - 11:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

newbie123 wrote:

westfw wrote:

Come to think of it, don't most IR receiver modules have "open-collector" outputs?  In that case, you shouldn't even need the diodes...

 

Thanks for the tip, I will try it.

 

Yes, try a simple 'WIRED OR"

The data is poor, but other IR receivers show an active low (Idles HI) which should be OK.

There is some variation in phase delays on those IR units, based on signal strength, so you may need to check how it works with multiple units excited, with not the same IR levels.

That variation may be small enough to be tolerated - do you have a scope you can check it with. eg Vishay data gives 7~15 carrier cycles delays for their parts. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

newbie123 wrote:
I don't want to rewrite the code since I have no idea where the original source is.

Huh?  Then how are you going to make use of more external interrupts?

 

newbie123 wrote:
The avr is not brain dead,

I guess [see my avatar] that beauty is in the eye of the beholder.  That model would be eligible for home-care or admission to a rest home, as it is missing many of the capabilities for ADL [Activities of Daily Living].  I.e. still alive but not worth much.

 

Activities of Daily Life or ADLs, are tasks performed by each individual on a daily basis that are essential to independent living.

The five ADLs:

  1. Bathing: personal hygiene and grooming
  2. Dressing: dressing and undressing
  3. Transferring: movement and mobility
  4. Toileting: continence-related tasks including control and hygiene
  5. Eating: preparing food and feeding

 

... A person in need of support of one or more Activities of Daily Living may be a candidate for assisted living. ...

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Who-me wrote:

westfw wrote:

Come to think of it, don't most IR receiver modules have "open-collector" outputs?  In that case, you shouldn't even need the diodes...

 

Yes, try a simple 'WIRED OR"

The data is poor, but other IR receivers show an active low (Idles HI) which should be OK.

There is some variation in phase delays on those IR units, based on signal strength, so you may need to check how it works with multiple units excited, with not the same IR levels.

That variation may be small enough to be tolerated - do you have a scope you can check it with. eg Vishay data gives 7~15 carrier cycles delays for their parts. 

 

Thanks alot westfw.

 

I couldn't get it to work without diodes.

It works with 3 very simple, inexpensive diodes.

 

I did try a 74AC125 and a 74HC11 both work OK, but sometimes you have to press the remote keys a few times to get a response.

With the diodes, it just works perfectly every single time.

 

I did have some trouble making it work with three sensors (it worked fine with two on one interrupt).

I soon figured out that the 3rd sensor was not like the others (same product, just different part number)

 

So now all three zones work reliably connected to INT0 using three 1N4148 diodes as in your diagram.

I didn't use a pullup because I am certain the internal pullup is enabled.

 

Thanks to everyone who responded to my post!