Serial Com


Closed Thread
Results 1 to 5 of 5

Thread: Serial Com

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,808

    Default Serial Com

    Hi list.
    I have a device that communicates with a PIC running @ 20MHz

    When program asks:

    SerOut rs232t,t2400,["&*AZ=?",13]

    an answer is expected with:

    Serin rs232t,t2400,1000,noresp1,["AZ=",byte1]

    Unfortunately the answer comes too quickly for the
    controller to catch. Is there a "cure" for this?

    Note that commands are one after the other.

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default

    Tricky one this...

    1. Is it that you've got the SERIN syntax slightly screwed... You wrote...

    Serin rs232t,t2400,1000,noresp1,["AZ=",byte1]

    should it not be...

    Serin rs232t,t2400,1000,noresp1,["AZ="],byte1

    otherwise byte1 becomes part of your qualifier... and therefore you're not missing your reply, it's just not qualifying.

    2. Or is it "just too late", or "seriously" too late?

    If it's the former, you might get away with trimming your qualifying condition and dumping the first character like so...

    Serin rs232t,t2400,1000,noresp1,["Z="],byte1

    3. The best thing to do is to capture and dump the entire reply from the device and work out how much of the expected reply is missing before determining the best course of action to deal with it.

    Melanie

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,808


    Did you find this post helpful? Yes | No

    Default

    Thanks Melanie.

    Well you are right, that was a typo.

    Anyway the compiler tries to check for the "AZ=" too late.

    Meanwhile I tried debugin command which works much better. It seems that is faster in response from Serin. Also dumping "A" is a good idea.

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default

    Just remember that DEBUGIN is not as good as SERIN at resolving comms. I did an experiment the other day where I varied the PIC's oscillator away from 4MHz to discover how far I could skew it at 2400 baud before serial async comms gave up. I discovered that SERIN was still resolving good data long after DEBUGIN had given up.

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,808


    Did you find this post helpful? Yes | No

    Default

    Hmm, that is really serious one. Ok, I'll try on Serin one and how it goes.

    Just out of curiosity, how far did debug went (regarding the Osc. freq)?

    Ioannis

Similar Threads

  1. Replies: 33
    Last Post: - 19th March 2010, 03:02
  2. Dynamic USB Serial Number (PIC18F4550)
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th July 2009, 17:03
  3. Serial data to USB
    By cooksydesign in forum USB
    Replies: 18
    Last Post: - 29th October 2008, 15:10
  4. PIC18F4680 to PC via MAX232 (RS232 serial) no output
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th April 2008, 20:39
  5. interfacing to the pc serial port
    By kelangfei in forum General
    Replies: 4
    Last Post: - 7th October 2007, 22:35

Members who have read this thread : 1

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