Search talk: last modification

 
<< < 1 2 3 (Page 3 of 3)

Post by niallel on CamBuilder and first boundary position not zero CODESYS Forge talk (Post)
Hi, I've read the CamBuilder documentation and it shows to use the left boundary of the first segment as SMCB.BoundImplicit(), so that the transition is as smooth as possible. With this it sets X and Y to 0. My first slave position is not 0 (say for example it's 100), so I would set it with SMCB.Bound(0,100). My question is that when the cam goes back to the start (Periodic := TRUE) , will it blend with the last position (360, 100) if I do this? I imagine it will, but the documentation isn't clear as the information in the Periodic Cams only says to set Smooth Transition in the cam properties - but when I'm defining it with code there isn't an option for Smooth Transition to be set. Hope this makes sense? Many thanks,
Last updated: 2024-10-23

Post by mabac on No file found CODESYS Forge talk (Post)
CODESYS introduced many cyber security related changes over the last few years, one of them is to restrict file access. By default, file access is restricted to the PlcLogic folder and subfolders of the CODESYS control runtime of version 3.5.19.0 and newer. For Control Win this would be the folder C:\ProgramData\CODESYS\CODESYSControlWinV3x64\xxxxxxxx\PlcLogic\ To enable access to other folders, you can configure additional paths by adding them to the file CODESYSControl.cfg. For example: [SysFile] FilePath=C:/temp/test FilePath.1=C:/Users/Public You should now be able to access your file in C:\temp\test\ or in C:\Users\Public
Last updated: 2024-10-30

Post by moksan on Unconnected_Send Explicit message with Route Path CODESYS Forge talk (Post)
I have been trying out Unconnected_Send Explicit Message with route path.(The Unconnected_Send service shall use the Connection Manager object in each router to forward the message and to remember the return path. Vol 1.3 / 3-5.6.7) However, I could not see the correct path on Wireshark. I want to see the Unconnected_Send Message Service Code as 0x52 and also the last of the message should have the route path. I want to ask some questions about this topic. The IIoDrvEIPAcylicServices Interface has the IoDrvSendUnconnectedMessage Method. And there is a struct (EIP_SendUnconnectedMessage) for this service. But there is no information about how to implement to project, and if it is successful, does it send a message with 0x52 Unconnected_Send Service Code or not? If that is not a solution, how can I set the Unconnected_Send Explicit Message struct on Codesys? Also how can I send explicit message with route path?
Last updated: 2023-10-17

Post by riccardo on VisuElems.CurrentUserGroupId is not stable CODESYS Forge talk (Post)
GoodMorning everyone. I have a system that, in case of alarm, have to block. When the operator logs in must have to acknoledge the alarm and should operate in the system freely. To perform this I detect the logged User by (VisuElems.CurrentUserGroupID <> 0) with a similar code to the the following: PROGRAM AlarmMngt VAR alarm : BOOL:= FALSE; Ack : BOOL:= TRUE; PushBottonOpening : BOOL:= FALSE; Valve : BOOL := FALSE; Flag: BOOL := FALSE; END_VAR IF alarm AND Ack AND (NOT Flag) THEN valve := FALSE; PushBottonOpening := FALSE; Ack := FALSE flag := TRUE; ELSIF (NOT alarm) AND Ack THEN flag := FALSE; END_IF (* if the system is in alarm but there is a logged operator that acknowledge the alarm the system allows the valve opening.*) IF (VisuElems.CurrentUserGroupID <> 0) AND Ack AND Alarm AND PushBottonOpening THEN Valve := TRUE; ELSIF (VisuElems.CurrentUserGroupID = 0) AND Alarm THEN valve := FALSE; END_IF The problem I have is in the last 5 lines of the code: Even if there is a logged in user, the GroupID variable is subjected to a refresh that cyclically set for an instant it to 0 and this close the valve making difficult to the user to work Now I solved it creating a time hysteresys cycle but it is not a good solution. Someone is able to explane me why the GroupID variable is sobjected to this refresh and how to stabilize to avoiding it? Thank you in advance, Riccardo
Last updated: 2023-11-10

