Please Help ( about AVR Micro )

Status
Not open for further replies.

NTFS

Member level 3
Joined
Apr 6, 2004
Messages
66
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
565
Hi

What is different between PIND ($10) and PORTD ($12) in AT90S1200?

How can I read from and also write to port D?

Thanks in advance

NTFS.
 

Be very careful remembering which to use under which conditions, as reading the wrong register is the cause of more than a few beginner program problems. PortD is primarily for controlling the port when it's configured as an output (DDRB == 1) As setting portb will change it from sourcing to sinking curent. When DDRD == 0 (set to input) portD controls weather or not the internal pullup resistors are enabled or not (1 == pullups on, 0 == pin is floating) PinD is a direct access register to the logic state of the pins. When DDRB is set to 0 you read the pin register to read the state of the pin. So remember, DDRD is for setting input/ouput PORTD is for setting I/O source/sink and individual pullups, and PIND will always return the current logic state of the port (mind you this can detect short circuits in or out of an I/O pin if the pin port is exactly opposite of what it's supposed to be)
 

    NTFS

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…