Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

mikroc usart receiving problem

Status
Not open for further replies.

einton

New Member
hi guys solve my some matter with mikroc usart terminal
i m using following program
data is sent but i m unable to see any received data on uart terminal
my program is
void main()
{
unsigned char MyError, Temp;
Soft_Uart_Init(PORTB, 0, 1, 9600, 0);
for(; ;)
{
do
{
Temp = Soft_Uart_Read(&MyError); // Read a byte
} while(MyError);
Temp++;
Soft_Uart_Write(Temp); // Send the byte
// Increment byte
}
}
sent status sometimes gets red but mostly remains green
should i use another terminal for receiving , tell please where i m wrong.
 
Try this out
Code:
unsigned short data = 0, ro = 0;
unsigned short *rec;

void main() {
  er = &ro;

  // Init (8 bit, 9600 baud rate, no parity bit..)
  Soft_Uart_Init(PORTB, 1, 2, 9600, 0);

  do {
    do {
      data = Soft_Uart_Read(rec); // Receive data
    } while (!*rec);
    Soft_Uart_Write(data);        // Send data via UART
  } while (1);
}//~!
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top