Interfacing to microcontroller, signal transistions.

If you have a question about the software please ask it here.

Interfacing to microcontroller, signal transistions.

Postby beefy » Tue Dec 13, 2016 11:40 pm

Hi Balazs,

this is more of an electronics question. I'm may be using external interrupts in my microcontroller. My micro will be monitoring M3 and M10 outputs from UCcnc. The interrupts will sometimes be triggered by a 0-1 transition and sometimes by a 1-0 transition. I would be using pull down resistors on my micro inputs.

I'm assuming the output signals from the UC300ETH / UC400ETH are nice clean transistions from one level to another, and so I would not need any special precautions on my external interrupt pins.

Would you agree ??

Keith
beefy
 
Posts: 449
Joined: Mon Sep 05, 2016 10:34 am

Re: Interfacing to microcontroller, signal transistions.

Postby A_Camera » Wed Dec 14, 2016 9:38 am

beefy wrote:I'm assuming the output signals from the UC300ETH / UC400ETH are nice clean transistions from one level to another, and so I would not need any special precautions on my external interrupt pins.

I checked my UC300ETH outputs on my 200MHz digital scope and sure the pulses look nice, but the quality depends on your power supply and other possible noise sources. I have not measured rise times but have not seen anything worrying.

BTW, I would still add a 74HC14 or something similar on the inputs to shape and clean the UC300ETH outputs before the micro controller. Also, I would avoid the use of pull down resistors. I don't know which type of micro controllers you are using, but if you can only trigger the IRQ on raising edge and you need to trigger on falling edge you can always invert the signal.
A_Camera
 
Posts: 639
Joined: Tue Sep 20, 2016 11:37 am

Re: Interfacing to microcontroller, signal transistions.

Postby beefy » Wed Dec 14, 2016 11:05 am

Thanks for the advice AC.

Why avoid pull down resistors though (do you mean use pull ups instead ??). I like the idea of strong pull downs (1k) in a noisy environment like plasma. It's also a recommended practise to avoid spurious triggering of the interrupt.

I'm using an AVR micro.

The interrupts can be triggered on either a raising or falling edge and I may be using both. The code will simply change the interrupt on the fly, from raising to lowering and visa versa.

I think my breakout board actually uses the very ICs you mention (74HC14) and the BB manual says the outputs can sink/source 24mA. A 1K pulldown resistor will give 5mA so a source of 24mA will easily drive my I/P high.

It's possible I may yet get away with polling the pins but I still have to see what the maximum loop time could ever be, and I won't know that until I've added all the features to my gizmo down the track and the code size grows. So I might just play safe and use interrupts.

Keith
beefy
 
Posts: 449
Joined: Mon Sep 05, 2016 10:34 am

Re: Interfacing to microcontroller, signal transistions.

Postby cncdrive » Wed Dec 14, 2016 2:54 pm

Hi Keith,

Yes, all outputs on the UC300ETH-5LPT and also on the UC400ETH are 74HC14 buffers.
They are push/pull (totem-pole) drivers, so they can sink and source current, so pullup or pulldown on the input which will read the output is not nessessary.
I mean that the output will work without a pullup and pulldown.

And these TTL outputs switching fast and clean, the datasheet listed typical transition time is 7nanoseconds.
And If you will be using a Schmitt trigger input on your microcontroller, that will also cleanup the signal.
You know Scmitt trigger is like a Window comparator, when your input signal goes above 66% of Vcc then it reads as logic high and then if the signal remains in the 33 to 100% range of Vcc then the logic level will not change, it will only change if the signal will go below 33% then it will switch to logic 0. And then if your signal remains between 0% and 66% of Vcc then the logic level will not change, only when it crosses above 66% of Vcc will change back to locig 1 and so on...
Most microcontrollers has Schmitt trigger inputs, they should be marked in the micro's datasheet.

And you may want to add a pullup or pulldown to your inputs on your board, because:

1.) If your board can be unconnected and there is no pull resistors and no internal pullups/downs configured in the micro then the inputs will be floating and that will cause random triggers on the interrupt pin.
2.) As you've mentioned some small current bias directly on the input pin can increase noise immunity especially if the cable is long between the output of the UC300ETH and your board's input.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: Interfacing to microcontroller, signal transistions.

Postby beefy » Wed Dec 14, 2016 3:59 pm

Thanks Balazs,

knowledge is power as they say.

Just checked the micro datasheet and yes the inputs have Schmitt triggers.

Keith.
beefy
 
Posts: 449
Joined: Mon Sep 05, 2016 10:34 am

Re: Interfacing to microcontroller, signal transistions.

Postby A_Camera » Thu Dec 15, 2016 10:11 am

beefy wrote:Thanks for the advice AC.

Why avoid pull down resistors though (do you mean use pull ups instead ??). I like the idea of strong pull downs (1k) in a noisy environment like plasma. It's also a recommended practise to avoid spurious triggering of the interrupt.


