This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Check here: http://www.ti.com/mcu/docs/mcuproductcontentnp.tsp?sectionId=95&familyId=342&tabId=3357
download the examples codes for your msp430 (msp430f22x4).
Regards
Gastón
hi Gastón,
Thanks for the info. Can I know which example is more suitable to my requirement ? Thanks for your help.
inside the zip file you downloaded from the page, check the examples for the adc and uart .Search in the community page for info that maybe be useful for you (lot of threads like you want to do).
regards
Gastón
Hi Gaston, Below is my code. I still having problem to transmit the data from the function generator. Can you tell me where i've write it wrongly ? Thanks...
/* Time to measure */
if (sSelfMeasureSem) {
volatile long temp;
int degC, TransmittedData,value;
int results[2];
#ifdef APP_AUTO_ACK
uint8_t noAck;
smplStatus_t rc;
#endif
/* Get temperature */
ADC10CTL1 = INCH_10 + ADC10DIV_4; // Temp Sensor ADC10CLK/5
ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ADC10IE + ADC10SR;
/* Allow ref voltage to settle for at least 30us (30us * 8MHz = 240 cycles)
* See SLAS504D for settling time spec
*/
__delay_cycles(240);
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE); // LPM0 with interrupts enabled
results[0] = ADC10MEM; // Retrieve result
ADC10CTL0 &= ~ENC;
/* Get TransmittedData */
ADC10AE0 |= 0x02;
ADC10CTL1 = INCH_4 + ADC10DIV_4; // waveform Sensor ADC10CLK/5
ADC10CTL0 = SREF_1 + ADC10SHT_2 + REFON + ADC10ON + ADC10IE + REF2_5V;
__delay_cycles(240);
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE); // LPM0 with interrupts enabled
results[1] = ADC10MEM; // Retrieve result
ADC10CTL0 &= ~ENC;
/* Stop and turn off ADC */
ADC10CTL0 &= ~ENC;
ADC10CTL0 &= ~(REFON + ADC10ON);
/* oC = ((A10/1024)*1500mV)-986mV)*1/3.55mV = A10*423/1024 - 278
* the temperature is transmitted as an integer where 32.1 = 321
* hence 4230 instead of 423
*/
temp = results[0];
degC = ((temp - 673) * 4230) / 1024;
if( (*tempOffset) != 0xFFFF )
{
degC += (*tempOffset);
}
/* message format, UB = upper Byte, LB = lower Byte
-------------------------------
|degC LB | degC UB | volt LB |
-------------------------------
0 1 2
*/
TransmittedData = results[1];
value = TransmittedData*0.024;
msg[0] = degC&0xFF;
msg[1] = (degC>>8)&0xFF;
msg[2] = value;
**Attention** This is a public forum