Serial Communication Problem


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Apr 2005
    Location
    Virginia
    Posts
    65


    Did you find this post helpful? Yes | No

    Default Sample Code

    Okay, I brought this home, tweaked it with a different programmer and when I try to compile it, it says it is unable to "fit variables". I'm think this will work as it stands, but you may find some errors on my part.

    In any event, this waits for serial data and once received looks at the first two characters to be sure the string is what you expect it to be. You can take this out if your serial input changes every time (the first two and last two characters in a string). If you ever expect more than 40 bytes on a single serial string be sure to change that in the variable definitions.

    The branch command really comes in handy for looking at a single character at a specific location in the string and doing different things instead of using the if command.

    Take a look at this and see if it helps. Feel free to ask questions.

    -Tony
    Attached Files Attached Files
    Last edited by elec_mech; - 26th August 2005 at 01:13. Reason: Forgot attachment

  2. #2
    Join Date
    Apr 2005
    Location
    Virginia
    Posts
    65


    Did you find this post helpful? Yes | No

    Default P.s.

    ASII Table - All important to serial comms - Check this out:
    http://www.lookuptables.com/

  3. #3
    leemin's Avatar
    leemin Guest


    Did you find this post helpful? Yes | No

    Exclamation

    ok. thanks for you all previous help. i can work with the USART interrupt with my code already but now i encounter with a new problem.
    im using 16f877a.
    i need to receive a string of command from computer. then execute some function after received a valid command. now i need to execute the blinking effect by toggling the enable pin to let the led on and off continuosly untill another set string of command come in and either stop blinking or continue blinking.
    but now i found out that the blinking sub-routine is a dead loop. when i continuosly execute the blink function and a new string command come in from computer my firmware will hang there.
    any solution for this?
    i need you all suggestion.
    thanks

  4. #4
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi Leemin,

    It's a great idea to have the micro do as much as possible but sometimes it's necessary to have external hardware do some work to free up the micro to do other things more important. Add a gated pulsing circuit that you only need the micro to turn on and off. This can be a single chip circuit like using a CD4093 or even a CD4060. A CD4060 lets you choose flash rates juct by selecting the appropriate output. These are simple circuits and only require a few discretes to finish the job. Let the micro do the more serious stuff.

    BobK

Similar Threads

  1. Replies: 18
    Last Post: - 4th July 2017, 14:26
  2. serial communication problem
    By kindaichi in forum Serial
    Replies: 13
    Last Post: - 11th March 2010, 16:37
  3. Replies: 5
    Last Post: - 20th March 2006, 01:34
  4. Problem in Serial Communication
    By uuq1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th June 2005, 07:17
  5. Replies: 8
    Last Post: - 11th November 2004, 20:08

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