Electronic https://tech.feedyourhead.at/tags/electronic en Running LED on a Tiva-Board TM4C1294XL https://tech.feedyourhead.at/content/running-led-tiva-board-tm4c1294xl <span class="field field--name-title field--type-string field--label-hidden">Running LED on a Tiva-Board TM4C1294XL</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>For my studies I have to work with the Tiva-Board TM4C1294XL. I was quite lost when I tried to find examples in the internet. For all the poor souls who have to work with the tiva-board TM4C1294XL, I am going to publish the code I have to write on it. Here is some simple code for a runnig LED-light. If you push the USR1-button, it will change it's direction.</p> <pre> <code> #include <stdint.h> #include <stdbool.h> #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/gpio.h" #include "drivers/pinout.h" #include "driverlib/pin_map.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/sysctl.h" #include "inc/tm4c1294ncpdt.h" void WriteOut(uint8_t bitmask) { GPIOPinWrite(GPIO_PORTN_BASE,GPIO_PIN_0 | GPIO_PIN_1,0x0); GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_0 | GPIO_PIN_4,0x0); if(bitmask == 0) return; if( (bitmask &amp; 1) || (bitmask &amp; 16) ) { GPIOPinWrite(GPIO_PORTN_BASE,GPIO_PIN_0 | GPIO_PIN_1,0x2); } if( (bitmask &amp; 2) || (bitmask &amp; 32) ) { GPIOPinWrite(GPIO_PORTN_BASE,GPIO_PIN_0 | GPIO_PIN_1,0x1); } if( (bitmask &amp; 4) || (bitmask &amp; 64) ) { GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_0 | GPIO_PIN_4,0x10); } if( (bitmask &amp; 8) || (bitmask &amp; 128) ) { GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_0 | GPIO_PIN_4,0x1); } } int main(void) { volatile int delay = 700000; volatile int direction = 1; volatile uint8_t runner = 1; uint32_t config_strength, config_type; SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ); GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE,GPIO_PIN_0 | GPIO_PIN_1); GPIOPinWrite(GPIO_PORTN_BASE,GPIO_PIN_0 | GPIO_PIN_1,0x0); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE,GPIO_PIN_0 | GPIO_PIN_4); GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_0 | GPIO_PIN_4,0x0); GPIOPinTypeGPIOInput(GPIO_PORTJ_BASE,GPIO_PIN_0); GPIOPadConfigGet(GPIO_PORTJ_BASE,GPIO_PIN_0,&amp;config_strength,&amp;config_type); GPIOPadConfigSet(GPIO_PORTJ_BASE,GPIO_PIN_0,config_strength,GPIO_PIN_TYPE_STD_WPU); if(direction == 1) runner = 0; WriteOut(0); while(1) { if(GPIOPinRead(GPIO_PORTJ_BASE,GPIO_PIN_0) == 0) { if(direction == 0) direction = 1; else richtung = 0; } WriteOut(runner); SysCtlDelay(delay); if(direction == 0) { if(runner == 0) runner = 1; else runner = runner &lt;&lt; 1; } else { if(runner == 0) runner = 0x8; else runner = runner &gt;&gt; 1; } } } </code></pre> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Oct 01 2015</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/tm4c1294xl" hreflang="en">TM4C1294XL</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/c" hreflang="en">C</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Programming" hreflang="en">Programming</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/hardware" hreflang="en">Hardware</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/electronic" hreflang="en">Electronic</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/microcontroller" hreflang="en">Microcontroller</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=114&amp;2=comment&amp;3=comment" token="M_b41FhfcGGV_51pqf4pLN8DiPzm8PwIWBx7oPidUEw"></drupal-render-placeholder> </section> Thu, 01 Oct 2015 07:21:14 +0000 Hoti 114 at https://tech.feedyourhead.at