MKVRAJU
Junior Member level 2
- Joined
- Jun 14, 2013
- Messages
- 20
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 3
- Activity points
- 160
I am trying to transmit a string and raised receive interrupt as
taking buf[20]
I used
when i am using value 2 here , the loop discontinues when 3 data characters are filled and remaining array is replaced by 3 char.
when i am using value 3 here, the loop discontinues when 4 data char are filled
when i am using value 0 or 1 , it prints the same what typed ,with out filling the char array.
where does my logic go wrong ? I want to print a string of length for example " this is test".
I want to get
[TX] : this is test
[RX] : this is test
In the case if I want to add a big paragraph, i cannot mention a particular size like buf[20], then how to initialize ?
taking buf[20]
Code:
void _attribute__((__interrupt__,no_auto_psv)) _U1RXInterrupt(void){ // This is UART1 receive ISR
IFS0bits.U1RXIF = 0;
for(i=0;i<20;i++)
buf = ReadUART1();
putsUART1((unsigned int*)buf);
}
I used
Code:
U1MODEbits.LPBACK = 0; // Disable Loop Back
Code:
U1STAbits.URXISEL = 2; // Interrupt flag bit is set when Receive Buffer is 3/4 full (i.e., has 3 data characters)
when i am using value 2 here , the loop discontinues when 3 data characters are filled and remaining array is replaced by 3 char.
when i am using value 3 here, the loop discontinues when 4 data char are filled
when i am using value 0 or 1 , it prints the same what typed ,with out filling the char array.
where does my logic go wrong ? I want to print a string of length for example " this is test".
I want to get
[TX] : this is test
[RX] : this is test
In the case if I want to add a big paragraph, i cannot mention a particular size like buf[20], then how to initialize ?
Attachments
Last edited by a moderator: