FastCRC Problems with Hex calculation


Im trying to calculate a CRC checksum which is working so far with the example code.
But when I try to calculate it with a HEX value the result isnt what i was hoping for.
It should be 0x0EEF but I get 0xC723.
Probably because im doing it wrong but I tried to use the BIN and ASCII value of 0xF0 but nothing seems to work.

#include <FastCRC.h>

FastCRC16 CRC16;

uint8_t buf[9] = {'1', '2', '3', '4', '5', '6', '7', '8', '9'};
uint8_t i = 0xF0;
void setup() {


  Serial.println("CRC Example");
  Serial.print("Buffer: ");
  Serial.println( CRC16.ccitt(buf, sizeof(buf)), HEX );// Result 29B1
  Serial.print("Test: ");
  Serial.println( CRC16.ccitt(i, sizeof(i)), HEX ); // Result: C723


void loop() {

The CRC for “buf” is correct but for “i” ist wrong or at least not what I want and not what online calculators say is correct.

So if someone know how to use a HEX value with the Fast CRC library or knows another simple CRC16-CCITT library for this job i would love to hear your solutions.

I have not looked into the library, but it seems like you are passing an numeric value where you should pass a pointer:

Serial.println( CRC16.ccitt(&i, sizeof(i)), HEX );

Mind the "&" before "i" which passes the memory address of "i" instead of the value of "i".

Thank you. Now it works :smiley: