ni.com is currently experiencing slowness/issues due to ongoing maintenance.
Support teams are actively working on the soonest resolution.
ni.com is currently experiencing slowness/issues due to ongoing maintenance.
Support teams are actively working on the soonest resolution.
09-20-2018 03:07 AM
Additional: The CRC, which I am attempting to emulate, is encoded in this site:
https://www.lammertbies.nl/comm/info/crc-calculation.html
This version : CRC-CCITT (0xFFFF)
09-20-2018 05:43 AM - edited 09-20-2018 05:44 AM
Trick for snippets
Use the picture viewer to download the snippet then poof code.
And either of the should do a CRC 16 ITT
09-20-2018 07:26 AM - edited 09-20-2018 07:27 AM
Found the right combination of settings. So here is a reduced version of my code that will work with your algorithm. It does not use the lookup table, but it is simple and works.
09-20-2018 07:31 AM
Tim I swear that code is in my reuse library.
You may need to byteswap the output
09-20-2018 07:58 AM
Fantastic! Thanks for your efforts. I can't wait to try it!
But I must ask the question again, how to get it into LabVIEW without having to draft it all in line by line? I tried cutting and pasting the PNG and looked for a POOF option (or even PROOF?) but no joy.
I must be one of those daft things which you have to just know and I'll be slapping myself.
09-20-2018 08:21 AM
@Barionics wrote:
I am attempting to convert a CRC calculator, written in C, to a LabVIEW VI.
It looked easy to cut and paste the relevant calculations into a formula node, but I have come unstuck.
in C I can do:
ushort value = (ushort)(I<<8)
The second 'ushort' is there to remove any overflow characters by chopping it back to 8 bits. I tried replacing the ushort with uInt8 but no joy.
If I do without the (ushort) LabVIEW recognises the overflow and rounds the byte down to FF, which is not what I want.
The LabVIEW logical shift operator does work correctly, but, as the code is more subtle and clever than I am, I don't really want to go down the spaghetti route if I can avoid it.
BTW, don't think I hadn't thought to convert the C code to a DLL and import it that way, but I would need outside help with that, plus the complication of supporting the code.
Any help much appreciated,
Regards,
Ian
Is this what you are trying to do?
09-20-2018 08:37 AM - edited 09-20-2018 08:38 AM
@Barionics wrote:
Fantastic! Thanks for your efforts. I can't wait to try it!
But I must ask the question again, how to get it into LabVIEW without having to draft it all in line by line? I tried cutting and pasting the PNG and looked for a POOF option (or even PROOF?) but no joy.
I must be one of those daft things which you have to just know and I'll be slapping myself.
I think the use of "poof" was meant to be exclamatory, like a magician saying "POOF!"
The problem is that changes made last year to the forum software have broken snippets. Most of the time the image the forum shows you has been rescaled or had the LabVIEW code stripped from it, so you can't just drag or copy-and-paste it into LabVIEW anymore. It is still possible to save the image to disk and then open it in LabVIEW. There's a whole discussion about it here: https://forums.ni.com/t5/Feedback-on-NI-Community/Snippets-are-broken/td-p/3658760
09-20-2018 08:50 AM
Here
09-20-2018 09:05 AM
Also, what version of LabVIEW do you have? Crossrulz's snippet is in LV 2016. Paul's is LV 2018.
If your LabVIEW is older than the picture you are trying to drop in, it will not turn to code, but remain an image.
And as arteitle said, changes made to the forum in how it handles images have made things more complicated. And exact procedures may vary depending on which browser you use. But essentially, download the image file to your desktop. Then drag and drop the file to your block diagram.
09-20-2018 10:39 AM
@JÞB wrote:
Tim I swear that code is in my reuse library.
It (the generic version) has been in mine for around a decade now.
@JÞB wrote:
You may need to byteswap the output
Nope. It perfectly matched the example from the web site. The Byte Swap will only be needed if the OP needs it to be Little Endian. But, yes, I have seen that variation on CRCs as well.