Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Re: 5V tolerant i/o pins and also my comments on Circular buffers

Re: 5V tolerant i/o pins and also my comments on Circular buffers

2004-03-08 by Owen Mooney

It strikes me that your are hitting at the problem the wrong way.

Why don't you feed the 3.3.V output directly into the gate of a N 
channel enhancement mode MOSFET, and use the drain directly connected to 
your load - forget the UDN2981's.

The circuit is simple. Micro output direct to mosfet gate, source to 
ground, drain to load. You can switch amps this way (depending on the 
size of FET you use), and hey! its cheap and circuit board efficient (if 
you use surface mount fets - does anyone use anything else these days).

There are several simple FET circuits for handling a range of 
multivoltage I/O conditions. I  can put them in the files section if 
there is interest (I just have to work out how to submitt them!)

Owen

> I want to connect the LPC2114 (or other LPC2xxx) to 5V solenoid 
> drivers (eg. UDN2981's).  Can I pull up the outputs of the LPC to 5V 
> with say 10K, to satisfy the input reqmts of the driver?

Circular Buffers

I was suprised at the sheer NOISE created by my comment on circular 
buffers. Of course it was a simplified example. I do feel obliged to 
clear up.

There are two exception conditions, underflow and overflow. I showed a 
(very) simple handling of underflow as it is the most common condition
Handling overflow is far more complicated as it depends on the scenario. 
Some times you want to fail on overflow, sometimes you wnat to overwrite 
the oldest data on overflow. It depends.

In the simple case - one producer one consumer - no exception handling, 
there are no thread safe problems as consumers and producers are 
operating on different variables at all times.. Exception handling is 
not thread safe, as this code operates with both pointers.

In the obvious scnenario - interrupt handling - my psuedo code would be 
modified:

  buffer[1024];
    int onpointer=0,offpointer=0;

    procedure addbyte(data) {  // no exception handling
          buffer[onpointer]=data;
          onpointer++;
          onpointer= onpointer & 1023;
    }

    function getbyte() {
          res       // an integer, byte, float or string - depending on what you want
          disable interrupts   
          if (onpointer==offpointer) {
                 enable interrupts   
                 return 0;   // no data available
          } 		
          enable interrupts   
          res=buffer[offpointer];
          offpointer++;
          offpointer=offpointer & 1023
          ret res;
     }

Re: [lpc2000] Re: 5V tolerant i/o pins and also my comments on Circular buffers

2004-03-08 by J.C. Wren

Owen Mooney wrote:

> It strikes me that your are hitting at the problem the wrong way.
>
> Why don't you feed the 3.3.V output directly into the gate of a N
> channel enhancement mode MOSFET, and use the drain directly connected to
> your load - forget the UDN2981's.
>
> The circuit is simple. Micro output direct to mosfet gate, source to
> ground, drain to load. You can switch amps this way (depending on the
> size of FET you use), and hey! its cheap and circuit board efficient (if
> you use surface mount fets - does anyone use anything else these days).
>
> There are several simple FET circuits for handling a range of
> multivoltage I/O conditions. I  can put them in the files section if
> there is interest (I just have to work out how to submitt them!)

[ snip ]

Do not forget the reverse biasing diodes on the solenoid.  The inductive 
kick can generate an extremely high reverse voltage, which many FETs 
cannot handle.

If you visual the coil with the top side going to your power supply, and 
the bottom side going to the FET and ground, the diode should be placed 
so that the cathode goes to the top side of the coil, and the anode to 
the bottom side.  If you know the power supply voltage and the 
inductance of the coil, you can calculate the size diode you need.

    --jc

Re: 5V tolerant i/o pins gpio initial state..

2004-03-08 by onceinfour

Owen,
    Thanks for advice re using mosfets instead of UDN2981.  I think 
you will find thought that the Mosfet solution could not compete on 
price, or reliability either with a dedicated solenoid driver which 
the UDN2981 is.  We use 24V to power solenoids.  Still interested in 
Mosfet circuits.
    My next problem is to guarantee that the drivers come up in the 
off state after power-up.  i.e. need to ensure the i/p's remain low 
until the micro is running and sets up states correctly.  On LPC2xxx 
gpio pins are initialised as inputs, so presumably I need pull-downs 
on each pin.  Not very elegant!
Michael.


--- In lpc2000@yahoogroups.com, "J.C. Wren" <jcwren@j...> wrote:
> Owen Mooney wrote:
> 
> > It strikes me that your are hitting at the problem the wrong way.
> >
> > Why don't you feed the 3.3.V output directly into the gate of a N
> > channel enhancement mode MOSFET, and use the drain directly 
connected to
> > your load - forget the UDN2981's.
> >
> > The circuit is simple. Micro output direct to mosfet gate, source 
to
> > ground, drain to load. You can switch amps this way (depending on 
the
> > size of FET you use), and hey! its cheap and circuit board 
efficient (if
> > you use surface mount fets - does anyone use anything else these 
days).
> >
> > There are several simple FET circuits for handling a range of
> > multivoltage I/O conditions. I  can put them in the files section 
if
> > there is interest (I just have to work out how to submitt them!)
> 
> [ snip ]
> 
> Do not forget the reverse biasing diodes on the solenoid.  The 
inductive 
> kick can generate an extremely high reverse voltage, which many 
FETs 
> cannot handle.
> 
> If you visual the coil with the top side going to your power 
supply, and 
> the bottom side going to the FET and ground, the diode should be 
placed 
> so that the cathode goes to the top side of the coil, and the anode 
to 
Show quoted textHide quoted text
> the bottom side.  If you know the power supply voltage and the 
> inductance of the coil, you can calculate the size diode you need.
> 
>     --jc

Re: 5V tolerant i/o pins gpio initial state..

2004-03-08 by redsp@yahoo.com

--- In lpc2000@yahoogroups.com, "onceinfour" <mmack287@h...> wrote:
> Owen,
>     Thanks for advice re using mosfets instead of UDN2981.  I think 
> you will find thought that the Mosfet solution could not compete on 
> price, or reliability either with a dedicated solenoid driver which 
> the UDN2981 is.  We use 24V to power solenoids.  Still interested
in 
> Mosfet circuits.
>     My next problem is to guarantee that the drivers come up in the 
> off state after power-up.  i.e. need to ensure the i/p's remain low 
> until the micro is running and sets up states correctly.  On
LPC2xxx 
> gpio pins are initialised as inputs, so presumably I need
pull-downs 
> on each pin.  Not very elegant!

What is wrong with pull downs?  That seems very simple to me.  

But with this chip, unlike TTL, I think you don't need a pulldown. 
The circuit looks to me like it needs to be pulled up somewhat stiffly
(~0.25 mA @ 3.3 volts) to turn on, so a high impedance LPC output
would leave the driver off by default.

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.