how to specific crc ?


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2007
    Location
    Republic Serbia
    Posts
    105

    Question how to specific crc ?

    I have RS485 (900 devices with displays and work 100% ok) now I need to implementa 9 more displays as terminals on network and pc send to my pic next:

    Chr$(4) + Adr1 + Adr1 + Adr2 + Adr2 + Chr$(2) + Adr3 + "W" + "Q" + "PRESS INTERNATIONAL" + Chr$(3) + Chr$(crc) ' vb6 code

    adr1 = number 0-9
    adr2 = number 0-9
    adr3 = number 0-9
    and dat 1 to 4 are numbers 0-255

    crc calculation on pc work fine with next:

    crc = Dat1 Xor Dat2 Xor Dat3 Xor Dat4 Xor Hex(Adr3) ' vb6 code

    I was probe in pbp : crc = Dat1 ^ Dat2 ^ Dat3 ^ Dat4 ^ Hex(Adr3)
    but not success ....

    Any idea for XOR for these crc calculation in pbp ?

    And second question is any way to index variables ?
    let we have :
    a1 var byte[18]
    a2 var byte[18]
    a3 var byte[18]
    ... and up to a40

    how can I say a(index) var byte[18]
    and call in program loop "a" from 1 to 40 ....
    sorry maybe i dont know to write good my question's.
    example:
    Code:
    loop:
      for i = 1 to 40
      hserin [str a(i)/18]
      next i
    goto loop
    end
    Last edited by phoenix_1; - 16th March 2010 at 22:21.

  2. #2
    Join Date
    May 2007
    Location
    Republic Serbia
    Posts
    105


    Did you find this post helpful? Yes | No

    Talking

    Quote Originally Posted by phoenix_1 View Post
    I have RS485 (900 devices with displays and work 100% ok) now I need to implementa 9 more displays as terminals on network and pc send to my pic next:

    Chr$(4) + Adr1 + Adr1 + Adr2 + Adr2 + Chr$(2) + Adr3 + "W" + "Q" + "PRESS INTERNATIONAL" + Chr$(3) + Chr$(crc) ' vb6 code

    adr1 = number 0-9
    adr2 = number 0-9
    adr3 = number 0-9
    and dat 1 to 4 are numbers 0-255

    crc calculation on pc work fine with next:

    crc = Dat1 Xor Dat2 Xor Dat3 Xor Dat4 Xor Hex(Adr3) ' vb6 code

    I was probe in pbp : crc = Dat1 ^ Dat2 ^ Dat3 ^ Dat4 ^ Hex(Adr3)
    but not success ....

    Any idea for XOR for these crc calculation in pbp ?]
    Sorry I wasnt look as I must here in forum.
    I found and work ok with :

    crc = Dat1 ^^ Dat2 ^^ Dat3 ^^ Dat4 ^^ Hex(Adr3)

    And second question now is first ;-) is any way to index variables ?
    let we have :
    a1 var byte[18]
    a2 var byte[18]
    a3 var byte[18]
    ... and up to a40

    how can I say a(index) var byte[18]
    and call in program loop "a" from 1 to 40 ....
    sorry maybe i dont know to write good my question's.
    example:
    Code:
    loop:
      for i = 1 to 40
      hserin [str a(i)/18]
      next i
    goto loop
    end

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Hi Robert,

    Maybe this will help?
    http://www.picbasic.co.uk/forum/showthread.php?t=544
    Dave
    Always wear safety glasses while programming.

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