Jump to content

Energia Port Manipulation Or Equivalent?

Recommended Posts

Tiva C TM4C123G


Energia 0101E0012

Windows 7 Ult 64-Bit

I've been looking to see if their is any equivalent version of the Arduino DDRD,PORTD or some way to write pins on or off at the same time with Energia. I saw that the pins are labeled P!#(!=Letter A-F # 0-7) as port A B C D E F. I wanting to interact with something (YM2612) but it has a 8 bit data bus.

Hope some one can inform me of any ways of port or ect.

Link to post
Share on other sites

Energia provides abstraction but does not prevent direct access to ports, bytes and bits. So you could do simple OR'ing to turn ports on when you want, and keep ports on if they're already on much like one can do such in CCS or other IDE's.


Nutshell is that Energia does not prevent you from going from the abstraction Energia provides to using C / C++ constructs and defines addressing the hardware directly.


Or at least that's what I've gathered over time.

Link to post
Share on other sites

Accessing the port registers on TivaC can be a bit tricky. It's easier use the driverlib. You will get low level access without to much overhead.

For example, the GPIOWrite function can be used to write directly to a GPIO register setting/clearing multiple bits at a time. For API details see 


Writes a value to the specified pin(s).
   GPIOPinWrite(uint32_t ui32Port,
                uint8_t ui8Pins,
                uint8_t ui8Val)
    ui32Port is the base address of the GPIO port. 
    ui8Pins is the bit-packed representation of the pin(s).
    ui8Val is the value to write to the pin(s).
Writes the corresponding bit values to the output pin(s) specified by ui8Pins. Writing to a pin configured as an input pin has no effect.
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
Link to post
Share on other sites
  • 1 year later...

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