Post by dominggus on when going online, stuck on "Syncing file "visuelemsdatetime.tl_datetime.txt" CODESYS Forge talk (Post)
Hi, We are currently using a Raspberry Pi 4 CM4 module in a EdgeBox RPI 200 - Industrial Edge Controller running the latest CODESYS Runtime Package 4.11.0.0. On the PC (actually an Intel Macbook Pro running Windows 10 in Parallels) we run CODESYS V3.5.19.50. Yesterday end of day when I was about to logoff and head home, I wanted to send the latest build to the Raspberry I clicked the Login button to compile a new version and then sync the application and all the files, it get's stuck on the last file to sync (see attached screenshot). This takes eternally, although sometimes, when I use my SFTP client (Cyberduck) and go into the raspberry and refresh the directory /var/opt/codesys/PlcLogic/visu/, or when I open the actual file visuelemsdatetime.tl_datetime.txt, it gets un-stuck (forcing a refresh, which might fix the syncing issue) and CODESYS continues and I can click the Start button to start the application. But this SFTP force refresh trick does not always help either... What could be the issue here? network connectivity? Can someone please help me out?
Last updated: 2024-03-02

Post by tyronnosaurus on ReceiveWatchdog FB not working on J1939 P2P PGNs CODESYS Forge talk (Post)
Hi guys. I've got a device that sends a status message over J1939 and a PLC running Codesys to receive it. This message uses a P2P PGN (as opposed to a broadcast PGN). Codesys can only read it if I mark the J1939_ECU as "Local" (see screenshot 1). The message is received correctly, that is not the problem. The problem is detecting if the message stops being received. Local ECUs have no Watchdog checkbox to detect if the message has been received in the last X seconds. In order to implement a watchdog, I've used a ReceiveWatchdog FB. The same code works well for any non-P2P message, but doesn't work for this particular P2P message I'm trying to monitor. Even if I physically disconnect the device, ReceiveWatchdog.xBusy stays True, and ReceiveWatchdog.xError never triggers due to a timeout error. Is there any caveat in the ReceiveWatchdog FB that makes it unable to monitor P2P PGNs in Local J1939_ECUs?
Last updated: 2024-07-11

Post by grant32 on RAMP_REAL FB is retaining my output value when i try to re use the FB CODESYS Forge talk (Post)
Hello, I'm relatively new to PLC programming. I am trying to creat a ramp down function, I have an example here of what I am using. I can get the function to work, the issue is that the OUT (variable3) value is being held by the FB so after I use it once it no longer works. In this example i set variable3 to 100 and the rest is as seen, over the course of a minute it ramped down to 10 (as desired). But when I deenergize TEST_START, set variable3 back to 100, and then re-energize TEST_START it immediately jumps back to the previously held value 10. The reset on this block just pauses the function and holds the last OUT. In my case I will need the function to start OUT at a set value, ramp down to the IN (variable2) value, and then accept a new OUT value to ramp down next time the block is energized. Hopefully this made sense, if anyone has any advice that would be awesome!
Last updated: 2024-07-29

Post by rossanoparis on Clarifications regarding the appropriate runtime system to use CODESYS Forge talk (Post)
Hallo all I would appreciate some clarifications regarding the appropriate runtime system to use. I've been using 'KUNBUS CPUs' and 'CODESYS Control for Raspberry Pi MC SL' for the last 4 years. Recently, there have been some changes in the CODESYS licensing policy. [ https://store.codesys.com/en/howto_applicationbasedlicenses ] My questions are mainly two: 1) If I need to start a new project using 'KUNBUS CPUs', which is the correct runtime system to use. 2) Old projects built using 'CODESYS Control for Raspberry Pi MC SL' should be updated to another RT system? Current RT systems ... a)CODESYS Control for Raspberry Pi MC SL b)CODESYS Control for Linux ARM SL c)CODESYS Virtual Control SL May I count on receiving an explanation to understand the differences among the runtime systems listed above? A detailed and well-organized answer would be greatly appreciated. Kind regards Rossano
Last updated: 2024-09-23

Post by rossanoparis on Clarifications regarding the appropriate runtime system to use CODESYS Forge talk (Post)
Thank you @TimvH It is clear that licences are application based and now thanks to your reply I could understand the meaning of RT systems. The RT called "CODESYS Control for Linux ARM SL" can be deployed on a generic debian based ARM system. The RT called "CODESYS Control for Raspberry Pi MC SL" is more specific for Rasberry HW. Did I understand correctly? Regarding the RT called "CODESYS Virtual Control SL" despite its description it is not clear to me when to use it. It seems that a project created using such RT system can be deployed on any HW. It sound good obviously, as it means that it is possible to realize a completely abstract project from its hardware. The only limit could be represented by the need of using a specific HW or OS feature, in that case a more specific RT system should be chosen. Is my last consideration correct? Regards Rossano
Last updated: 2024-09-26

