PORT A
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-02-25 6:04 AM
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 2:58 AM
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 youOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 2:58 AM
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