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.

Serial comm between uC and PC...

Status
Not open for further replies.
OK, here is the schematic....
 

Attachments

  • aa.jpg
    aa.jpg
    83.1 KB · Views: 215
.........................................
 
Last edited:
Is this fine now?? the power is taken from usb 5volt

Sorry Ritesh... I don't mean to take the mick, but as you can see the second schematic is MUCH easier on the eye..

What USB to TTL have you got... FT232RL?... Also what are the characters in the terminal window... They are too small to see..
 
What USB to TTL have you got... FT232RL?... Also what are the characters in the terminal window... They are too small to see..

this one **broken link removed**
and i am writting random charater i have also installed Tera team for testing i am also sending data from uC to terminal window here is the code!


Code:
#include <htc.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
#define _XTAL_FREQ 20000000
 
void  HSerinit();
 
void main(void)                        // program entry
    {
TRISB=0X00;
PORTB=0X00;
    int index = 0;
    unsigned char ch;
    ADCON1 = 0x6;                    // Analogue off                    
    HSerinit();
       __delay_ms(150);
    while(1)                        // endless Loop
        {
RB7=1; //for testing code is working!!
        
         while(!TXIF);                    // Wait for module to finish
         TXREG = 'A';  
             
 
        }
    }
void HSerinit()
{
    TRISC = 0x80;                    // TX was an input!
    SPBRG = 129;                    // 20Mhz xtal 9600 BAUD
    TXSTA = 0x24;                    // TXEN and BRGH
    RCSTA = 0x90;                    // SPEN and CREN
}
 
What output do you get from this little device.... Is it TTL? Or is it +10 -10 volt signals...

It is used to convert the serial to usb you can see the manual of it in link!
 
There is no datasheet or manual listed..

This is described as a Virtual Serial port, suggesting that the output is RS232 levels , not TTL... If this is the case it will damage your pic.


Have you got a scope to measure the output voltages???
 
Have you got a scope to measure the output voltages???
I am using 5V from USB only the chip used by it is **broken link removed**

they said:
This product makes a virtual COM port on any pc when connected on a USB port. So, it can be used for communication between PC software (Link Hyper Terminal) and Microcontroller. This product is optional to PC-MCU Serial link with all development boards. It provides option for laptops and computers which does not have COM (Serial) port.
 
One thing more:
Code:
On the USB to TTL module, connect your TX and RX pins together and type in the terminal window. 
It is working!!
 
I'm pretty sure that module has a TTL output level suitable for direct connection to 5v microcontroller pins.

One simple test is to send a 0x00 byte manually out the PIC TX pin at 1200 baud, then set the terminal program in the PC to 1200 baud and see if it is received ok.

That can check your wiring and does not depend on any USART stuff.

To do that, you turn the USART off and use this manual code;
while(1)
{
LATC.F6 = 0; // TX pin forced LO
Delay_mS(7);
Delay_uS(500); // 7500 uS delay is 9 bits at 1200 baud (start bit + 8 LO bits)
LATC.F6 = 1; // TX pin back to idle state HI
Delay_mS(100); // pause between bytes
}

Then run the code and a byte 0x00 will be sent from the PIC about every 100mS. Then you can check the wiring and make sure Hyperterm is receiving the 0x00 byte ok.
 
It is working on 5V from USB i think TTL

You could sometimes try to read the datasheet specs yourself. That way you would not have to guess.

The datasheet says:
RS232 pins RXD_I, RI_I, DSR_I, DCD_I, CTS_I are 5V TTL Schmitt Trigger inputs.
RS232 pins TXD, DTR_N, RTS_N are 3.3V tri-state outputs.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top