Receiving Packet Array In Usart


Closed Thread
Results 1 to 30 of 30

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Consider this

    Hi,

    In your code you are assuming that the first byte at buffer[0] is the pelco-p header.
    Code:
    IF BYTECOUNTER=7 AND BUFFER[0]=$A0 AND BUFFER[6]=$AF THEN
    GOT=1 'INDICATE THAT THIS IS A NEW PACKET 
    GOTO MAIN 'RETURN TO MAIN PROGRAM
    ELSE
    GOTO GETDATA 'GO BACK AND WAIT FOR NEXT PACKET
    ENDIF
    ENDIF
    This might not be the case as you may have a dataset misaligned say for one missed byte or corrupted data. So you actually do not know that if your buffer is perfectly aligned. I think you should consider a better algo for checking the PELCO strings.

    I assume are using serout2 for your debug purposes. Why not use the TX part of the USART? Yes limitation are that you need to use the same speed as the RX. DT's INT routines takes a finite time to take action in your PBP routine as it saves all the variables for you and checks all the flags and execution orders (aka all the hardwork that we were supposed to do) but please note that it responds to the interrupt instantly. This may screw up the soft serial out routines of PBP as it will introduce timing jitters in the output serial streams. Hope Darrel can enlighten more.

    I wish that I actually find some spare time this weekend to get something useful for you. Hope you succeed before that.
    Regards

    Sougata

  2. #2
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Talking

    It's finally running just as I wanted it,

    Thanks very much to skimask, Suagata ans especially Darrel Taylor for your help. I could never have got it right. I now can use this code as a "plug in" for all my 8byte protocol coms projects.

    I hope I will be able to help you someday as you helped me.

    Best Regards

    Chris Rhomberg

Similar Threads

  1. Simple Array Demo
    By Archangel in forum Code Examples
    Replies: 5
    Last Post: - 15th February 2010, 04:46
  2. RS232 receive an array (packet)
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th February 2008, 05:02
  3. Receiving Packet Array In Usart
    By crhomberg in forum Serial
    Replies: 1
    Last Post: - 18th April 2007, 22:31
  4. USART Stops Receiving Characters
    By breesy in forum Serial
    Replies: 7
    Last Post: - 26th November 2006, 03:50
  5. USART Problem Receiving Bytes
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th September 2005, 17:50

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