Post by egau on Hard shutdown: no code on device after power on CODESYS Forge talk (Post)
This explanation aligns with the issues we’re experiencing with our machines. The scenario I described is happening with one of them (let’s call it Machine A). This machine is identical to another one (Machine B), except for some custom code that facilitates communication with an external Beckhoff PLC for MES integration in the production line. Machine B has been powered on and off daily for at least three months and has never had this problem. Given that, I highly doubt the MES custom code is the cause of the code corruption. This being said, your explanation does seem plausible. However, if faulty EtherCAT cables were the issue, why wouldn't the error occur during normal operation? Why would bad cables only cause problems during a hard shutdown? One last question: When you encountered this behavior, did you see a similar error in your logs? i.e, an "AccessViolation" exception in the EtherCAT Task?
Last updated: 2024-10-03

Post by acc00 on Redundancy Codesys Runtime, Synchronization CODESYS Forge talk (Post)
Hi, I’m currently testing the Codesys Redundancy application with 2 Raspberry Pi, with the idea is of using in my project 2 Wago PFC200 and 1 Ethercat Master with 2 Remote IO. After I configure the redundancy, and one Pi is Active and the other is Passive, if I disconnect the Ethernet cable of the Active, the Passive become Standalone, which is good, but the problem is the following: -When I recover the Ethernet connection, both stay Standalone. They will NOT Sync until I do it manually in the Codesys environment. How to make the synchronization automatically? -If both Pi/PLC stays Standalone, who is managing the IO? (Ethercat and Serial) I have done a test with an Modbus Slave, where I am sending a counter that increase every second. And I see that when both PLC are standalone, they both keep an active connection with the Slave, and both write values. This does not seem good, since according to this in my project both PLC would try to control the IO at the same time. Note: The Codesys have an option (greyed out, not possible to select) which says “Auto Sync”. What is the purpose, and why I’m not able to select it? I'm using Codesys Control for Rapsberry Pi 64SL Runtime in my test environment (2xRaspberry Pi 4), with the idea of using Codesys Control PFC 200 Runtime in my project (2xWago PFC200 and 1 Ethercat Master with 2x Wago 750-354 Ethercat Fieldbus Coupler). Using the last Codesys 3.5 version (SP19 PAtch 5). I'd appreciate a lot any help on this questions!
Last updated: 2024-01-22

Post by martinlithlith on Device User Logon and No device is responding.. Pi4b codesys 3.5 SP19 2 + (64-bit) CODESYS Forge talk (Post)
Hi! Im slowly starting to loose it and i need som help! After a few night of reading up and testing i´m still stuck as a rock and you guys and girls are my last resort for this project. Basic facts; Win 11 Codesys 3.5 SP19 2 + (64-bit) Raspberry pi 4 model b 2 gb Raspian release 11 aarch64 What keeps me up late at night; Username and Password when trying to connect to device and device only beeing connectable for a few seconds. Some of the things I have tried; Username and passord; Credientials from the raspberry Administrator Administrator admin admin Admin Admin administrator administrator Usernames and passwords that I sometimes use (this was a longshot i know, but i was running out of ideas and energy). :) Epand filesystem, activating i2c, spi, 1-wire I can start the gateway and start the runtime. I cant install the edgearm64, arm64 runtime package eventhough I guess i should, i get code [ERROR] Error output: dpkg: error processing archive /tmp/codesysedge_edgearm64_4.8.0.0_arm64.deb (--install): [ERROR] Error output: package architecture (arm64) does not match system (armhf) [ERROR] Error output: Errors were encountered while processing: [ERROR] Error output: /tmp/codesysedge_edgearm64_4.8.0.0_arm64.deb code as a respons. I have tried to Reset Origin Device - no change. I have tried to remove the /etc/CODESYSControl_User.cfg [CmpUserMgr] but i could not find it and i was not sure if i should add it instead but i did not want to mess somthing up. I have tried to create a second gateway with the specific ip if the pi, that did not help. Could it be that i´m currently connected to the pi through WIFI? I can ping the pi and I can connect and control it through VNC. When i scan to select gateway target (scan edge gateway) i find 17-21 devices but can find the pi throug the mac adress. I started of trying to use the "CODESYS Control for Raspberry Pi SL" (I have a license sience earlier) as i read somewhere that this could be used on a Pi4 as well but now i´m trying with the MC SL, no changes, same problem. Right now - gateway version 4.8.0.0 (edgearmHF, armhf), Runtime Package 4.5.0.0 (raspberry, armhf). Any sugestions are very welcome! As mentioned above, theese are some of the things that i have tried/done - but i have been going at this for a while. Best, Martin
Last updated: 2023-09-10

