Jump to content
curtis63

Set PinMode on 2 pins simultaneously

Recommended Posts

I'm writing my own i2c library and need to be able to simultaneously change PinMode on 2 pins.  One for SCL and one for SDA.  Is there a way to change PinMode on 2 pins simultaneously?

 

I want the behavior of the follwing:

 

PinMode(14,OUTPUT);

PinMode(15,INPUT);

 

without the 2.5microsecond delay between the 2 calls above.

Share this post


Link to post
Share on other sites

Hi,

 

I've been following your bit-bang I2C efforts.

If you are making a custom version, perhaps using direct port I/O would be useful?

 

As follows:

 

P1DIR |= BIT7 + BIT6;       // make these outputs

P1OUT |= BIT7 + BIT6;     // make them simultaneously go hi

P1OUT &= ~(BIT7+BIT6);  //  ditto, but go low

 

The only thing is that it departs from energia statements.

 

I suspect you must have a scope / logic analyser or you wouldn't have known / measured the delay between the two PinMode statements you tried? 

 

Is this OK for your app?

 

Cheers,

Share this post


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.

Guest
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...