Serial comm using pic16f877a....

tshuck

Joined Oct 18, 2012
3,534
1.) buy the module suggested

2.) plug the module in to the PIC. Rx of module to TX of PIC and TX if module to Rx of PIC

3.) write program that will use the PIC's UART module to send data, with the correct configuration (baud rate, stop bits, parity, etc.) to be compatible with the USB to TTL module.

4.) use a terminal program (i.e. hyperterminal or TeraTerm) to connect to the virtual COM port that is created for the USB to TTL-again, with the same configuration add both the PIC and USB to TTL module are using and watch the data stream.

Remember post # 18?


Try reading. I refuse to repeat myself for the third time!
...see post #18, please actually read what I've written, I wrote that for you to understand what to do, yet you continue to ask the same question, this is now the forth time you've asked this question in this thread alone.
if you need help with configuring the terminal, I've never used RealTerm, so you'll have to consult, another resource: http://realterm.sourceforge.net/index.html#Baud_Rates__Ports
So, why you don't tell me what to do????????????
:mad:

What do you think I've been doing!?​
 

DerStrom8

Joined Feb 20, 2011
2,390
:mad:

What do you think I've been doing!?
Don't let it get to you. Ritesh has proven himself on multiple occasions and on multiple forums that he is incapable of thinking for himself, and also incapable of listening to what other people are trying to tell him.

Honestly, I'm surprised you've stuck with it this long. Your patience level far exceeds my own. Personally, I think he's hopeless.
 

tshuck

Joined Oct 18, 2012
3,534
here is the screen shot.........
the problem is the char are not received back from uC as per code...
On the USB to TTL module, connect your TX and RX pins together and type in the terminal window.

When you connect your PIC, make sure you connect the USB to TTL's RX pin to the PIC's TX pin and vice versa...
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Don't let it get to you. Ritesh has proven himself on multiple occasions and on multiple forums that he is incapable of thinking for himself, and also incapable of listening to what other people are trying to tell him.

Honestly, I'm surprised you've stuck with it this long. Your patience level far exceeds my own. Personally, I think he's hopeless.
I am working and don't what is is the problem encountered so, i need help to remove it!!
you can see the screen shot i have changed the baund rate to 9600 and the com port as per display in device manager!!
 

tshuck

Joined Oct 18, 2012
3,534
Don't let it get to you. Ritesh has proven himself on multiple occasions and on multiple forums that he is incapable of thinking for himself, and also incapable of listening to what other people are trying to tell him.

Honestly, I'm surprised you've stuck with it this long. Your patience level far exceeds my own. Personally, I think he's hopeless.
I know, I responded too hastily.. I tend to read the posts, and walk away so that I don't respond with my initial snide remarks... It's clear when that method fails!:D

Call me a hopeless romantic, I guess.....;)
 

tshuck

Joined Oct 18, 2012
3,534
...also, once the connections are confirmed, you must press a button while the terminal window is in focus to get something back...
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
...and you have both ground and power pins connected together respectively?
Yes...
You are powering the whole thing from the 5V supply on the USB-to-TTL module, no?
yes taking power from usb module.
...also, once the connections are confirmed, you must press a button while the terminal window is in focus to get something back...
Which button i press reset switch on uc board many times
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
No, no, on your keyboard...in the terminal window...
Yes i do on keyboard also but nothing come back the terminal window show status of
CTS(8)
DCD(1)
DSR(6)
BREAK

and when i type TXD glow but RXD not glow status..?
and i am using stop bit one, hardware flow control to RTS / CTS , parity none and display as ancii
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
The window is also displaying UARt framing error received and break cond received ..
when i press F then reset the unknown symbol show all time like this \
 

tshuck

Joined Oct 18, 2012
3,534
Yes i do on keyboard also but nothing come back the terminal window show status of
CTS(8)
DCD(1)
DSR(6)
BREAK

and when i type TXD glow but RXD not glow status..?
and i am using stop bit one, hardware flow control to RTS / CTS , parity none and display as ancii
You'd have to check what that means in RealTerm ...
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Rich (BB code):
#include <htc.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
#define _XTAL_FREQ 20000000
 
 
unsigned char  HSerin(void);
void HSerout(unsigned char ch), HSerinit(void);
 
void main(void)                        // program entry
    {
    int index = 0;
    unsigned char ch;
    ADCON1 = 0x6;                    // Analogue off                    
    HSerinit();
       __delay_ms(150);
    while(1)                        // endless Loop
        {
       
         HSerout(ch);                // Echo back
 
        }
    }
 
void HSerinit()
    {
    TRISC = 0xC0;                    // should ideally be set
    SPBRG = 129;                    // 20Mhz xtal 9600 BAUD
    TXSTA = 0x24;                    // TXEN and BRGH
    RCSTA = 0x90;                    // SPEN and CREN
    }
 
void HSerout(unsigned char ch)
    {
    while(!TXIF);                    // Wait for module to finish
    TXREG = ch;                        // ready to send
    }
I was thinking to transmit the dta from uc to PC for this will this will work OK??
TXREG = 'a';
 
Top