Post by dantheman on Connecting to SoftPLC Only Works By Turning Off Modbus Ethernet Port CODESYS Forge talk (Post)
I have an IPC with 2 ethernet ports and 1 Wi-Fi. I'm using ModbusTCP with the ethernet port named "enp2s0" connected to my remote I/O. This works fine when testing with Python and also works with CODESYS, but CODESYS is only able to scan for the Linux SoftPLC when I turn off the "enp2s0" interface. In other words, I can't get online with the IDE if I want my ModbusTCP comms to run with CODESYS. I'm using a Linux SoftPLC that has the following entry in CODESYSControl.cfg, hoping that this will allow me to connect with "enp1s0" or "wlp3s0", and leave "enp2s0" for field comms, but this seems to only make the source IP of the ModbusTCP comms to be bound to "enp2s0". That last point is the case only if I don't restart the service, but if I do restart the service after changing the config file, the source IP for the ModbusTCP comms then becomes the one for "enp1s0", which is very confusing to me: [SysSocket] Adapter.0.Name="enp2s0" Adapter.0.EnableSetIpAndMask=1 On the device list, I only have "enp2s0" given as the ethernet device that has the ModbusTCP master & slave beneath it, shown in Screenshot 1. On the IPC, I can ping the ModbusTCP client (remote I/O) from "enp2s0", and I've attached a Wireshark capture of running ModbusTCP from the CODESYS runtime as Screenshot 2, 3 & 4 (again, I can't get online when this is running, I have to turn off "enp2s0" to connect even when it's idle and I don't have an active TCP session with my Python tests). Like I explained above, the source IP is "enp1s0", even though the ethernet device on the project is "enp2s0". I was lucky to catch the red message that showed the source IP that makes sense to me (the one for "enp2s0"), but for some reason that connection was reset and I never saw that packet again. I've also tried this with Auto-reconnect both enabled & disabled, for the ModbusTCP Master device. I also have to turn off "enp1s0" and then turn it on, just so that I can have the ModbusTCP comms running from "enp2s0" (which is not intuitive in any way to me, I'd love some help understanding that phenomenon as well) in the weird manner that I've described above. I would be very appreciative if someone can help me figure out this pickle. I'd love to just connect to CODESYS through my Wi-Fi interface and leave my ethernet ports for field comms.
Last updated: 2024-08-01

