Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Compiling Interpretable Extended Byte Code fails with the error "Unsupported op" when no unsupported ops are used in the ladder program

(you are viewing a thread; or go back to list of threads)

Compiling Interpretable Extended Byte Code fails with the error "Unsupported op" when no unsupported ops are used in the ladder program (by Flenser)
Test case to demonstrate the issue:
Start the current version of LDmicro version 4.3.3
Create a new program that has a single rung with a single contact and a single coil:
- Menu Instruction -> Insert Contacts: Input Pin
- Menu Instruction -> Insert Coil: Output Pin
Compile this program as Interpretable Extended Byte Code
- Menu Compile -> Compile Interpretable Extended Byte Code
The "Compile To" dialog is displayed. Accept the default filename "new.xint" and click the button Save.
The compile fails with the error "Unsupported op (anything ADC, PWM, UART, EEPROM, SFR..)" even though the program only uses a contact and a coil.

My investigation into the reason for this issue:
The intermediate code causing the failure is op 2010 (INT_AllocFwdAddr)
The function GenerateIntermediateCode() in file intcode.cpp has the following code, where Op() is called with the parameter INT_AllocFwdAddr :
for(rung = 0; rung <= Prog.numRungs; rung++) {
rungNow = rung;
whichNow = -INT_MAX;
leafNow = NULL;
Prog.OpsInRung[rung] = 0;
Prog.HexInRung[rung] = 0;
Op(INT_AllocFwdAddr, (SDWORD)rung);
}

The functions CompileFromIntermediate() in the files avr.cpp and pic16.cpp both implement a case that handles the op INT_AllocFwdAddr.

The function GenerateAnsiC() in file ansic.cpp has a case with the code below that handles this op code, so compiling ANSI C code does not fail with this error.
case INT_AllocFwdAddr:
//fprintf(f, "#warning INT_%d\n", IntCode[i].op);
break;

However, the funciton CompileXInterpreted() in the file xinterpreted.cpp does not have a case to handle the op INT_AllocFwdAddr and so this op gets handled by the default case which reports the error "Unsupported op (anything ADC, PWM, UART, EEPROM, SFR..)"

The op INT_AllocFwdAddr appears to be only used when compiling Hex output so it appears that the function CompileXInterpreted() could have a case added to handle this op code in the same way as it is handled when compiling ANSI C.

The CompileInterpreted() funciton in the file interpreted.cpp and the function GenerateIntOpcodes() in the file netzer.cpp also do not have a case to handle the op INT_AllocFwdAddr.
Thu Dec 28 2017, 08:48:22
(no subject) (by Ihor Nehrutsa)
Fixed in Release 4.3.4
Wed Jan 10 2018, 19:04:39
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):