Serial data sending#do someone came across programming 16f676 with TRH031M?


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Apr 2014
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: Serial data sending#do someone came across programming 16f676 with TRH031M?

    Hi Henrik,


    • i VAR BYTEDataIn VAR BYTE[16]ActualData VAR BYTE [6]' DataIn is 16 bytes containg A A A A A H A N S O N E E E E E' Verify that the first 5 bytes are all "A"For i = 0 to 4 If DataIn[i] <> "A" THEN GOTO Start ' Nope, not qualified, start over...NEXT' Verify that the last 5 bytes are all "E"For i = 11 to 15 If DataIn[i] <> "E" THEN GOTO Start ' Nope, not qualified, start over...NEXT' Yes, header and footer qualified. Now extract actual data, 6 bytes, store in array ActualDataFor i = 5 to 10 ActualData[i-5] = DataIn[i]NEXT


    If first 5 bytes received are correct then GOTO start. In this case if first 5 bytes received correctly and last 5 bytes are wrong? It runs "start" subroutine without checking the last 5 bytes?

    Regards

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default Re: Serial data sending#do someone came across programming 16f676 with TRH031M?

    Hi,
    If first 5 bytes received are correct then GOTO start.
    No.... It checks the first 5 bytes, if any of them is NOT "A" it jumps to start.

    In this case if first 5 bytes received correctly and last 5 bytes are wrong? It runs "start" subroutine without checking the last 5 bytes?
    No.... If it finds that the first 5 bytes are received correct it continues to check the last 5 bytes. If they TOO are correct it extracts the data. If any of the last the 5 bytes are wrong it'll jump back to start without extracting the data.

    Only when the first bytes are "A" AND the last 5 bytes are "E" will it extract the data. As soon as ANY of the first 5 bytes OR the last 5 bytes does NOT match will it jump back to start - which is whay you said it should do:
    if all conditions matched (receive first 5 "A" and last 5 "E" properly) then store data_in
    /Henrik.

Similar Threads

  1. Problem on sending data on serial port
    By bwaxing in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 3rd May 2011, 21:05
  2. Ir problem sending data
    By Mus.me in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th December 2009, 05:27
  3. 16F676 programming problem
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th May 2009, 17:39
  4. VB sending serial data to PIC
    By Tissy in forum Serial
    Replies: 7
    Last Post: - 8th March 2006, 18:31
  5. Sending data over USB via VB
    By Tissy in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 12th September 2005, 01:00

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts