Jump to content

Port manipulation on msp-EXP430G2

Recommended Posts


I'm trying to read all the IO from a port (port 2) on my M430G255 MCU . On arduino I could have use the line

DDRB = B11111111; 
data = PINB;

I've read some posts but no one talks about port manipulation on energia and msp boards clearly.

can someone help me figure out how to woks with registers and msp boards ?




I found the register file on the energia installation folder, but every time that i try to charge e a register I get the error:

expected unqualified-id before numeric constant


Link to post
Share on other sites

On MSP430 device you can access the port with mainly three registers:

PxIN   : read input from port x (8 Bit)

PxOUT   : set output level on port x (8 Bit) (only if direction set to output)

PxDIR   : set direction on port x (0:input  1: output)

where x is the port number


Read input

    inputvalue = P2IN;

Set port P2.0 to output high

   P2DIR = 0x01;

   P2OUT = 0x01;


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...