Post by mogam on Internal error:System.NullReferenceException: The object reference was not set to an object instance. CODESYS Forge talk (Post)
Hi everyone, I have a my App that reads values from a shared memory than 2 variables x,y were calculated. here as you can see in my code: PROGRAM PLC_PRG VAR szName : STRING := '/SM'; ( Name of the shared memory.) uxiSize : __UXINT := 646 * 2 * SIZEOF(REAL); ( Size of the shared memory. ) hShm : RTS_IEC_HANDLE; ( Handle to the shared memory ) pStart : POINTER TO REAL; ( Pointer to the first element in the memory ) pData : POINTER TO REAL; ( Pointer, which is incremented until the last sign in the memory is reached. ) shared_data :ARRAY[0..645, 0..1] OF REAL; velocity : ARRAY[0..2] OF REAL; ( Velocity array ) position : ARRAY[0..2] OF REAL; ( Position array ) angleDepth : ARRAY[0..645, 0..1] OF REAL; ( Angle and depth array ) xEndOfMemory : BOOL; x : ARRAY[0..645] OF REAL := 1.0; y : ARRAY[0..645] OF REAL := 1.0; (* Result of actions at the memory. *) OpenResult : RTS_IEC_RESULT; ReadResult : RTS_IEC_RESULT; PointerResult : RTS_IEC_RESULT; DeleteResult : RTS_IEC_RESULT; CloseResult : RTS_IEC_RESULT; i : INT; END_VAR ( Open the shared memory ) hShm := SysSharedMemoryOpen2(szName, 0, ADR(uxiSize), ADR(OpenResult)); IF hShm <> RTS_INVALID_HANDLE THEN (* Read the entire shared memory table *) SysSharedMemoryRead(hShm:= hShm, ulOffset:= 0, pbyData:= ADR(shared_data), ulSize:= uxiSize, pResult:= ADR(ReadResult)); (* Fetch the pointer from the shared memory. The pointer is pointing to the first element address *) //pStart := SysSharedMemoryGetPointer(hShm, ADR(PointerResult)); (* Close the shared memory *) //CloseResult := SysSharedMemoryClose(hShm := hShm); (* Read velocity and position data from the shared memory *) FOR i := 0 TO 2 DO velocity[i] := shared_data[i, 0]; position[i] := shared_data[i, 1]; END_FOR; (* Read angle and depth data from the shared memory *) FOR i := 0 TO 645 DO angleDepth[i, 0] := shared_data[(i + 6), 0]; angleDepth[i, 1] := shared_data[(i + 6), 1]; END_FOR; FOR i := 0 TO 645 DO x[i] := angleDepth[i, 1]*COS(angleDepth[i, 0]); y[i] := angleDepth[i, 1]*SIN(angleDepth[i, 0]); END_FOR; END_IF For these values an XY-CHART needs to be done and when i create a visualisation and set the x data and y data when i try to compile, i recieve this error: ------ Übersetzungslauf gestartet: Applikation: Device.Read_App ------- Code typisieren ... [FEHLER] Internal error:System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. bei _3S.CoDeSys.LanguageModelManager.LDateType.Accept(ITypeVisitor typvis) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IArrayType ) bei ..(_IPointerType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IPointerType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IPointerType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei _3S.CoDeSys.Compiler35140.Compiler.(_ICompileContext , _IPreCompileContext , _ICompileContext , IProgressCallback ) bei _3S.CoDeSys.Compiler35140.Compiler.(_ICompileContext , Boolean , Boolean , _IPreCompileContext , _IPreCompileContext , _ICompileContext , Boolean , Boolean& , IProgressCallback ) bei _3S.CoDeSys.Compiler35140.Compiler.(Guid , Boolean , Boolean , Boolean , Boolean& , _ICompileContext& , _ICompileContext& , IProgressCallback , Boolean , Boolean ) Kompilierung abgeschlossen -- 1 Fehler, 0 Warnungen Übersetzung abgeschlossen -- 1 Fehler, 0 Warnungen : Kein Download möglich!
Last updated: 2024-05-24

