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.

Help!Try to input an external voltage to ez430-rf2500 target board.

Im quite new to this tool. My proj is to connect EKG board to eZ430-RF2500 target board. 1st of all, I tried to input a direct voltage to eZ430-RF2500 target board to fake as EKG signal.

I chose P2.0 (Pin 3 on the board) as input pin. Basically i juz follow the sample code "Temperature mearsure" and "Voltage measure" parts to add in code. Here is my code(simplified):

//Declaration (Only show the msg[] and result[] )
uint8_t msg[8];
int results[3];
int aNewVolt;

//Ports
P2DIR = 0x2E;

//This part is for temperature measurment (Omitted)

// I/p the voltage. I/p pin is P2.0 (pin 3, A0)
ADC10CTL1 = INCH_0; // A0
ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ADC10IE + ADC10SR;
__delay_cycles(350); // delay to allow reference to settle
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
__bis_SR_register(LPM0_bits + GIE); // LPM0 with interrupts enabled
results[2] = ADC10MEM;
ADC10CTL0 &= ~ENC;

//This part is for voltage measurment (Omitted)

//Passing value
aNewVolt=results[2];
msg[8]=aNewVolt;

I plug in the target board (without apply external voltage) and open the hyper terminal, the value of aNewVolt is 33 or 32.
Then i searched other forum. I saw some ppl also did similar thing as i did. I copied their code and aNewVolt value is still 32 or 33 when no input voltage is applied:

ADC10AE0 |= 0x01 ; // analog input enable for A0
ADC10CTL1 = INCH_0; // A0
ADC10CTL0 = ADC10SHT_2 + ADC10ON + ADC10IE + ADC10SR;
__delay_cycles(350); // delay to allow reference to settle
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE); // LPM0 with interrupts enabled
result[2] = ADC10MEM;
ADC10CTL0 &= ~ENC;

This code is from
http://forum.sparkfun.com/viewtopic.php?t=14528&highlight=ez430rf2500
I changed it slightly.

It is supposed to be 0 if i dont apply voltage, rite? Anybody plzzzz help me wiv the code?????
Plus, the ground from power generator must connect to ground pin rite? Tks!!!

  • Last nite i changed my code to:

    //P2REN |= 0x01;  // Disable this one in the pins setting(I dont know what this instruction is used for)

    The rest are the same. What i get is if i apply a variable external voltage to the target board, I always get a same number(55).

    If i take away the voltage, the value is jumping.

    Anyone can help me ???? Tks a lot

  • Here is what i did last nite:

    P2DIR = 0x2E;
    //P2REN |= 0x01;
    P2OUT = 0x00;
    // Configure P2.0 as analog pins
    P2SEL |= 0x01;
    // Configure P2.0 as inputs
    P2DIR &= ~0x01;

    // Measure Temperature(Omitted)

    // Measure Battery Voltage(Omitted)

    // i/p voltage
    ADC10AE0 |= 0x01 ; // analog input enable for A0
    ADC10CTL1 = INCH_0; // A0
    ADC10CTL0 = ADC10SHT_3 + ADC10ON + ADC10IE + ADC10SR;
    __delay_cycles(350); // delay to allow reference to settle
    ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
    __bis_SR_register(LPM0_bits + GIE); // LPM0 with interrupts enabled
    results[2] = ADC10MEM;
    ADC10CTL0 &= ~ENC;
    ADC10CTL0 &= ~(REFON + ADC10ON); // turn off A/D to save power
    //

    aNumber= results[2];

    I thought Vref is for sampling...So i juz turn it off. Same result. I apply variable voltage, the aNumber value show 49. I also use my both hands to touch it (each on P2.0 and ground), the value is also 49.

    Then I added breakpoints to check. After running

    results[2] = ADC10MEM;

    The console window shows:

    MSP430: Can't Run Target CPU: No error

    What is this suppose to mean??????

    Plus i found the aNumber value is the same as the volt value (to measure the battery voltage), 49.

    What is going on????
    anyone can help?

  • If you create a new project (IAR [3], CCE [4]) and attempt to load a simple TI code example[5], do you see the same issue? If so, please send a screen image of the error message.

  • Yesterday my supervisor came back. He said my direction was wrong. Anyway, I stopped what i hav done. [:'(]

    Tks for all your attention.

    But i think i will post another topic very soon,,,,,,,,,,,,XD

  • Hi!

    I know it's been years, but did you ever figure out what was wrong with your code? I'm playing with the MSP430 and I'd like to try something similar.

    Thanks!

  • A possible reason for the failure could be a CPU crash. The code (as far as posted) does enable the ADC10 interrupt and also enables global interrupts before going into low power mode (standby), but there was no ISR to handle the interrupt when the conversion is done. So the CPU jumps into the void and crashes or resets.

**Attention** This is a public forum