Skip to main content
danny23
Associate II
February 25, 2004
Question

PORT A

  • February 25, 2004
  • 2 replies
  • 737 views
Posted on February 25, 2004 at 15:04

PORT A

This topic has been closed for replies.

2 replies

jdaniel
Associate III
May 17, 2011
Posted on May 17, 2011 at 11:58

DOTT,

Sure... try something like this (assuming you're writing in Keil C and have defined a variable called psd_regs at csiop):

psd_regs.CONTROL_A = 0x00; /* All pins set to GPIO mode */

psd_regs.DIRECTION_A = 0xFF; /* All pins set to outputs */

psd_regs.DRIVE_A = 0x00; /* All pins CMOS drive / low slew-rate */

psd_regs.OUTENABLE_A = 0xFF; /* All outputs enabled */

after that setup, you would be able to do something like

psd_regs.DATAOUT_B = 0x84;

and have the corresponding bits on the port set or cleared. If you want to switch them to inputs, you'd have to do something like:

psd_regs.DIRECTION_A = 0x00; /* All pins now inputs */

var = psd_regs.DATAIN_A;

Also, you can set each pin individually as an input or an output. It's a bit complicated, but it's explained pretty well in the datasheet.

Let me know if that works for you.

Best Regards,

Phaze426

danny23
danny23Author
Associate II
May 17, 2011
Posted on May 17, 2011 at 11:58

Can anyone please send or post a sample code on how to interface to PORT A as GP I/O?

How can i write a byte to port A and have it stay there untill i write something else?

How can i read from Port A?

Anything can help

Thank you