SMC_ReadNCFile2 is always busy

berkdan
2025-06-16
2025-06-17
  • berkdan - 2025-06-16

    Hello,

    I’m using CODESYS V3.5 SP18.
    When I try to use SMC_ReadNCFile2 to read the file /PlcLogic/gcode.nc, the function block's bBusy output remains TRUE indefinitely.
    Can you help me understand what I might be doing wrong?

    Here is how I’m calling the function block.
    The value of strFileName is 'gcode.nc'.

    fbReadFile(
    bExecute := bExecute,
    sFileName := strFileName,
    bAbort := bCycleStop,
    fDefaultVel := RetainVariables.xSlowVelocity,
    fDefaultAccel := RetainVariables.xAcc,
    fDefaultDecel := RetainVariables.xDec,
    b3DMode := TRUE,
    bParenthesesAsComments := TRUE,
    fDefaultVelFF := RetainVariables.xFastVelocity,
    fDefaultAccelFF := RetainVariables.xAcc,
    fDefaultDecelFF := RetainVariables.xDec,
    ErrorID => gCNC.eErrorId,
    errorPos => gCNC.eErrorPos,
    ErrorProgramName => gCNC.eErrorProgName,
    bBusy => bReadFileBusy,
    sentences => sentencesss
    );
    Thanks in advance for your help.

     
  • tk096 - 2025-06-17

    Hi, do you process the sentences subsequently? If not, the function block fills the sentences (queue) and waits for the sentences to be processed, so that new sentences can be read and filled to the queue.

     
  • berkdan - 2025-06-17

    Hey tk96 Thank you for your help.
    I have found the reason why fbreader stuck.
    It was not the program but it was the gcode itself.
    G21 command blocks the reader. And multiple G codes in a line also blocks the reader.
    My code was:
    N010 G21 G17 G90 -> Blocked the reader

    When i change it to:
    N010 G90
    N020 G17
    Then it worked.
    The only thing i did not get is why the reader did not thwor error. ErrorId was SMC_NO_ERROR.
    Anyway, it is now working.
    Thanks again.

     

    Last edit: berkdan 2025-06-17
  • tk096 - 2025-06-17

    Hi, the subsequent interpreter should report an error? The reader is just reading the file without checking the syntax.

     

Log in to post a comment.