Hello all!
Here’s the rundown:
I’m using an MSP430F169 on an Olimex MSP430P169 Dev. Board to monitor a circuit board that we developed.
One part of this task is to monitor two resistors. Basically, I want to see if they ‘power on’ in a specified amount of time. I also need to know which order they ‘turn on’ in.
I’ve used Visual Basic to establish a program to test the circuit boards so any of our line technicians can perform the tests.
Here is my problem:
Visual Basic is setup to communicate with the UART of the MSP430. It sends a character to set off a receive interrupt. The interrupt should then transmit back the state of the resistors. Here are the five states I need:
‘A’ - Nothing Is On
‘B’ - Only R1 Is On
‘C’ - Only R2 Is On
‘D’ - R1 Came On Then R2
‘E’ - R2 Came On Then R1
I’m using the ADC to monitor two pins which will, in the end, be monitoring the resistors. Right now, they are tied to 3.3V and 0.0V.
Using IAR 4.10 to create my project and TeraTerm to monitor UART/PC communication, I’ve found no problems when using this ‘test’ code:
#pragma vector=USART0RX_VECTOR
__interrupt void usart0_rx (void)
{
while (!(IFG1 & UTXIFG0)); //USART0 TX Buffer Ready?
//Test - For Program Verification Only!
if (ADC12MEM2 > 0x00F)
TXBUF0 = ‘H’;
else
TXBUF0 = ‘L’;
}
It sends an ‘H’ or ‘L’, which says P6.2 is high or low (2.5V or 0.0V).
The ultimate goal is to have an if statement to determine which one of the above states (A - E) has occurred, but nothing is working for me.
I could make a global character variable, ‘static char state’, inside the ADC Initialize routine and setup an if statement to set that variable ‘state’ inside the ADC interrupt. Then I could make TXBUF0 = state inside the UART interrupt, and my problem would be solved, right? Wrong. TXBUF0 won’t take that variable.
Am I doing something wrong? Wrong variable? Wrong declaration?
Even worse, I can’t think of a scheme to implement if statements to find which state the board is in!
Any ideas? Code would be nice, but all ideas are appreciated. I have no problem writing out the code for someone’s idea.
I know there are a lot of bright minds running around in here, so, I thank you all in advance.
-Mark