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.

PIC16F877 Micro USART Interface with PC

Status
Not open for further replies.

roiadel

Newbie level 2
Newbie level 2
Joined
Oct 18, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,293
hi everybody.
Sorry for my english.

I use a MicroC 8.2 and USART Library for Send Bytes from PIC Micro to PC.(in Windows with Hyperterminal).

so i use this Code:
Code:
void main()
{
 char m=0;
 Usart_Init(4800);
 Delay_ms(100);

 while(1)
 {
    Usart_Write(m);
    m+=1;
    if(m==127)
     {
      m==0;
     }
 }
}

this works when i press a key in Hyperterminal. i want A PIC send Characters one to one without press a key in hyperterminal.

Thanks for your help.
 

Try sending only printable characters like this:

Code:
void main()
{
   char m=32;               // miss out non-printing control characters
   UART1_Init(4800);
   Delay_ms(100);

   while(1)
   {
      UART1_Write(m);
      m+=1;
      if(m==127)
      {
         m=32;               // fix syntax error and miss out non-printing control characters
      }
   }
}
Note that I changed the double == to single = within the if braces

Why are you using an ancient version of the non-pro compiler? Upgrade to the latest mikroC pro compiler (v5.8.0) is free.
I have changed USART to UART1 for serial functions to suit current compiler. You will need to change back if you insist on using the old version.
 
Last edited:

thanks hex reader.

i change my compiler to micro c pro. and use your code.
(My PIC Micro is 16F877A)
but Micro can't Send Characters to PC with out press a key from hyperterminal.

is may be from tx or rx pins.?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top