Communications Example : PC to PIC bi-directional dialogue


Results 1 to 27 of 27

Threaded View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358

    Default Communications Example : PC to PIC bi-directional dialogue

    Judging by the emails I'm getting, folks have missed this hidden away at the end of another thread... so it's been repeated with a thread all of it's own.

    Here's a sample program, thrown together for fun this lunchtime, to demonstrate bi-directional dialogue with a PC running something like Hyperterminal. It runs at 300 baud so almost any PIC will run it without an Xtal or Resonator (but best with!!!!).

    The object of the program is to demostrate how commands can be passed from the PC User and acted upon by the PIC.

    Yes, whatever you type on your PC is echoed back to you as feedback. The program is reasonably interactive... it tells you when you're Bad!, and tells you when you're OK. UPPERCASE and lowercase and cOmBINatIOns are handled with reasonably idiot-proof command interpretation... this is done by parsing the received command line (in a simplified manner for this example) rather than the usual way of having SERIN (or whatever) WAITing for a valid command.

    You can even use the BACKSPACE Key and have the PIC perform rudimentary line editing.

    PIC has five LED's which can be remote controlled in a variety of ways with commands like ON, OFF, BLINK, SWEEP and BEER. The major commands have sub-parameters which can be added to make control more interesting. Plenty of expansion for you to do your own thing.

    Example:

    ON Switch ON all LEDs
    ON 2 Switch ON LED number 2

    you can even have abnormally large gaps between the Command (eg ON) and the sub-parameters (eg 2)

    ON 4 7 Switch ON LED number 4 for 7 seconds
    BLINK 1 15 Blink LED number 1 15 times
    OFF 1 Switch OFF LED number 1
    SWEEP 25 Sequentially Sweep all LEDs 25 times

    Try to break it (if you can) by typing combinations of garbage or having line lengths bigger than 10 bytes (my preset communications buffer maximum)....

    Full instructions in the program comments.

    Melanie
    Attached Files Attached Files

Similar Threads

  1. Send data PIC to PC
    By konter in forum Off Topic
    Replies: 6
    Last Post: - 25th December 2009, 22:04
  2. Replies: 67
    Last Post: - 8th December 2009, 02:27
  3. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 14:46
  4. Replies: 11
    Last Post: - 12th July 2008, 02:36
  5. PC / PIC communications?
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 12th September 2005, 17:55

Members who have read this thread : 3

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