SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
By jwong744
#86122
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.

Thanks for any help.
By gm
#86157
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.

HTH,

gm
By jwong744
#86169
thanks for your help, GM.
Simple answers like yours don't come around too often.
I'll keep you updated on how it works.
By jwong744
#86248
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.

thanks for any help.
By gm
#86253
You need to create a buffer for the converted value to be placed into so that LCDStr() can print it out. Something like this:
Code: Select all
#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 );