Generally saying, pull down resistors are not a very good idea because they need to be fairly large to have an effect (like you also are saying) and they also act as pull-downs when not needed, i.e. when you have a positive signal and what to pull the input high.

For noise reduction it is recommended to use low pass filter, not strong pull-down resistors.

http://www.digikey.com/en/articles/techzone/2012/apr/protecting-inputs-in-digital-electronics

When you say "It's also a recommended practice to avoid spurious triggering of the interrupt." Recommended by who? Yes, it is used, yes, it has some effect, but it is not a good practice in my opinion.

Noise must be handled primarily where it is generated. There are many things which can be done, like proper shielding, not just shielding wires, but also electronics should be in shielded boxes, use of filters on mains inputs and so on. I dislike pull-down resistors and avoid if I can, but use it if absolutely necessary.


beefy wrote:I'm using an AVR micro.

The interrupts can be triggered on either a raising or falling edge and I may be using both. The code will simply change the interrupt on the fly, from raising to lowering and visa versa.


The PICs I am using have an interrupt setting type called something like "Interrupt on state change". It means that an interrupt will be generated every time the input goes from high to low or from low to high. This makes changing the configuration on the fly unnecessary. Doesn't this exist in AVR? Isn't this what you want to do?
A_Camera
 
Posts: 639
Joined: Tue Sep 20, 2016 11:37 am

Re: Interfacing to microcontroller, signal transistions.

Postby A_Camera » Thu Dec 15, 2016 12:12 pm

A_Camera wrote:
beefy wrote:Thanks for the advice AC.

Why avoid pull down resistors though (do you mean use pull ups instead ??). I like the idea of strong pull downs (1k) in a noisy environment like plasma. It's also a recommended practise to avoid spurious triggering of the interrupt.


Generally saying, pull down resistors are not a very good idea because they need to be fairly small to have an effect (like you also are saying) allowing some significant current to flow, and they also act as pull-downs when not needed, i.e. when you have a positive signal and what to pull the input high.

For noise reduction it is recommended to use low pass filter, not strong pull-down resistors.

http://www.digikey.com/en/articles/techzone/2012/apr/protecting-inputs-in-digital-electronics

When you say "It's also a recommended practice to avoid spurious triggering of the interrupt." Recommended by who? Yes, it is used, yes, it has some effect, but it is not a good practice in my opinion.

Noise must be handled primarily where it is generated. There are many things which can be done, like proper shielding, not just shielding wires, but also electronics should be in shielded boxes, use of filters on mains inputs and so on. I dislike pull-down resistors and avoid if I can, but use it if absolutely necessary.


beefy wrote:I'm using an AVR micro.

The interrupts can be triggered on either a raising or falling edge and I may be using both. The code will simply change the interrupt on the fly, from raising to lowering and visa versa.


The PICs I am using have an interrupt setting type called something like "Interrupt on state change". It means that an interrupt will be generated every time the input goes from high to low or from low to high. This makes changing the configuration on the fly unnecessary. Doesn't this exist in AVR? Isn't this what you want to do?
A_Camera
 
Posts: 639
Joined: Tue Sep 20, 2016 11:37 am

Re: Interfacing to microcontroller, signal transistions.

Postby A_Camera » Thu Dec 15, 2016 12:18 pm

OK, I don't know what happened, I clicked on Edit and when I saved after editing it created a new post. Well, whatever... :)

The editing was made because I detected a typo in my original post where I said that the pull-down resistor must be fairly large to have an effect, which is of course wrong, and the opposite is true. Normally 10k is a common value for pull-up resistors, but around 1k is necessary for pull-down, which is fairly small, not large.
A_Camera
 
Posts: 639
Joined: Tue Sep 20, 2016 11:37 am

Re: Interfacing to microcontroller, signal transistions.

Postby beefy » Thu Dec 15, 2016 9:25 pm

Thanks very much A_C.

I"ll take note of everything you suggested, and I'll have a read of the info in the link. I was Googling for similar info but didn't have much luck, probably because I was including "interrupt pins" and "noise" in the search. Should have done a more general search.

Where do I get my info, anywhere I can LOL. Lots and lots of Googling, technical forums, white papers, books, etc. I know some of it may be not exactly correct but it's all I have most of the time.

I'm guessing I may be OK without anything on the input. Everything is going inside a stainless box, and the micro will be connected to the breakout board directly and close by. And as Balazs said the 74HC14 outputs have totem pole drivers. And everything will be powered up together so I shouldn't have any floating inputs.

I do have the option of a "pin change" interrupt too. To be honest, at this point in time I don't know if that would be the best thing to use. I'll have to try and think of all the unexpected things that can happen and whether pin change, or change on specified direction is the way to go.

Cheers,

Keith.
beefy
 
Posts: 449
Joined: Mon Sep 05, 2016 10:34 am


Return to Ask a question from support here

Who is online

Users browsing this forum: Bing [Bot] and 33 guests