Click here to Skip to main content
15,887,376 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
combine 3 hexvalues by using left shift operator.

examples:

take decimal values as 2,129025,127 .combine the all hex values and need to come as 2,1F801,7F

i need to write as 2,1F801,7F IN THE kvaser CANKING output.


What I have tried:

int h1=2;
int h2=129025;
int h3=127;
int combinedID = h1 + (h2<<8) + (h3<<25);

//for writing on kvaser canking
canlib.canwrite(handle,combinedID,data,data.length,0);
Posted
Comments
CPallini 22-Jan-24 2:53am    
And what's wrong with your code?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900