CAN data

3 years 10 months ago #29532482 by mrosenfield
CAN data was created by mrosenfield
I am writing a microbasic script to use received CAN data for control of motor position, using miniCAN. I will be receiving 2 data values: speed, and position error.
CAN data sent to the controller is 16-bit signed hexdecimal values.
The Controller User's Manual says that miniCAN has (4) 32-bit and and (4) 16-bit variables that can be read.
When I read VAR14, is the read value automatically converted to decimal?

The other issue is that I need to read 16-bit data values from RPDO2, but the variables are 32-bit. Unfortunately, the data I need will be in the upper half of the word.
Is there a way to mask or shift the data, so as to get only the upper half? The lower half of the word will contain data, but not data I need.
Thank you.

Please Log in or Create an account to join the conversation.

3 years 10 months ago #29532483 by niko
Replied by niko on topic CAN data
Hi,

When you read any value from our controller you read the decimal format of the value.

Microbasic supports bot binary and shift operations. In you case We assume that using this operators you will be able to process the data you receive. Check user manual p. 191 and on.

Alternatively you can use one RPDO variable for one value and one variable for the other value. In that way you skip extra script in order to get the data.

Please Log in or Create an account to join the conversation.

3 years 10 months ago #29532484 by mrosenfield
Replied by mrosenfield on topic CAN data
Yes, I see the operators on page 191. But what happens when you do a shift on a decimal value? Does it shift the binary value first, and then convert to decimal?

Please Log in or Create an account to join the conversation.

3 years 10 months ago #29532485 by niko
Replied by niko on topic CAN data
The shift operation is the same for a number either you see it in hex format or in decimal format.

Please Log in or Create an account to join the conversation.

Time to create page: 0.127 seconds