Code for Send/Receive TTL/Comport Sample?


Results 1 to 40 of 53

Threaded View

  1. #6
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

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

    RS232 (serial) is purely a dumb pipe. You toss a byte in one end and it pops out the other. It does a number of things you can ignore, like add and remove start / stop bits, sometimes buffer a couple packets, and so on, but for your purposes you get out EXACTLY what you put in. So you decide what the bytes mean. You could send binary / hex / decimal numbers, or ascii, or morse code, or make up your own - as long as the receiver you build can read what the sender you build sends.

    If you use a commercial terminal program, it will send the ascii code for what you type. So if you type number "1" on the computer, what is sent is actually hex 31(decimal 49). The PIC gets hex 31. If you write a program in VB or any other language to send a hex 1 when somebody hits the "1" key (or any other key if you wish), then that is what the PIC will see. Nothing hard here. If you are coding both ends of the pipe, you have complete control.

    When you want to talk to other devices or systems, you need to know what the existing convention is. So if you think you will talk to commercial terminal programs, or certain serial displays, you are better off sending ascii. If you will be doing machine to machine stuff where you control both ends, do what pleases you. But you won't find anything automatically translating here. In most programming languages, text is stored as ascii, so if you are using a language that defines variables as text, or integer, etc. then you can convert numbers to ascii by converting to text. PBP does not distinguish between types of variables, other than by size. (At least not 2.6) but does have some things to make dealing with text easier. Read the manual - it will help.

    Clear as mud?
    Last edited by Charlie; - 29th June 2013 at 12:54.

Similar Threads

  1. how to send and receive sms using vb?
    By shyhigh2002 in forum Off Topic
    Replies: 0
    Last Post: - 1st April 2009, 10: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, 21: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, 14:37
  4. send and receive data using pic 16f84a
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2006, 21:12
  5. send and receive data using pic 16f84a
    By PoTeToJB in forum Serial
    Replies: 1
    Last Post: - 25th February 2006, 15: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