Peak PCAN router - Converting signal do physical format and sending back to CAN

11 Views Asked by At

Hello I am using Peak PCAN router gateway. I need to read a 48 bit/motorola/signed signal from CAN, convert to physical value, do some additional mathematical treatment and then send to CAN.

Why the bitshit does work in this case? Which type of variable should store RxMsgLongitude tp tret later in the code beofre sending?

I really need help here!!!

//Code

CANRxMsg_t  RxMsg;
CANTxMsg_t  LongMs;

   case 0x309:
            {
                RxMsgLongitude[0] = RxMsg.data32[0]; //first 32 bits
            RxMsgLongitude[1] = RxMsg.data16[1]; //then the 16 bits

                  double Longtest = (double) ((RxMsgLongitude[0] << 16) | (RxMsgLongitude[1] >> 32))*0.0000001 + 0;

               break;
            }
0

There are 0 best solutions below