Post by mogam on Internal error:System.NullReferenceException: The object reference was not set to an object instance. CODESYS Forge talk (Post)
Hi everyone, I have a my App that reads values from a shared memory than 2 variables x,y were calculated. here as you can see in my code: PROGRAM PLC_PRG VAR szName : STRING := '/SM'; ( Name of the shared memory.) uxiSize : __UXINT := 646 * 2 * SIZEOF(REAL); ( Size of the shared memory. ) hShm : RTS_IEC_HANDLE; ( Handle to the shared memory ) pStart : POINTER TO REAL; ( Pointer to the first element in the memory ) pData : POINTER TO REAL; ( Pointer, which is incremented until the last sign in the memory is reached. ) shared_data :ARRAY[0..645, 0..1] OF REAL; velocity : ARRAY[0..2] OF REAL; ( Velocity array ) position : ARRAY[0..2] OF REAL; ( Position array ) angleDepth : ARRAY[0..645, 0..1] OF REAL; ( Angle and depth array ) xEndOfMemory : BOOL; x : ARRAY[0..645] OF REAL := 1.0; y : ARRAY[0..645] OF REAL := 1.0; (* Result of actions at the memory. *) OpenResult : RTS_IEC_RESULT; ReadResult : RTS_IEC_RESULT; PointerResult : RTS_IEC_RESULT; DeleteResult : RTS_IEC_RESULT; CloseResult : RTS_IEC_RESULT; i : INT; END_VAR ( Open the shared memory ) hShm := SysSharedMemoryOpen2(szName, 0, ADR(uxiSize), ADR(OpenResult)); IF hShm <> RTS_INVALID_HANDLE THEN (* Read the entire shared memory table *) SysSharedMemoryRead(hShm:= hShm, ulOffset:= 0, pbyData:= ADR(shared_data), ulSize:= uxiSize, pResult:= ADR(ReadResult)); (* Fetch the pointer from the shared memory. The pointer is pointing to the first element address *) //pStart := SysSharedMemoryGetPointer(hShm, ADR(PointerResult)); (* Close the shared memory *) //CloseResult := SysSharedMemoryClose(hShm := hShm); (* Read velocity and position data from the shared memory *) FOR i := 0 TO 2 DO velocity[i] := shared_data[i, 0]; position[i] := shared_data[i, 1]; END_FOR; (* Read angle and depth data from the shared memory *) FOR i := 0 TO 645 DO angleDepth[i, 0] := shared_data[(i + 6), 0]; angleDepth[i, 1] := shared_data[(i + 6), 1]; END_FOR; FOR i := 0 TO 645 DO x[i] := angleDepth[i, 1]*COS(angleDepth[i, 0]); y[i] := angleDepth[i, 1]*SIN(angleDepth[i, 0]); END_FOR; END_IF For these values an XY-CHART needs to be done and when i create a visualisation and set the x data and y data when i try to compile, i recieve this error: ------ Übersetzungslauf gestartet: Applikation: Device.Read_App ------- Code typisieren ... [FEHLER] Internal error:System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. bei _3S.CoDeSys.LanguageModelManager.LDateType.Accept(ITypeVisitor typvis) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IArrayType ) bei ..(_IPointerType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IPointerType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IPointerType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei ..(_ISignature , _IPreCompileContext ) bei ..( ) bei ..(String ) bei ..(String , IVariable[]& , ISignature[]& ) bei ..(String , IVariable[]& , ISignature[]& , IScope& ) bei ..visit(_IVariableExpression , AccessFlag ) bei ..(_IUserdefType ) bei ..(_IVariable , IScope5 , _ICompileContext , _ISignature ) bei ..(_ISignature , IScope5 , _ICompileContext ) bei _3S.CoDeSys.Compiler35140.Compiler.(_ICompileContext , _IPreCompileContext , _ICompileContext , IProgressCallback ) bei _3S.CoDeSys.Compiler35140.Compiler.(_ICompileContext , Boolean , Boolean , _IPreCompileContext , _IPreCompileContext , _ICompileContext , Boolean , Boolean& , IProgressCallback ) bei _3S.CoDeSys.Compiler35140.Compiler.(Guid , Boolean , Boolean , Boolean , Boolean& , _ICompileContext& , _ICompileContext& , IProgressCallback , Boolean , Boolean ) Kompilierung abgeschlossen -- 1 Fehler, 0 Warnungen Übersetzung abgeschlossen -- 1 Fehler, 0 Warnungen : Kein Download möglich!
Last updated: 2024-05-24

