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.

small problem in my code !! any help

Other Parts Discussed in Thread: CC2530

hi sir ... i am using a cc2530 board with 2 uart ...i want 2 connect both the uart to my pc and use 2 hyperterminals and i aim to get the characters i type in 1 hyperterminal via the other hyper terminal .. but i couldnt make it rite .. need yourr help ...here s my code sir 

#include <ioCC2530.h>
#include <string.h>

#define uint unsigned int
#define uchar unsigned char

void Delay(uint);
void initUARTSEND(void);
void initUART1SEND(void);
uchar Recdata[1];
uchar Recdata1[1];
//uchar RXTXflag = 1;
uchar temp;
uint datanumber = 0;
//uint stringlen;

void UartTX_Send_String(uchar *Data,int len);

void UartTX_Send_String1(uchar *Data,int len);

uchar Txdata[25]={'Z',0x0D};
/****************************************************************
ÑÓʱº¯Êý 
****************************************************************/
void Delay(uint n)
{
uint i;
for(i=0;i<n;i++);
for(i=0;i<n;i++);
for(i=0;i<n;i++);
for(i=0;i<n;i++);
for(i=0;i<n;i++);
}
/****************************************************************
´®¿Ú³õʼ»¯º¯Êý 
****************************************************************/
void initUARTSEND(void)
{

CLKCONCMD &= ~0x40; //ÉèÖÃϵͳʱÖÓԴΪ32MHZ¾§Õñ
while(CLKCONSTA & 0x40); //µÈ´ý¾§ÕñÎȶ¨
CLKCONCMD &= ~0x47; //ÉèÖÃϵͳÖ÷ʱÖÓÆµÂÊΪ32MHZ


PERCFG = 0x00; //λÖÃ1 P0¿Ú
P0SEL = 0x3c; //P0_2,P0_3,P0_4,P0_5ÓÃ×÷´®¿Ú
P2DIR &= ~0XC0; //P0ÓÅÏÈ×÷ΪUART0

U0CSR |= 0x80; //UART·½Ê½
U0GCR |= 9; 
U0BAUD |= 59; //²¨ÌØÂÊÉèΪ19200
UTX0IF = 1; //UART0 TXÖжϱêÖ¾³õʼÖÃλ0
U0CSR |= 0X40; //ÔÊÐí½ÓÊÕaa
IEN0 |= 0x84;
IEN2 |= 0X0C;
}
/****************************************************************

****************************************************************/

void initUART1SEND(void)
{

PERCFG = 0x02; //λÖÃ1 P0¿Ú
P1SEL = 0xF0; //P0_2,P0_3,P0_4,P0_5ÓÃ×÷´®¿Ú
// P2DIR &= ~0XC0; //P0ÓÅÏÈ×÷ΪUART0
// P1DIR = 0X80;
P2SEL = 0X40;
U1CSR |= 0x80; //UART·½Ê½
U1GCR |= 9; 
U1BAUD |= 59; //²¨ÌØÂÊÉèΪ19200
UTX1IF = 1; //UART0 TXÖжϱêÖ¾³õʼÖÃλ0
U1CSR |= 0X40; //ÔÊÐí½ÓÊÕaa
IEN0 |= 0x88;
IEN2 |= 0X0C;
}
void UartTX_Send_String(uchar *Data,int len)
{
int j;
for(j=0;j<len;j++)
{
U1DBUF = *Data++;
while(UTX1IF == 0);
UTX1IF = 0;
}
}
void UartTX_Send_String1(uchar *Data,int len)
{
int j;
for(j=0;j<len;j++)
{
U0DBUF = *Data++;
while(UTX0IF == 0);
UTX0IF = 0;
}
}
/****************************************************************
Ö÷º¯Êý 
****************************************************************/
void main(void)

//uchar i;
initUARTSEND();
initUART1SEND();
//void initUART1SEND(void);


UartTX_Send_String(Txdata,sizeof(1));

while(URX1IF && U1RX_BYTE)

Recdata[0] = temp;

//UartTX_Send_String(Txdata,sizeof(1));
Recdata1[0]=Recdata[0]; 


//temp = 0;
UartTX_Send_String1(Recdata1,sizeof(1)); 

}
}

#pragma vector = URX1_VECTOR
__interrupt void UART1_ISR(void)
{
URX1IF = 0; //ÇåÖжϱêÖ¾
temp= U1DBUF;
}