Code for Send/Receive TTL/Comport Sample?


Results 1 to 40 of 53

Threaded View

  1. #22
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    Hi Chris - you've mixed it up again. The chip does USB to serial at TTL levels. You would only need another device if you wanted to use real RS232 levels for your serial data.

    It looks from the datasheet that if you want true RS232 (such as you would see from a computer) you would need to add a driver that includes inversion. So if your cable only has the Prolific chip, then you can simply connect directly to your PIC without setting any special bits even if the PIC supports it, and you should be good to go. (you will be transmitting and receiving inverted RS232 at TTL levels)

    So now it's time to focus on your code and circuit.

    The RX pin needs TRIS set, the TX does NOT.

    I've found the easiest way to start is to create a loop in the PIC code that sends "Hello", waits for a second, then sends it again. This will let you get the link from PIC to computer going and give yourself confidence. The link in the other direction is a bit trickier, so start with PIC to PC first. Connecting a LED through a resistor to ground on the TX pin of the PIC will let you see some blinking once per second so you know you are sending. Then remove it and connect your cable.

    The only pins you need connected are TX, RX, GND. GND is always GND, but depending on who made the cable, you might need to connect the PIC TX to the cable RX or to the cable TX. It's easy enough to swap back and forth when the PIC is sending in a loop, and see which one lets the data through. Once you get to this point, life will get simpler ;-)

    If you are seeing garbage, The baud rates on both ends do not match, so double check. You may also see trash if your ground is poor.
    Last edited by Charlie; - 2nd July 2013 at 13:43.

Similar Threads

  1. how to send and receive sms using vb?
    By shyhigh2002 in forum Off Topic
    Replies: 0
    Last Post: - 1st April 2009, 09:18
  2. please who can help me for sample code
    By jasem700 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd February 2009, 20:41
  3. How to build modem for only send and receive the msg
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 7th April 2006, 13:37
  4. send and receive data using pic 16f84a
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2006, 20:12
  5. send and receive data using pic 16f84a
    By PoTeToJB in forum Serial
    Replies: 1
    Last Post: - 25th February 2006, 14:47

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts