adding two 8bits digit into a 16bit one | Arduino Compatible Compiler for LabVIEW Discussions | Forum


Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 4 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
adding two 8bits digit into a 16bit one
August 9, 2016
4:03 pm
New Member
Forum Posts: 1
Member Since:
August 9, 2016
sp_UserOfflineSmall Offline


This question might be dumb so sorry in advance if that is too stupid...

Well, I'm making a translator on arduino between and old motor driver to a new one. Long story short, the host submitting serial messages cannot be chaned or adapted to use the new "language" used by the new drivers. So I have to "translate" the old format messages to the new format.

Quickly: I'm getting serial data incoming (array of bytes)

I do manipulation on data etc.

Then I need to calculate a CRC16 (modbus type) on the generated message.

Problem is: each data inside my "message" array are 1-Byte type.

A CRC16 calculator is making calculation on all of these bytes and gives a 2-Bytes number

But as Arduino compatible compiler cannot re-cast the 8-bit into 16-bits I get compiler error. This is pretty basic in Labview and works properly but here I cannot get it right...

Do you guys have any idea how I could do it? I already tried to copy my array of 8-bits data into a 16-bits data array but also the compiler is failing... I even tried with the native "join numbers" which outputs a 16-bits number from 2 8-bits numbers (1 is 0 the other one is the element from my 8-bit array) to copy my 8-bits data array to a local 16-bits data array without success.


I actually managed to compose a 16 bits data using the join function. However, if I run the CRC16 calculation using labview, I always get the good result, if I run it with Arduino, it is always false (but gives always the same result, despite false). There must be something wrong with the memory allocation... need to investigate...

Thanks for your help and sorry for the silly question...



August 9, 2016
9:00 pm
Forum Posts: 304
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

You should be able to just use join numbers.  You can do a serial print of the CRC calculation to see where it has gone wrong.  Or you can post a simplified version of your code if you think everything looks correct on your end.

Forum Timezone: UTC 0

Most Users Ever Online: 33

Currently Online:
2 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

John: 18


Dan6077: 11

Member Stats:

Guest Posters: 0

Members: 80

Moderators: 0

Admins: 3

Forum Stats:

Groups: 1

Forums: 2

Topics: 58

Posts: 289

Newest Members: Geraldkix, ThomasSoogs, Angelvor, AngelaMuh, Nsneilohone

Administrators: geadmin: 5, filipealtoe: 35, Steffan: 89