embRTS
Full Member level 4
- Joined
- Sep 8, 2013
- Messages
- 201
- Helped
- 36
- Reputation
- 72
- Reaction score
- 33
- Trophy points
- 28
- Location
- Bangalore
- Activity points
- 1,191
Hello I am trying to write a sample uart code
but it's giving garbage data
i have checked on different baud rates also
by changing the value of SPBR
here is my code
output is junk data on the terminal
please help me out of this
thanks in advance
but it's giving garbage data
i have checked on different baud rates also
by changing the value of SPBR
here is my code
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #include <p18F4550.h> #include <stdio.h> #include <string.h> #include <usart.h> void delay(unsigned int i) //Function for delay { unsigned int j; for(j=0;j<i;j++); } void main() { unsigned char config=0,spbrg=0,baudconfig=0,i=0,j='a'; config = USART_TX_INT_OFF | USART_RX_INT_OFF | USART_ASYNCH_MODE | USART_EIGHT_BIT | USART_SINGLE_RX | USART_BRGH_LOW; spbrg = 25; //Baud for 9600 baudconfig = BAUD_8_BIT_RATE | BAUD_AUTO_OFF; baudUSART (baudconfig); OpenUSART(config,spbrg); WriteUSART('A'); putsUSART("THIS IS UART TEST\n"); //String: welcome message }
output is junk data on the terminal
please help me out of this
thanks in advance
Last edited by a moderator: