CRC Function

Wir bemühen uns Ihre Fragestellung zu beantworten.
Antworten
TOURNEUR
Beiträge: 38
Registriert: Samstag 22. Mai 2010, 23:56

CRC Function

Beitrag von TOURNEUR »

Hello everybody


I would like to establish a serial communication, with my computer and display from 4D System brand.

Protocol in my specific using, use 5 hexadecimal byte, and a checksum at end of the frame.

I simply would like to use the embeded CRC function, but discovering that not simply like that.

I don't know wich is the polynome, and the inititial value, and particularly how to obtain them ?

I tried to use the 4D system explication where Byte(1)^Byte(2)^Byte(3)^Byte^(4)^Byte(5), with XOR.

Between two bytes I arrived to do it, but after I don't know how to realize XOR after more than two bytes together.

Doe's I need to XOR By(1) and By(2) together and By(3) and (4) together alone and XOR theses results together ?

It's a bit hard to found the correct sequence.

If any help, thanks in advance
abacom
Site Admin
Beiträge: 4092
Registriert: Dienstag 23. September 2008, 10:54
Kontaktdaten:

Re: CRC Function

Beitrag von abacom »

Hope this topic and the example included in PL gets you started...

viewtopic.php?t=2940
ABACOM support
TOURNEUR
Beiträge: 38
Registriert: Samstag 22. Mai 2010, 23:56

Re: CRC Function

Beitrag von TOURNEUR »

Hello, and thanks for any help


Effectively, I read the conversation, and I ask any appologies in advance for that reflexion...

Any germans users don't took that mad, but it could good that communauty use a language wich everybody understood.

In my case I'm french, and I use english, never in french.

Of course google translation can convert a conversation.
But it is not always very comprehensible...
When I use the search windows of the forum, i use it in english traduction, and effectively if any solution exist in german I will never found it.

To return to my conversation

I finally solved by trouble with CRC, with the CRC function.

But, apparently, I have a big issue with the polynomial number.

In terms, 4D workshop (the compiler of the display) offer a communication test tool where you can check the bytes of communication.

My Profilab result CRC is equal to the 4D application tool,

I have 0 to 214(decimal) control byte.
It work from 0 to 127 and 180 to 214.

But from 128 to 180, my result is not equal, and my communication not work.

And after investigation it seem from the polymial number.

I put 1 for the polymial, but I am completly loose with the polymial calcul, and I don't understood the using for.

I could ask to 4D system wich polymial number they used cause I don't realy understood how can I found this polymial number by calcul
abacom
Site Admin
Beiträge: 4092
Registriert: Dienstag 23. September 2008, 10:54
Kontaktdaten:

Re: CRC Function

Beitrag von abacom »

This is what AI says...
4D Systems displays feature built-in hardware and software tools to perform Cyclic Redundancy Checks (CRC), which ensure data and memory integrity. For specific chip programming and communication troubleshooting, use the DIABLO-16 Internal Functions documentation.Built-in 4DGL CRC Functions4D Systems provides native functions in 4DGL (4D Graphics Language) to compute checksums for serial transfers and internal memory scanning. The primary functions include:crc_16: Computes the standard 16-bit CRC algorithm. If you pass all incoming data including the generated CRC into this function, the result will evaluate to 0x00.crc_CCITT: Calculates the CRC using standard CCITT polynomial (\(x^{16} + x^{12} + x^5 + 1\), polynomial 0x1021).crc_MODBUS: Computes the CRC-16 Modbus checksum (polynomial 0x8005).crc_CSUM_8: Calculates an 8-bit checksum.Common Use Cases & SpecsSerial Communications: If your 4D display is acting as a slave to a microcontroller, you can generate a Modbus or CCITT-16 CRC on the packet before transmission.Flash Memory Integrity: You can run custom cyclic checks over specific segments of flash memory to detect data corruption.CCITT Standard Test: For the standard string "123456789", crc_CCITT will return 0x31C3 using a 0 seed (XMODEM protocol), and 0xE5CC with a 0x1D0F seed.For example, checking a memory buffer looks like this in 4DGL:crc_16(str_Ptr(buf), count);Could you tell me what processor your 4D Systems display uses (e.g., DIABLO-16, PICASO, PIXXI) so I can provide the exact parameter syntaxes and seed values for your project?
ABACOM support
TOURNEUR
Beiträge: 38
Registriert: Samstag 22. Mai 2010, 23:56

Re: CRC Function

Beitrag von TOURNEUR »

Hello,

After search about the communication protocol of 4D System,
between a host and the display.

I had to rebuild completely my strategy.

And use an Arduino board instead of Profilab.

And discover, that the is not implemented with a polynomial variable.

This is uniquely 5 bytes with a XOR conversion between all them.

Certain inlines converters realise the same result and other ones, neither.


Now, if I would like to realise a communication between my computer host, I need to use a XOR function for bytes, instead of the CRC function.

By a macro probably...
abacom
Site Admin
Beiträge: 4092
Registriert: Dienstag 23. September 2008, 10:54
Kontaktdaten:

Re: CRC Function

Beitrag von abacom »

So finally it´s not a big deal to XOR five bytes, is it? I´ll remove some of previous posts as these are no longer state of art.
ABACOM support
Antworten

Zurück zu „PROFILAB SOFTWARE Support“