Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Raspberry Pi, Simulator, Trace - Exception

2014-09-07
2014-09-09
  • barnstormer - 2014-09-07

    Hello all,

    I'm learning about adding a trace element to the visualization and not sure if I'm seeing a bug or doing something wrong. I'm using a fresh install of 3.5 SP5 patch 1

    Using the on-line help, I added a trace component on a background with two buttons in a visualization. The code for the buttons is as specified in the help file. Here is the simple ST program. The trace function task is 'Main Task' and the variable to trace is PLC_PRG.iHugo.

    PROGRAM PLC_PRG
    VAR
    bStart: BOOL;
    bStop: BOOL;
    iHugo: INT;
    END_VAR

    iHugo := iHugo + 1;

    When I enable the simulator and login, the program builds and the IDE shows 'Program Loaded'. There is a warning: C0315: String variable 'pszName too short... When I try to start the program, the IDE blinks 'Program Loaded - Exception'.

    However, when I download this to my Raspberry PI, the program runs fine.

    I had SP4 installed, but removed it and re-installed SP5. All the libraries loaded, etc. I have the newest Raspberry PI package installed, too. This is running under Windows 7 32 bit Virtual Machine in Virtual Box, with the latest Guest Additions.

    BTW, the newly posted Trace vs Trend program does not run under the simulator for me either, neither does the WebVisu example project. I tried 'Updating the Device', just in case. They both run fine on the PI.

    Does anybody know what I'm missing?
    How can I debug the 'Program Load - Exception' issue?
    How do I fix the C0315 error?

    Thanks for your help.

     
  • eschwellinger

    eschwellinger - 2014-09-08

    Hi,

    I agree that this should not lead to an exception in simulation modus,
    there fore I'll add an entry in our bug tracking database.

    But some kinds of application make from practical aspect more or less sense working with simulation.
    -> Webvisu projects - Simulation does not contain a webserver
    -> Trend in Simulation does not have the SQLite db
    -> IO Handling -> Simulation does not have an IOManager

    For these kind of applications I would always recommend to download the project to the local Control Win plc
    which is available on every CODESYS installation.

    If you go back to your real hardware plc - you only need to 'update the device' to your plc (Control Win -> Raspebrry Pi)

    Debugging Exceptions in general:

    Got to the plc log - rightclick on the exception should lead you to the code where the exception occure (if it is in the application or in the library)

    BR
    Edwin

     
  • barnstormer - 2014-09-09

    Thanks for the help. I found the log. There are two back to back exceptions, which occur when I press the start button.

    SOURCEPOSITION App=[Sim.Device.Application] area=0, offset=1206309
    EXCEPTION [AccessViolation] occurred: App=[Sim.Device.Application], Task=[VISU_TASK]

    I wonder if this is a permissions problem?

     
  • eschwellinger

    eschwellinger - 2014-09-09

    Hi,
    what happens if you righclick on this line:
    SOURCEPOSITION App=[Sim.Device.Application] area=0, offset=1206309
    and try to go to the source position?
    CODESYS should point you to the line of code where the exception occure (if it happens in the IECCode) or should point you to the library if it is a compiled library.

    BR
    Edwin

     

Log in to post a comment.