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.

[PIC] PIC18f45k22 UART problem

Status
Not open for further replies.

AshleeMakaya

Newbie
Joined
Dec 2, 2017
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
75
hi am having problems with uart communication. am trying to send a simple text "Start" to the virtual terminal but it outputs gabbage.

i am using proteus and mikroc
i am using pic18f45k22



Code:
char uart_rd;

void main() {
  ANSELC = 0;                     // Configure PORTC pins as digital

  UART1_Init(9600);               // Initialize UART module at 9600 bps
  Delay_ms(100);                  // Wait for UART module to stabilize

  UART1_Write_Text("Start");
  UART1_Write(13);
  UART1_Write(10);

  while (1) {                     // Endless loop
    if (UART1_Data_Ready()) {     // If data is received,
      uart_rd = UART1_Read();     // read the received data,
      UART1_Write(uart_rd);       // and send data via UART
    }
  }
}
 

Attachments

  • UART TESTING.zip
    64.8 KB · Views: 63
  • UART.zip
    34.7 KB · Views: 68

Hi,

Read through some forum posts about UART problems. In 99% it's a baudrate mismatch problem or a signal driver problem.

The UART init tells to "try" to set to 9600 baud....but no one can tell if it really "can". Because it depends on real microcontroller clock frequency and correct compiler setup.

If you are sure the baudrate is correct, then the problem may be a hardware problem.
--> show the complete circuit from microcontroller to receiver.

(Currently I'm limited to use my cellular phone, thus I can't open your attachments. Adding inline text and pictures is more compatible. Don't forget to use formatting tags)

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top