CAN cmd 8, SDO read, data type

CAN cmd 8, SDO read, data type

This sub-routine looks at the first value returned by CAN function 8, which is the data type.

  IF can_ok=FALSE THEN
    PRINT #op_chan,"CAN error SDO ";HEX(obj_index)
  ELSEIF VR(vrbase)=$80 THEN
    PRINT #op_chan,"SDO ";HEX(obj_index);" read aborted by slave"
  ELSEIF VR(vrbase)=$4f THEN
    ' byte
    PRINT #op_chan,(VR(vrbase+1))[0];" ";HEX(VR(vrbase+1))
  ELSEIF VR(vrbase)=$4b THEN
    ' int
    PRINT #op_chan,(VR(vrbase+1))[0];" ";HEX(VR(vrbase+1))
  ELSEIF VR(vrbase)=$43 THEN
    ' 32 bit long int
    PRINT #op_chan,VR(vrbase+1)+VR(vrbase+2)*65536[0];
    PRINT #op_chan,"  ";HEX(VR(vrbase+2));" ";HEX(VR(vrbase+1))
  ELSEIF VR(vrbase)=$41 THEN
    ' string
    clast=VR(vrbase+1)
    IF clast>32 THEN clast=32
    FOR c=1 TO clast
      PRINT #op_chan,CHR(VR(vrbase+1+c));
    NEXT c
    PRINT #op_chan,""
  ENDIF

$80 means "aborted",
$4F = byte
$4B = Int
$43 = Long int
$41 = string