ahmad2005
Member level 1
- Joined
- Mar 30, 2011
- Messages
- 40
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 1,288
- Location
- Mirpur,Dhaka,Bangladesh
- Activity points
- 1,618
Not able to transfer character from a array to an another array
Look at my code. at this line "UART1_Write_Text(UP_STATUS);" I was supposed to get all 6 characters of variable UP_STATUS but it only gives three. probably, codes r not appropriately written for array variables UP_STATUS[3] to UP_STATUS[5]. Can anyone suggest me how can I fix this?
Look at my code. at this line "UART1_Write_Text(UP_STATUS);" I was supposed to get all 6 characters of variable UP_STATUS but it only gives three. probably, codes r not appropriately written for array variables UP_STATUS[3] to UP_STATUS[5]. Can anyone suggest me how can I fix this?
Code:
char UP_STATUS[5];
int DimTime = 123;
char DimTimeTXT[2];
if((uart_string[0] == 'U')&&(uart_string[1] == 'P')) {
if(PORTA.RA2==1){UP_STATUS[0]='1';} else {UP_STATUS[0]='0';}
if(PORTA.RA3==1){UP_STATUS[1]='1';} else {UP_STATUS[1]='0';}
if(PORTA.RA4==1){UP_STATUS[2]='1';} else {UP_STATUS[2]='0';}
IntToStr(Dimtime,DimTimeTXT);
UP_STATUS[3] = DimTimeTXT[0];
UP_STATUS[4] = DimTimeTXT[1];
UP_STATUS[5] = DimTimeTXT[2];
UART1_Write_Text(UP_STATUS); // here I was supposed to get: 000123 [considering PORTA ALL 0] but it only gives: 000 [only first three character.
uart_string[0] = ""; ////Question is where is other three
uart_string[1] = "";
}