Post by paulg on RasPi CAA Serial example - unexpected behavior during debug CODESYS Forge talk (Post)
I've trimmed down the CAA Serial Codesys example to only listen on one port but, when stepping through the Case structure in debug mode, it jumps out of the structure during a specific point in every scan (I'll point it out below after describing the setup and listing the code). I'm using a Pi 4 Model B, and I have an Arduino Nano Every plugged in via USB which is streaming the following serial message at 1 Hz: Time since opening connection: 1 s Time since opening connection: 2 s ...and so on. The Pi shows the Nano at /dev/ttyACM0 so I edited CODESYSControl_User.cfg to read: Linux.Devicefile=/dev/ttyACM The code in my PLC_PRG is (ignore some of the comments, I hadn't deleted them out from the original example): PROGRAM PLC_PRG VAR xStartTest : BOOL:= TRUE; iState : INT; xTestDone : BOOL;(* True, when the test was done succesfully *) (* Settings to communicate with the COM Port *) aCom1Params : ARRAY [1..7] OF COM.PARAMETER; como1 : COM.Open; comc1 : COM.Close; comw1 : COM.Write; comr1 : COM.Read; //sWrite : STRING := 'Test String!'; sRead : STRING(25); szRead : CAA.SIZE; xCom1OpenError : BOOL; xCom1CloseError : BOOL; xCom1WriteError : BOOL; xCom1ReadError : BOOL; END_VAR //This example shows the communication of two COM Ports with each other. //The first one writes a string of characters, which is read by the second one. //After successful execution, the two COM Ports are closed and the test is done. IF xStartTest THEN CASE iState OF 0: //The parameters are set for the COM Port aCom1Params[1].udiParameterId := COM.CAA_Parameter_Constants.udiPort; aCom1Params[1].udiValue := 1; // the correct Port should be adapted aCom1Params[2].udiParameterId := COM.CAA_Parameter_Constants.udiBaudrate; aCom1Params[2].udiValue := 115200; aCom1Params[3].udiParameterId := COM.CAA_Parameter_Constants.udiParity; aCom1Params[3].udiValue := INT_TO_UDINT(COM.PARITY.NONE); aCom1Params[4].udiParameterId := COM.CAA_Parameter_Constants.udiStopBits; aCom1Params[4].udiValue := INT_TO_UDINT(COM.STOPBIT.ONESTOPBIT); aCom1Params[5].udiParameterId := COM.CAA_Parameter_Constants.udiTimeout; aCom1Params[5].udiValue := 0; aCom1Params[6].udiParameterId := COM.CAA_Parameter_Constants.udiByteSize; aCom1Params[6].udiValue := 8; aCom1Params[7].udiParameterId := COM.CAA_Parameter_Constants.udiBinary; aCom1Params[7].udiValue := 0; //The first Port is opened with the given parameters como1(xExecute := TRUE, usiListLength:=SIZEOF(aCom1Params)/SIZEOF(COM.PARAMETER),pParameterList:= ADR(aCom1Params)); IF como1.xError THEN xCom1OpenError := TRUE; iState := 1000; END_IF //After a successful opening, the next state is reached IF como1.xDone THEN iState := 15; END_IF 15: // the reading process is started comr1(xExecute := TRUE,hCom:= como1.hCom, pBuffer:= ADR(sRead), szBuffer:= SIZEOF(sRead)); IF comr1.xError THEN xCom1ReadError := TRUE; END_IF //After completion the size of the written bytes are saved IF comr1.xDone OR comr1.xError THEN szRead := comr1.szSize; iState := 20; END_IF 20: // If everything was successful the ports are closed and the handles are released comc1(xExecute := TRUE,hCom:= como1.hCom); IF comc1.xError THEN xCom1CloseError := TRUE; END_IF IF comc1.xDone OR comc1.xError THEN iState := 25; END_IF 25: // The first port is closed and the used handle released xTestDone := TRUE; xStartTest := FALSE; iState := 0; como1(xExecute := FALSE); comw1(xExecute := FALSE); comc1(xExecute := FALSE); ELSE iState := 0; END_CASE END_IF I realize as I write this that the .udiPort should be 0 and not 1, but that shouldn't be causing the issue I'm seeing. I'm forcing xStartTest:=TRUE every scan so that I can step into each line and observe what's happening. What I see is that the port parameters are set and the port is opened with no errors, but the code jumps out of the case structure to the last line every time it reaches (and I step into) the iState:=15 line (at the end of the iState:=0 block). So every scan cycle it goes through the block for iState=0 and jumps out at the same spot. I'm a little new to PLC programming so I may be misunderstanding the flow, but shouldn't this case structure keep moving down in the same scan? If it only handles one case per scan, why doesn't the value of iState persist? Thanks! Update: I restarted the Codesys control today and I was then able to see an error for como1.eError of "WRONG_PARAMETER". I tried doing some digging and another post made me think I should add another line to CODESYSControl_User.cfg, so I now have: [SysCom] Linux.Devicefile=/dev/ttyACM portnum := COM.SysCom.SYS_COMPORT1 So now when I set .udiPort to 1, I get "NO_ERROR" but I also don't read anything from the port (i.e. szRead = 0 always). If I try setting the port to 0 (which I'm confused about, because I added a COMPORT1 line but the device shows on the Pi as ACM0), I get the "WRONG_PARAMETER" error again. Is there an easier way to troubleshoot the Pi and view what ports the Codesys runtime is actually able to see while the Pi is running?
Last updated: 2024-06-06

<< < 1 2 3 (Page 3 of 3)

Showing results of 66

Sort by relevance or date