# portA, Bit0-Bit7

Started by January 14, 2008
Hello fellows
In Parallax BasicStamp one can define the logic state of 8 pins using something like: %11100111

Can we do something similar in BasicX?
Looking at the Hardware Reference Manual, pag 14 - "BX24 Pin Definitions", we see that pin 13-pin 20 have as Primary Function : portA, Bit0-Bit7

How can I use this function?
Thanx

David M.
David Sousa Mendes wrote:
> Hello fellows
> In Parallax BasicStamp one can define the logic state of 8 pins using something like: %11100111
>
> Can we do something similar in BasicX?
> Looking at the Hardware Reference Manual, pag 14 - "BX24 Pin Definitions", we see that pin 13-pin 20 have as Primary Function : portA, Bit0-Bit7
>
> How can I use this function?
> Thanx
>
> David M.
>
David,
See Special purpose registers in the Operating system reference.
You'll need to check with the device data sheet for the exact purpose of
each register.

PINA Input Pins, Port A
DDRA Data Direction Register, Port A
PORTA Data Register, Port A

from a previous post:
Register.DDRA = bx0000_0001 will set pin 20 high.

Ian
> from a previous post:
> Register.DDRA = bx0000_0001 will set pin 20 high.

Well, that post is not correct. register.DDRn sets the port pin
directions, input or output - not the state of the pins, which can be
set with the corresponding register.PORTn.

To set port pins pin 5 through 12 (Port C) to input, use:
Register.DDRC = 0
or to set pins 17 through 20 as outputs (and pins 13 through 16 as
inputs), use:
Register.DDRA = bx0000_1111

Then, to actually set the output pin states, set register.PORTn (for
example,
Register.PORTA = bx0000_0101
sets pins 17 and 19 low, and pins 18 and 20 high).
Tom
Thanx a lot!
BR

David M.

----- Original Message -----
From: Tom Becker
To: b...
Sent: Monday, January 14, 2008 4:40 PM
Subject: [BasicX] Re: portA, Bit0-Bit7
> from a previous post:
> Register.DDRA = bx0000_0001 will set pin 20 high.

Well, that post is not correct. register.DDRn sets the port pin
directions, input or output - not the state of the pins, which can be
set with the corresponding register.PORTn.

To set port pins pin 5 through 12 (Port C) to input, use:
Register.DDRC = 0
or to set pins 17 through 20 as outputs (and pins 13 through 16 as
inputs), use:
Register.DDRA = bx0000_1111

Then, to actually set the output pin states, set register.PORTn (for
example,
Register.PORTA = bx0000_0101
sets pins 17 and 19 low, and pins 18 and 20 high).

Tom