Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help!Try to input an integer to ez430-rf2500 target board

Status
Not open for further replies.

bettyxyz1028

Newbie level 6
Joined
Sep 25, 2009
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,398
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;

}
 

Re: Help!Try to input an integer to ez430-rf2500 target boar

Hi,
You've got several errors in the code, so writing a concise answer to your problem impossible.
Additionally, you don’t show enough code for us to figure out exactly what is it you're trying to do and find all errors.

I'm guessing you want to setup some sort of serial communication, but it seems you're using the wrong port for that purpose. A quick look in the datasheet shows pins P3.4 / P3.5 as UCA0_TX / RX, respectively, and not P2.0 (which is an analog input).
I won't go into how to configure the pins (you'll find it in the user manual), but the code related to P2.0 is irrelevant and you can remove it.
Anyway, I wanted to point out another error when you write
Code:
P2DIR |= 0x00;   // has no meaning: leaves all bits intact. Should be "&="
As a general rule, AND (&) with 0 will reset (make something 0), and OR (|) with 1 will set (make something 1). Other combinations will leave the bits unchanged.

Arthur
 
Re: Help!Try to input an integer to ez430-rf2500 target boar

Tks a lot! I am quite new to this tool. XP

I download some sample code from TI. The whole programming is based on the SHE monitor sensor sample code. I change my code today(I juz write the main parts):

int aNumber

main
{
P1DIR = 0xFB; // P1.2 (button) = input
P1OUT = 0x04; // P1.2 pullup
P1REN |= 0x04; // P1.2 pullup
P1IE |= 0x04; // P1.3 interrupt enabled
P1IES |= 0x04; // P1.3 Hi/lo edge
P1IFG &= ~0x04; // P1.3 IFG cleared
P2DIR = 0x2E;
P2REN |= 0x01;
P2OUT = 0x01;
P3SEL = 0x30; // P3.4,5 = USCI_A0 TXD/RXD
P3DIR = 0xFF; // All P3.x outputs
P3OUT = 0; // All P3.x reset
P3REN |= 0x20; // Enable Pull-Down Res for /Charge
P4DIR = 0xFF; // setup port 4
P4OUT = 0x00;

//Initialize Tx
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 8; // 1MHz 115200
UCA0BR1 = 0; // 1MHz 115200
UCA0MCTL = UCBRS1 + UCBRS0; // Modulation UCBRSx = 3
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
__bis_SR_register(LPM3_bits + GIE); // Enter LPM3, interrupts enabled
}


#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
aNumber = UCA0RXBUF;
}
 

Re: Help!Try to input an integer to ez430-rf2500 target boar

...and what's the question?
 

Re: Help!Try to input an integer to ez430-rf2500 target boar

aHHHH I FORGOT to post a question..............i was too tired tat day.

when i push the push button, it shows red light instead of green light. I check n find if i erase the port 3 initial setting, the green led would light.

then i think it might be the baud rate problem. So i changed the baud rate to 9600 which is same as AP.

Red LED shines as well..............

Anyone can help??? Tks so much!!

Added after 6 minutes:

Plus, the P3.4 and 3.5 are on the battery board. So i juz connect the battery board?
 

Re: Help!Try to input an integer to ez430-rf2500 target boar

P3.5 can not be used. B/c it is used to communicate with solar chip.............
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top