Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
bit shift left error
#1
I have the code below in a PPMAC script file. It is reporting "syntax error, unexpected SHIFT-LEFT" on the first line that has the <<. The following lines do not report the error. If I comment out the first shift left line, then the next shift line reports the same error. The editor shows the first << as underlined in red showing the error. According to the PPMAC software reference manual, this command should be allowed. Any ideas on what I'm missing here?


// Write flag data to Modbus
temp_byte = rRange200y;
temp_byte << 1;
temp_byte |= rRange200x;
temp_byte << 1;
temp_byte |= rRange100z;
temp_byte << 1;
temp_byte |= rRange100y;
temp_byte << 1;
temp_byte |= rRange100x;
temp_byte << 1;
temp_byte |= rESTOP_Out;
temp_byte << 2;
Sys.ModbusServerBuffer[2] = temp_byte; //load byte
Reply
#2
Without checking I am guessing that it is complaining that you have not assigned the left-shifted value to anything.

Maybe

Code:
temp_byte = rRange200y;
newtemp = temp_byte <<;
...

(07-16-2018, 02:59 PM)kevinharris Wrote: I have the code below in a PPMAC script file. It is reporting "syntax error, unexpected SHIFT-LEFT" on the first line that has the <<. The following lines do not report the error. If I comment out the first shift left line, then the next shift line reports the same error. The editor shows the first << as underlined in red showing the error. According to the PPMAC software reference manual, this command should be allowed. Any ideas on what I'm missing here?


// Write flag data to Modbus
temp_byte = rRange200y;
temp_byte << 1;
temp_byte |= rRange200x;
temp_byte << 1;
temp_byte |= rRange100z;
temp_byte << 1;
temp_byte |= rRange100y;
temp_byte << 1;
temp_byte |= rRange100x;
temp_byte << 1;
temp_byte |= rESTOP_Out;
temp_byte << 2;
Sys.ModbusServerBuffer[2] = temp_byte; //load byte
Reply
#3
Figured the problem out with the syntax error.
should have been:
temp_byte <<= 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)