Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Connecting AVRs directly to inputs of 74HC and LS logic chips.

2006-04-03 by James Hatley

Yes, Jose, good point on pull ups. I forgot about them as I never use them
here. I disable them globally. Old habits from using Motorola processors and
if pull ups are needed I put the specific one required external to the
processor.

Good luck with your project.

Jim

----- Original Message ----- 
From: "Jose Fuentes" <josecarlosfuentes@yahoo.com.ar>
To: <AVR-Chat@yahoogroups.com>
Sent: Monday, April 03, 2006 11:57 AM
Subject: Re: [AVR-Chat] Connecting AVRs directly to inputs of 74HC and LS
logic chips.


> --- James Hatley <james.hatley@comcast.net> escribió:
>
> > Jose,
> >
> > All Atmel processors (as far as I know anyway) have
> > three registers for a
> > port, one is for setting the output bits that you
> > have declared output
> > (PORTA), one is for reading the input bits you
> > declared input (PINA) and of
> > course, the DDRA register for setting which bits are
> > input and which are
> > output.
>
> But it doesn't mean you can not write on the
> corresponding register PORTx of an input pin.  When
> you configure a pin as input, and write a "0" to it
> (by writing PORTx register) the pin enters in high-Z
> state, if you write a "1" to it and PUD bit is set,
> then pin is pulled-up.
>
> Also you can read PORTx registers because they are
> read/write registers.
>
> > Register PINA is used when you want to read the
> > input of the port or just
> > read a bit in the register. It reflects the input to
> > PORTA.
>
> You are right, PINA is a read-only register.
>
> > Register PORTA is used when you what to set bits of
> > the port or just set a
> > bit. If you read PORTA it is reading what is
> > programmed in to the output
> > register for PORTA.
> >
> > It all depends on how you have set DDRA, inputs or
> > outputs as to what
> > register you use and what you want to do with the
> > bit.
> >
> > To set a bit with the bit declared output high use
> > PORTA=PORTA|0x01;, to use
> > your example. Or to set it low use PORTA=PORTA&0xfe;
> > ( Most use macros here
> > to manipulate bits as it is much more fool proof. )
> >
> > To read a bit with the bit declared input use
> > FOO=PINA&0xfe, to use your
> > example.
> >
> > Maybe this is too simplified but hope it helps some,
> >
> > Jim
> >
> >
> >
> >
> > ----- Original Message ----- 
> > From: "Jose Fuentes"
> > <josecarlosfuentes@yahoo.com.ar>
> > To: <AVR-Chat@yahoogroups.com>
> > Sent: Sunday, April 02, 2006 11:39 PM
> > Subject: Re: [AVR-Chat] Connecting AVRs directly to
> > inputs of 74HC and LS
> > logic chips.
> >
> >
> > > I have a board with an AVR driving a LS chip
> > directly,
> > > and it works fine.  But I had problems with source
> > > code like this:
> > >   PORTA = PINA | 0x01;
> > > It seems that under certain conditions PORTA is
> > not
> > > equal to PINA.  I modified the code like this:
> > >   PORTA = PORTA | 0x01;
> > > and it solved the problem.
> > >
> > > The first thing that comes to mind when you say
> > that
> > > "AVR was unable to pull the input on the logic
> > chip
> > > completely low" is that AVR pin was actually set
> > as
> > > input.  That way you would be pulling high the pin
> > by
> > > using the internal pull-up.  But you woudn't be
> > able
> > > to pull down the pin because it just would enter
> > into
> > > high impedance state.
> > >
> > >
> > >
> > >
> > > Regards
> > >
> > > Jose
> > >
> > >
> > >
> > > > kernels_nz wrote:
> > > > > Hi Guys,
> > > > >
> > > > > Ive had two different boards lately give a lot
> > of
> > > > trouble, both had
> > > > > OUTPUTS on AVR chips connected directly to
> > inputs
> > > > on 74HC and 74LS
> > > > > logic chips.
> > > > >
> > > > > Looking at it with my scope, it appeared that
> > the
> > > > AVR was unable to
> > > > > pull the input on the logic chip completely
> > low ?
> > > > It would pull it to
> > > > > around 1 to 3 volts for a low output.
> > > > >
> > > > > I did ensure that the pins were set up as
> > OUTPUTS,
> > > > nothing else
> > > > > weird.
> > > > >
> > > > > Both problems were solved by connecting 100k
> > > > resistors from the input
> > > > > pins on the logic chips to ground.
> > > > >
> > > > > Any ideas ? Im sure it will be obvious as soon
> > as
> > > > someone points out
> > > > > the obvious, but it's got me beat.
> > > > >
> > > > > Cheers
> > > > > Hein B
> > > > > Andante Technology
> > > > > Auckland
> > > > > New Zealand.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Yahoo! Groups Links
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > > -- 
> > > >
> > -------------------------------------------------
> > > > Dennis Clark          TTT Enterprises
> > > > www.techtoystoday.com
> > > >
> > -------------------------------------------------
> > > >
> > > >
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >     AVR-Chat-unsubscribe@yahoogroups.com
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > __________________________________________________
> > > Correo Yahoo!
> > > Espacio para todos tus mensajes, antivirus y
> > antispam ¡gratis!
> > > ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
> > >
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >     AVR-Chat-unsubscribe@yahoogroups.com
> >
> >
> >
> >
> >
>
>
> __________________________________________________
> Correo Yahoo!
> Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
> ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>

Attachments

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.