bettyxyz1028
Newbie level 6
I wanna connect another hardware to this target board. That target board will send an integer to this target board.
I choose P2.0 as input pin.
But when i open putty.exe to check the transmission data, i only see 60.
By right, i should see aNumber=0 when there is no input apply to port. Is it?
Here is the code (only extract the some part):
int aNumber;
P2IN |= 0x01;
//P2.0 = input
P2DIR |= 0x00;
//P2.0 = input
P2IE |= 0x01;
// P2.0 interrupt enabled
P2SEL |= 0x01;
// P2.0 = USCI_A0 TXD/RXD
UCA0CTL1 = UCSSEL_2;
// SMCLK
UCA0BR0 = 0x41;
// 9600 from 8Mhz
UCA0BR1 = 0x3;
UCA0MCTL = UCBRS_2;
UCA0CTL1 &= ~UCSWRST;
// **Initialize USCI state machine**
IE2 |= UCA0RXIE;
// Enable USCI_A0 RX interrupt
msg[7] = aNumber; // Add onw more location to msg[] to transmit the value from End device to Access point.
//USCIA interrupt service routine
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR (void)
{
aNumber = UCA0RXBUF;
}
I choose P2.0 as input pin.
But when i open putty.exe to check the transmission data, i only see 60.
By right, i should see aNumber=0 when there is no input apply to port. Is it?
Here is the code (only extract the some part):
int aNumber;
P2IN |= 0x01;
//P2.0 = input
P2DIR |= 0x00;
//P2.0 = input
P2IE |= 0x01;
// P2.0 interrupt enabled
P2SEL |= 0x01;
// P2.0 = USCI_A0 TXD/RXD
UCA0CTL1 = UCSSEL_2;
// SMCLK
UCA0BR0 = 0x41;
// 9600 from 8Mhz
UCA0BR1 = 0x3;
UCA0MCTL = UCBRS_2;
UCA0CTL1 &= ~UCSWRST;
// **Initialize USCI state machine**
IE2 |= UCA0RXIE;
// Enable USCI_A0 RX interrupt
msg[7] = aNumber; // Add onw more location to msg[] to transmit the value from End device to Access point.
//USCIA interrupt service routine
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR (void)
{
aNumber = UCA0RXBUF;
}