Hi i’m working on my senior project with this development board. I’ve been trying to display thermocouple data captured by the ADC to be display on the LCD provided. Does anyone have any ideas of getting this work. I’ve used the samples from TI to start the ADC, but i’m not sure how to display the data. The sample code from Olimex doesn’t show much about displaying continuous data. I’m also pretty new to microcontrollers and programming them.
The sample code from Olimex contains a routine called LCDStr() which takes an ASCII string and prints it at the designated row on the LCD. Take the 12-bit integer output from the ADC, convert the integer to a string using atoi() and then print out the string using LCDStr().
If you performing any floating point math on the ADC value, just use sprintf() to do the conversion from floating point to ASCII.
Well i got the ADC to sample and store to the register using the sample Ti code. But i can’t seem to use the LCDStr() and atoi() to display the data. I formatted it like this LCDStr(0, “atoi(ADC12MEM0)”);, it just displayed atoi(ADC12MEM0). I also tried just using a variable like Y. LCDstr (0, Y) & LCDstr (0, “%d”, Y) where Y =atoi(ADC12MEM0), it errored when i did that. I tried a few more combinations with no luck. Is there something i’m missing.
You need to create a buffer for the converted value to be placed into so that LCDStr() can print it out. Something like this:
#include <stdlib.h>
unsigned int ThermData; // holds thermocouple data
char Buffer[6]; // 5 digits plus terminator
// Get thermocouple value and
// convert to ASCII
ThermData = ADC12MEM0;
itoa( ThermData, Buffer, 10 );
// Print it out on the LCD
LCDStr( 0, Buffer );