Jump to content

Search the Community

Showing results for tags 'crc16'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Software & Hardware Discussions
    • LabVIEW Community Edition
    • LabVIEW General
    • LabVIEW (By Category)
    • Hardware
  • Resources
    • LabVIEW Getting Started
    • GCentral
    • Code Repository (Certified)
    • LAVA Code on LabVIEW Tools Network
    • Code In-Development
    • OpenG
  • Community
    • LAVA Lounge
    • LabVIEW Feedback for NI
    • LabVIEW Ecosystem
  • LAVA Site Related
    • Site Feedback & Support
    • Wiki Help

Categories

  • *Uncertified*
  • LabVIEW Tools Network Certified
  • LabVIEW API
    • VI Scripting
    • JKI Right-Click Framework Plugins
    • Quick Drop Plugins
    • XNodes
  • General
  • User Interface
    • X-Controls
  • LabVIEW IDE
    • Custom Probes
  • LabVIEW OOP
  • Database & File IO
  • Machine Vision & Imaging
  • Remote Control, Monitoring and the Internet
  • Hardware

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Personal Website


Company Website


Twitter Name


LinkedIn Profile


Facebook Page


Location


Interests

Found 2 results

  1. After making someone's day on the NI forums last fall for yet another CRC variation, I decided to go look for a fully-implemented LabVIEW reuse library I could just link to for the next such request. I really couldn't find one. Hence, the attached. It's intended to be a user.lib reuse library (although the attached zip includes a small demo project with a test VI). There's really only about two genuine VIs in the library, both are malleable to adapt to the poly/init integer sizes. One is the CRC computation VIM and the other is a lookup table builder; you have the option of pay-as-you-go (eight shifts/tests and conditional XORs, aka "brute force"), or you can take the computational hit upfront once and build a lookup table. Outputs are tested correct for the lengthy list of "well-known" CRCs (included in the library as some handy typedef'd cluster constants), when tested against some reputable online calculators. What is NOT done: I haven't made any serious attempts at benchmarking performance, brute force vs. lookup table. I'd be happy to have the LAVA community beat this up and suggest improvements in: speed, code elegance, style, whatever. Dave CRC.zip
  2. Hi I have this code in C(and I don't understand it ) Is there someone that can help me translate it to labview? Thanks in advance. Bjarne typedef uint16_t (*bit_order_16)(uint16_t); typedef uint8_t (*bit_order_8)(uint8_t); uint16_t straight_16(uint16_t value) { return value; } uint16_t reverse_16(uint16_t value) { uint16_t reversed = 0; for (int i = 0; i < 16; ++i) { reversed <<= 1; reversed |= value & 0x1; value >>= 1; } return reversed; } uint8_t straight_8(uint8_t value) { return value; } uint8_t reverse_8(uint8_t value) { uint8_t reversed = 0; for (int i = 0; i < 8; ++i) { reversed <<= 1; reversed |= value & 0x1; value >>= 1; } return reversed; } uint16_t crc16(uint8_t const *message, int nBytes, bit_order_8 data_order, bit_order_16 remainder_order, uint16_t remainder, uint16_t polynomial) { for (int byte = 0; byte < nBytes; ++byte) { remainder ^= (data_order(message[byte]) << 8); for (uint8_t bit = 8; bit > 0; --bit) { if (remainder & 0x8000) { remainder = (remainder << 1) ^ polynomial; } else { remainder = (remainder << 1); } } } return remainder_order(remainder); } uint16_t crc16ss(uint8_t const *message, int nBytes, uint16_t initial, uint16_t poly) { return crc16(message, nBytes, straight_8, straight_16, initial, poly); } uint16_t crc16rr(uint8_t const *message, int nBytes, uint16_t initial, uint16_t poly) { return crc16(message, nBytes, reverse_8, reverse_16, initial, poly); } uint16_t crc16rs(uint8_t const *message, int nBytes, uint16_t initial, uint16_t poly) { return crc16(message, nBytes, reverse_8, straight_16, initial, poly); }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.