EMBEDDED ELECTRONICS IMPLEMENT CODE USING KEIL UVISION FOR TIVA C SERIES TM4C123G LAUNCHPAD

profilemurali123
EMBEDDEDELECTRONICSIMPLEMENTCODEFORTIVACSERIESTM4C123GUSINGKEIL.docx

There is no write up required, only code;

System requirements:

Analog Time Series Processing:

1) Sample the internal temperature sensor or PE3 at 1kHz and use DMA ping pong mode

to store measurements into memory. (Processor should be running 40MHz)

2) Every 100 (0.1s) samples will be considered a frame, find the average and std of each.

3) Every 10 frames (1s) report out through UART the ave and std of each frame:

Packet:3430 Ave: 241 241 236 240 235 237 242 240 233 238

Std: 135 137 132 134 134 135 134 134 135 134

Packet: 3440 Ave: 246 245 244 236 241 243 250 239 242 242

Std: 134 135 135 131 133 135 136 133 138 139

4) In addition to calculating the average and standard deviation, add a line to be done for

each frame. SysCtlDelay(1000000); //Simulated Process

Timing Events:

1) When SW1 or SW2 is pressed and then released, report out via UART:

“Button 1 Pressed for 123456 cycles.”

2) Should avoid reporting bounces.

3) Can assume only one button will be pressed at a time.

Command Parsing:

1) Setup PWM on the 3 LEDs (suggest time on PWM’s as 256 or other power of 2)

2) Command through UART will be a single letter and then a 1 to 3 digit number, followed

by the return character, so for example; “r127\r” will set the red LED to half power,

“b255\r” blue full power, “g1\r” green to nearly off.

3) Commands should echo back to the terminal window.

4) “Invalid Command” should be printed in terminal if command not recognized

UART Buffering:

1) UART Tx only has a 16 FIFO buffer (which you need to use), however, many of the

messages you will need to send for this program will be longer than this.

2) Make an additional buffer for your UART TX using an array and a couple variables to

track the indexes.

3) Use UART TX interrupt to detect the FIFO emptying and push message from buffer.

4) By using FIFO for TX, FIFO for RX will be on, you may need to ‘flush’ the RX FIFO

before parsing commands.

Note: ADC_DMA is a great example to start from for Analog part

UART0_terminal is good to start with, but note a typo in the comments (ln48), to arm the

TX interrupts it’s UART_INT_TX, not UART_INT_RT.