Search talk: var static

 
<< < 1 .. 6 7 8 (Page 8 of 8)

Post by wildcard on Modbus Client Request Not Processed CODESYS Forge talk (Post)
Hi, does anyone has a solution for this issue. I've the same problem. I've implemented a very simple client based on the Modbus Examples and connected the soft PLC to a Modbus Simulator. PROGRAM ModbusClient VAR initDone : BOOL := FALSE; errorID : ModbusFB.Error; client : ModbusFB.ClientTCP; timeout : UDINT := 500000; replyTimeout : UDINT := 200000; aUINT : ARRAY [0..8] OF UINT; clientRequestReadHoldingRegisters : ModbusFB.ClientRequestReadHoldingRegisters; clientRequestsCnt : UINT := 0; clientRequestsProcessCnt : UINT := 0; ipAddress : ARRAY[0..3] OF BYTE := [10,54,0,72]; END_VAR IF NOT initDone THEN initDone := TRUE; client(aIPaddr:=ipAddress, udiLogOptions:=ModbusFB.LoggingOptions.All); client(xConnect:=TRUE, ); clientRequestReadHoldingRegisters(rClient:=client, udiTimeOut:=timeout, uiUnitId:=1, uiStartItem:=0, uiQuantity:=4, pData:=ADR(aUINT[0]), udiReplyTimeout:=replyTimeout); clientRequestReadHoldingRegisters.xExecute := TRUE; clientRequestsCnt := 0; END_IF clientRequestReadHoldingRegisters(rClient:=client, udiTimeOut:=timeout, uiUnitId:=1, uiStartItem:=0, uiQuantity:=4, pData:=ADR(aUINT[0]), udiReplyTimeout:=replyTimeout, xExecute := TRUE); IF clientRequestReadHoldingRegisters.xError THEN clientRequestsCnt := clientRequestsCnt +1 ; errorID := clientRequestReadHoldingRegisters.eErrorID; END_IF clientRequestReadHoldingRegisters(rClient:=client, udiTimeOut:=timeout, uiUnitId:=1, uiStartItem:=0, uiQuantity:=4, pData:=ADR(aUINT[0]), udiReplyTimeout:=replyTimeout, xExecute := NOT clientRequestReadHoldingRegisters.xExecute); When the system is running I do get the following on the logs: 2024-05-13T10:18:07.443Z: Cmp=MODBUS lib, Class=1, Error=0, Info=0, pszInfo= Client.RequestProcessed ClientRequest,16#0164ADC561A0 unitId=1 fc=ReadHoldingRegisters id=2070 state=Error 2024-05-13T10:18:07.443Z: Cmp=MODBUS lib, Class=1, Error=0, Info=0, pszInfo= ClientRequest,16#0164ADC561A0 unitId=1 fc=ReadHoldingRegisters id=2070 change state Error -> None timestamp=63843421226 2024-05-13T10:18:08.444Z: Cmp=MODBUS lib, Class=1, Error=0, Info=0, pszInfo= ClientRequest,16#0164ADC561A0 unitId=1 fc=ReadHoldingRegisters id=2071 change state None -> Init timestamp=63844421420 2024-05-13T10:18:09.444Z: Cmp=MODBUS lib, Class=1, Error=0, Info=0, pszInfo= ClientRequest,16#0164ADC561A0 unitId=1 fc=ReadHoldingRegisters id=2071 change state Init -> Error timestamp=63845421675 But the errorID is jumping between OK and RequestNotProcessed. Any help is very appreciated which gives me a hint what I'm doing wrong. Thanks
Last updated: 2024-05-13

Post by anonymous on Hi, I try to send and receive data using a UDP connection via SysSocket 3.5.17.0. While sending data works fine, I have problems with the receiving part. I am able to capture the received data of client side in wireshark But unable to capture it on the codesys CODESYS Forge talk (Post)
Hi, I try to send and receive data using a UDP connection via SysSocket 3.5.17.0. While sending data works fine, I have problems with the receiving part.I am able to capture the data of client side in wireshark but i am unable to capture it in the codesys. Heres the below part of code of client side. PROGRAM POU_udpclient_program VAR istep : INT := 1;//step variable for state machine xStart: BOOL;// Flag to start the UDP protocol iecSocketId: syssocket_interfaces.RTS_IEC_HANDLE;//socket handle for receiving iecCreateResult: syssocket_interfaces.RTS_IEC_RESULT; ipAddr: syssocket.SOCKADDRESS;//Socket address structure for receiving sIpAddress : STRING := '192.168.0.2'; wPort: WORD:= 12346; iecConnectResult : syssocket_interfaces.RTS_IEC_RESULT;//connect paramters sDataRec : STRING[255];//Buffer for received data xiRecBytes : __XINT;//number of bytes received iecRecResult : syssocket_interfaces.RTS_IEC_RESULT;//receive data parameters iecCloseResult : syssocket_interfaces.RTS_IEC_RESULT; END_VAR syssocket.SysSockInetAddr(sIpAddress,ADR(ipAddr.sin_addr)); ipAddr.sin_family := syssocket.SOCKET_AF_INET; ipAddr.sin_port := syssocket.SysSockHtons(wPort); CASE istep OF 1: //create socket IF xStart THEN iecSocketId:= syssocket.SysSockCreate(syssocket.SOCKET_AF_INET,syssocket.SOCKET_DGRAM,syssocket.SOCKET_IPPROTO_IP,ADR(iecCreateResult)); IF iecSocketId = syssocket_interfaces.RTS_INVALID_HANDLE THEN xStart := FALSE; istep := 1; ELSE istep := 2; END_IF END_IF 2: //connect to socket server using setoption iecConnectResult := syssocket.SysSockSetOption(iecSocketId,syssocket.SOCKET_SOL,syssocket.SOCKET_SO_REUSEADDR,ADR(ipAddr),SIZEOF(ipAddr)); istep := 3; 3: //receive data xiRecBytes := syssocket.SysSockRecvFrom(iecSocketId,ADR(sDataRec),SIZEOF(sDataRec),0,ADR(ipAddr),SIZEOF(ipAddr),ADR(iecRecResult)); istep := 4; 4: //close socket iecCloseResult:= syssocket.SysSockClose(iecSocketId); xStart := FALSE; istep := 1; END_CASE
Last updated: 2024-06-03

Post by thommy54 on CODESYSControl_User cfg richtig konfigurieren CODESYS Forge talk (Post)
Hallo, nach Erwerb eines neueren Raspberry pi 4 (V1.5) musste ich zwangsläufig von Codesys 3.5.16 hochwechseln - ich habe auf 3.5.20.1 geupdated. Da schlugen mir plötzlich ne Menge Einschränkungen entgegen, deren Behebung einige Zeit dauerte. Eine davon ist, das ein SysFile.SysFileOpen nicht mehr funktioniert. Ich habe das Problem mit Einträgen in der /etc/CODESYSControl.cfg behoben: [SysFile] FilePath.1=/etc/, 3S.dat IecFilePath.1=/proc/, cpuinfo IecFilePath.2=/proc/, iomem PlaceholderFilePath.1=/sys/devices/w1_bus_master1, $OneWire$ PlcLogicPrefix=1 ; ; ---------------------- ; selbst eingefügt PlaceholderFilePath.2=/home/root, $my_home_root$ PlaceholderFilePath.3=/etc/init.d, $my_conf$ PlaceholderFilePath.4=/var/lib/mpd, $my_music$ PlaceholderFilePath.5=/root/Rasp_SPS_Filesystem, $my_Rasp$ Ob die Einträge sich etwas überlappen, kann mir gern jemand sagen, das ist aber nicht das Problem. Ich habe bei den vielen Versuchen, das Teil zum Laufen zu bringen, bemerkt, daß die Einträge auch ganz schnell mal verschwinden. Das ist ja auch so beschrieben, wenn die nächste Version kommt, sind meine Einträge weg. Da ich ähnliche Probleme mit dem Funktionieren von "SysProcessExecuteCommand2()" hatte, die ich ebenfalls mit Einträgen in die /etc/CODESYSControl.cfg hätte beheben können, habe ich gelesen, das man "private" Einträge lieber in die Datei /etc/CODESYSControl_User.cfg machen soll. Gesagt getan und "SysProcessExecuteCommand2()" lief: [SysProcess] Command=AllowAll Command.0=shutdown Aber auch irgendwo stand, das so ein Beteichner wie [SysFile] oder [SysProcess] nur einmal in den beiden Files /etc/CODESYSControl.cfg oder(!) /etc/CODESYSControl_User.cfg vorkommen darf. Das ist nun die eigentliche Frage! Ist das so ? Bei [SysProcess] ist das kein Problem, das gibt es in /etc/CODESYSControl.cfg nicht. Aber bei [SysFile] sieht das anders aus. Da sind 5 Zeilen schon in /etc/CODESYSControl.cfg drin. Würde ich diese in die User-Datei rüberschieben, könnte beim nächsten Update was fehlen oder, oder... Lasse ich es so wie es ist, sind meine Einträge beim Update weg - das sollte ja verhindert werden. Kann da jemand genaue Auskunft geben ?? Vielen Dank Thomas
Last updated: 2024-06-28

Post by jeffg on ERROR: GetNetLinkSockAndInfoByMac(): could not open netlink socket: Too many open files CODESYS Forge talk (Post)
I just installed codesys runtime on a raspberry pi Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz (Compute Module 4) I am running on Codesys control for raspberry pi 64 SL ver 4.13.0 and I keep getting a crash after about five to ten minutes. This program was running fine on a 32bit system with runtime 4.8 previously but they upgraded the panel PC cause it got smashed. Looking at the logs I see this error "ERROR: GetNetLinkSockAndInfoByMac(): could not open netlink socket: Too many open files" at the time of crash. I do have a UDP socket open for a serial to ethernet adapter and im wondering if maybe its opening a bunch of sockets and while receiving messages, Im not sending anything to the device only receiving. Below is the code used for the UDP VAR // Scale Comm fbPeerServer : NBS.UDP_Peer; ipAddress : NBS.IPv4Address; fbReceive : NBS.UDP_Receive; xPeerActiv : BOOL := TRUE; abyReceive : ARRAY [0..255] OF BYTE; sLastValidReceive : STRING(255); udiIndex : UDINT; END_VAR IF xPeerActiv AND NOT fbPeerServer.xBusy THEN ipAddress.SetInitialValue(ipAddress := gvlSettings.sIPAddres); fbPeerServer(xEnable := TRUE, itfIPAddress := ipAddress, uiPort := gvlSettings.uiPort); END_IF fbPeerServer(); fbReceive(xEnable := fbPeerServer.xBusy, itfPeer := fbPeerServer, pData := ADR(abyReceive), udiSize := SIZEOF(abyReceive)); IF fbReceive.udiCount > 0 THEN IF fbReceive.udiCount < SIZEOF(sLastValidReceive) THEN SysMem.SysMemCpy(pDest := ADR(sLastValidReceive), pSrc := ADR(abyReceive), udiCount := fbReceive.udiCount); // Set End of String sLastValidReceive[fbReceive.udiCount] := 0; END_IF END_IF If anyone as seen this I could really use some help figuring it out. I included the Log report
Last updated: 2024-09-19

Post by mgabryel on Problems with CAN 2.0 comunication on Wago PLC (Codesys 3.5) CODESYS Forge talk (Post)
Hello, I am trying to program CAN Bus comunication on WAGO PLC (more precisely on WAGO Touch Monitor model TP600). I am using for this purpose library "WagoAppCanLayer2" from Wago company. My IDE for programming this device is CODESYS V3.5 SP19 Patch 2 + (64-bit). My program is written in Structured text using function blocks from previously mentioned library. Here is code of this program: 1) Variables declarations: PROGRAM PLC_PRG VAR oOpenInterface : WagoAppCanLayer2.FbCanL2Open :=( udiBaudrate := 125000 ); xInterfaceIsOpen : BOOL; sInterfaceInfo : STRING; oReceive : WagoAppCanLayer2.FbCanRx29BitFrame :=( xBufferMode := FALSE, wCanId := 16#181 ); xRecv : BOOL; sReceiveInfo : STRING; oSend : WagoAppCanLayer2.FbCanTx29BitFrame :=( dwCanId := 16#100, //was 16#201 xRtrFrame := FALSE ); xSend : BOOL; sSendInfo : STRING; oCanDiag : WagoAppCanLayer2.FbCanErrorInfo; xRst : BOOL; aSendData : ARRAY [1..8] OF BYTE; bSendLen : BYTE; TON_0 : TON; TON_1 : TON; END_VAR 2) Program body: oOpenInterface( xEnable := NOT xInterfaceIsOpen, I_Port := IoConfig_Globals.WAGO_CAN_LAYER2_DEVICE ); sInterfaceInfo := oOpenInterface.oStatus.GetDescription(); xInterfaceIsOpen S= oOpenInterface.xValid AND NOT oOpenInterface.xError; oReceive( xEnable := xInterfaceIsOpen, I_Port := IoConfig_Globals.WAGO_CAN_LAYER2_DEVICE, xRxTrigger := xRecv ); sReceiveInfo := oReceive.oStatus.GetDescription(); IF NOT xRecv THEN IF oReceive.bRxNBytes > 0 THEN oReceive.aRxBuffer[1]; oReceive.aRxBuffer[2]; oReceive.aRxBuffer[3]; oReceive.aRxBuffer[4]; oReceive.aRxBuffer[5]; oReceive.aRxBuffer[6]; oReceive.aRxBuffer[7]; oReceive.aRxBuffer[8]; END_IF xRecv := TRUE; END_IF aSendData[1] := 224; aSendData[2] := 13; aSendData[3] := 14; aSendData[4] := 15; aSendData[5] := 222; aSendData[6] := 13; aSendData[7] := 14; aSendData[8] := 15; bSendLen := 8; TON_0(IN:= NOT TON_1.Q, PT:= T#2S , Q=>xSend, ET=> ); TON_1(IN:= TON_0.Q, PT:= T#2S , Q=>, ET=> ); oSend( xEnable := xInterfaceIsOpen, I_Port := IoConfig_Globals.WAGO_CAN_LAYER2_DEVICE, aTxBuffer := aSendData, bTxNBytes := bSendLen, xTxTrigger := xSend ); sSendInfo := oSend.oStatus.GetDescription(); oCanDiag( xEnable := TRUE, I_Port := IoConfig_Globals.WAGO_CAN_LAYER2_DEVICE, xTriggerResetCounter := xRst, xValid=> , xError=> , oStatus=> , wBusState=> , wBusDiag=> , uiRxOverflowsL2=> , uiTxOverflowsL2=> , uiRxOverflows=> , uiMsgTimeouts=> , uiBusOffs=> , uiBusWarnings=> ); Program first opens comunication on CAN 2 device and then periodically try send one CAN data frame. After starting program CAN 2 interface is properly open. The xSend variable is toggling with period 2s. When program sends data an "Tx overflow" error appears. When I am watching CAN_H line on DSub 9 socket i am not able to see proper CAN frames - see screenshot attached to this message. Could somebody help me determine what is wrong with this program. Best regards
Last updated: 2024-08-02

Post by smeitink on Timeout Error in Modbus Communication with WAGO PFC200 and iEM2050 Meter using 750-652 Module CODESYS Forge talk (Post)
Hi all, I'm looking for help with an issue I've come across while trying to facilitate Modbus communication between a WAGO PFC200 PLC using a 750-652 communication module and an iEM2050 Series Single Phase Energy Meter. I believe to have everything wired and setup correcty, but I keep running into a "Error time out" message, and by now I don't really know what else to try. My setup is as follows: A PFC200 Wago PLC, which has 2 750-652 Serial Interfaces extension modules connected to its field bus. I'm using one of these to talk to a Schneider iEM2050 - kWh-meter over modbus. I have connected terminal 23 (A) of the iEM2050 to connector 6 (A) on the 750-652. I have connected terminal 24 (B) of the iEM2050 to connector 2 (B) of the 750-652. I'm using 200mm of twisted together wires to connected them both, and I have placed a 120 ohm resistor between A and B at both ends. I've attached relevant pinout images to this post. I then wrote a simple program that configures the Mobus port, as per the datasheet of the iEM2050. You can find an image of the relavent page attached to this post too. This is my program: PROGRAM PLC_PRG VAR Master: FbMbMasterSerial; xIsConnected: BOOL; xError: BOOL; iIndex: INT := 1; xTrigger: BOOL; utQuery : typMbQuery := ( bUnitId := 1, // The Modbus unit or slave address bFunctionCode := 4, // Function code for reading input registers uiReadAddress := 1829, // adress for the Power on off counter uiReadQuantity := 1 // Quantity of registers to read ); iStep: INT; oStatusModbus: WagoSysErrorBase.FbResult; utResponseModbus: typMbResponse; xConnect: BOOL := FALSE; delayTimer: TON; END_VAR Master( xConnect:= xConnect, I_Port:= _750_652_24_1, udiBaudrate:= 9600, usiDataBits:= 8, eParity:= WagoTypesCom.eTTYParity.Even, eStopBits:= WagoTypesCom.eTTYStopBits.One, eHandshake:= WagoTypesCom.eTTYHandshake.None, ePhysical:= WagoTypesCom.eTTYPhysicalLayer.RS485_HalfDuplex, xIsConnected=> xIsConnected, xError=> xError, oStatus=> oStatusModbus, eFrameType:= WagoAppPlcModbus.eMbFrameType.RTU, tTimeOut:= T#5S, utQuery:= utQuery, xTrigger:= xTrigger, utResponse:= utResponseModbus); delayTimer(IN := TRUE, PT := T#3S); // Use the Q output of the timer to set xConnect after the delay IF delayTimer.Q THEN xConnect := TRUE; END_IF CASE iStep OF 0: //Wacht totdat de master de poort geopend heeft IF xIsConnected THEN iStep := 1; END_IF 1: //Stuur request naar de slave xTrigger := TRUE; iStep := 2; 2: //Wacht totdat de master klaar is met het afhandelen van de request IF NOT xTrigger THEN iStep := 3; END_IF END_CASE The TON delay before opening the port is due to a an error I encountered when opening it straight away. This seems to be a bug, as described here. However, the TON solved that particular issue. I tried reading multiple registers, but like I said, I still always end up with the "Error time out". What else can I test or try at this point?
Last updated: 2024-02-24

Post by francesco86 on Script python for write in a file Project information CODESYS Forge talk (Post)
Dear all, My python script can read a Codesys project and save in file the different POU, but the problem is that I don't able to read the project info from the obj list. Following of this message there is my python script. Can you help my? Best regards Francesco # encoding:utf-8 # We enable the new python 3 print syntax from __future__ import print_function import os import shutil import time import sys from datetime import datetime print("--- Saving files in the project: ---") print("sys.argv: ", len(sys.argv), " elements:") for arg in sys.argv: print(" - ", arg) if (len(sys.argv)>1): folderExportName = sys.argv[1] print(" folderExportName: ", folderExportName) exportPath = sys.argv[2]+ sys.argv[3]+ "\\"+ sys.argv[1] print(" File path: ", exportPath) # git has_repo=False #save_folder=r'E:\Tmp\ControlPlugins\ControlPlugins\Export' save_folder = exportPath if not os.path.exists(save_folder): os.makedirs(save_folder) else: a=os.listdir(save_folder) for f in a: if not f.startswith("."): sub_path= os.path.join(save_folder,f) if os.path.isdir(sub_path): shutil.rmtree(sub_path) else: os.remove(sub_path) elif f==".git": has_repo=True info={} type_dist={ '792f2eb6-721e-4e64-ba20-bc98351056db':'pm', #property method '2db5746d-d284-4425-9f7f-2663a34b0ebc':'dut', #dut 'adb5cb65-8e1d-4a00-b70a-375ea27582f3':'lib', #lib manager 'f89f7675-27f1-46b3-8abb-b7da8e774ffd':'m', #method no ret '8ac092e5-3128-4e26-9e7e-11016c6684f2':'act', #action '6f9dac99-8de1-4efc-8465-68ac443b7d08':'pou', #pou '6654496c-404d-479a-aad2-8551054e5f1e':'itf', #interface '738bea1e-99bb-4f04-90bb-a7a567e74e3a':'', #folder 'ffbfa93a-b94d-45fc-a329-229860183b1d':'gvl', #global var '5a3b8626-d3e9-4f37-98b5-66420063d91e':'prop', #property '2bef0454-1bd3-412a-ac2c-af0f31dbc40f':'tl', #textlist '63784cbb-9ba0-45e6-9d69-babf3f040511':'gtl', #global textlist '225bfe47-7336-4dbc-9419-4105a7c831fa':'dev', #device 'ae1de277-a207-4a28-9efb-456c06bd52f3':'tc', #task configuration 'f8a58466-d7f6-439f-bbb8-d4600e41d099':'m', #method with ret '261bd6e6-249c-4232-bb6f-84c2fbeef430':'gvl', #gvl_Persistent '98a2708a-9b18-4f31-82ed-a1465b24fa2d':'task', #task '085afe48-c5d8-4ea5-ab0d-b35701fa6009':'progInfo'#project information }; def save(text,path,name,tp): if not tp: tp='' else: tp='.'+tp+'.txt' with open(os.path.join(path,name+tp),'w') as f: f.write(text.encode('utf-8')) def print_tree(treeobj, depth, path): global info #record current Path curpath=path isfolder=False t='' #text tp='' #type # get object name name = treeobj.get_name(False) id = treeobj.type.ToString() if id in type_dist: tp = type_dist[treeobj.type.ToString()] #Print all type of objects #print("--Name: ", tp) else: info[id]=name if treeobj.is_device: deviceid = treeobj.get_device_identification() t = 'type='+str(deviceid.type) +'\nid=' +str(deviceid.id) + '\nver='+ str(deviceid.version) if tp == "progInfo": print("-- There is prog info, ", tp) print("-- It has textual declaration: , ", treeobj.has_textual_declaration) print("-- It has textual implementation: , ", treeobj.has_textual_implementation) print("-- It is folder: , ", treeobj.is_folder) print("-- It is children: , ", treeobj.get_children(False)) print("-- It is children len: , ", len(treeobj.get_children(False))) print("-- It is progInfo type: , ", type(treeobj.ScriptProject)) #for child in treeobj.get_children(False): # print_tree(child, depth+1,curpath) try: if treeobj.is_folder : #system.ui.prompt('folder:'+u, PromptChoice.YesNo, PromptResult.Yes) isfolder=true pass except: pass if treeobj.has_textual_declaration : t=t+'(*#-#-#-#-#-#-#-#-#-#---Declaration---#-#-#-#-#-#-#-#-#-#-#-#-#*)\r\n' a=treeobj.textual_declaration t=t+a.text if treeobj.has_textual_implementation: t=t+'(*#-#-#-#-#-#-#-#-#-#---Implementation---#-#-#-#-#-#-#-#-#-#-#-#-#*)\r\n' a=treeobj.textual_implementation t=t+a.text if treeobj.has_textual_declaration and not treeobj.has_textual_implementation: t=t+'(*#-#-#-#-#-#-#-#-#-#---NOT Implementation visible---#-#-#-#-#-#-#-#-#-#-#-#-#*)\r\n' if treeobj.is_task : exports=[treeobj] projects.primary.export_native(exports,os.path.join(curpath,name+'.task')) if treeobj.is_libman: exports=[treeobj] projects.primary.export_native(exports,os.path.join(curpath,name+'.lib')) if treeobj.is_textlist: treeobj.export(os.path.join(curpath,name+'.tl')) children = treeobj.get_children(False) if children or isfolder: if tp: curpath=os.path.join(curpath,name+'.'+tp) else: curpath=os.path.join(curpath,name) if not os.path.exists(curpath): os.makedirs(curpath) if t: save(t,curpath,name,tp) for child in treeobj.get_children(False): print_tree(child, depth+1,curpath) for obj in projects.primary.get_children(): print_tree(obj,0,save_folder) with open(os.path.join(save_folder,'ExportInfo.txt'),'w') as f: now = datetime.now() infTimeExecution = now.strftime("%Y-%m-%d %H:%M:%S") f.write("Export date and time: "+infTimeExecution + "\r\n" + str(info)) print("--- Script finished. ---") #system.ui.info('save ok') projects.primary.close()
Last updated: 2024-04-30

Post by francesco86 on Script python for write in a file Project information CODESYS Forge talk (Post)
Dear all, My python script can read a Codesys project and save in file the different POU, but the problem is that I don't able to read the project info from the obj list. Following of this message there is my python script. Can you help my? Best regards Francesco # encoding:utf-8 # We enable the new python 3 print syntax from __future__ import print_function import os import shutil import time import sys from datetime import datetime print("--- Saving files in the project: ---") print("sys.argv: ", len(sys.argv), " elements:") for arg in sys.argv: print(" - ", arg) if (len(sys.argv)>1): folderExportName = sys.argv[1] print(" folderExportName: ", folderExportName) exportPath = sys.argv[2]+ sys.argv[3]+ "\\"+ sys.argv[1] print(" File path: ", exportPath) # git has_repo=False #save_folder=r'E:\Tmp\ControlPlugins\ControlPlugins\Export' save_folder = exportPath if not os.path.exists(save_folder): os.makedirs(save_folder) else: a=os.listdir(save_folder) for f in a: if not f.startswith("."): sub_path= os.path.join(save_folder,f) if os.path.isdir(sub_path): shutil.rmtree(sub_path) else: os.remove(sub_path) elif f==".git": has_repo=True info={} type_dist={ '792f2eb6-721e-4e64-ba20-bc98351056db':'pm', #property method '2db5746d-d284-4425-9f7f-2663a34b0ebc':'dut', #dut 'adb5cb65-8e1d-4a00-b70a-375ea27582f3':'lib', #lib manager 'f89f7675-27f1-46b3-8abb-b7da8e774ffd':'m', #method no ret '8ac092e5-3128-4e26-9e7e-11016c6684f2':'act', #action '6f9dac99-8de1-4efc-8465-68ac443b7d08':'pou', #pou '6654496c-404d-479a-aad2-8551054e5f1e':'itf', #interface '738bea1e-99bb-4f04-90bb-a7a567e74e3a':'', #folder 'ffbfa93a-b94d-45fc-a329-229860183b1d':'gvl', #global var '5a3b8626-d3e9-4f37-98b5-66420063d91e':'prop', #property '2bef0454-1bd3-412a-ac2c-af0f31dbc40f':'tl', #textlist '63784cbb-9ba0-45e6-9d69-babf3f040511':'gtl', #global textlist '225bfe47-7336-4dbc-9419-4105a7c831fa':'dev', #device 'ae1de277-a207-4a28-9efb-456c06bd52f3':'tc', #task configuration 'f8a58466-d7f6-439f-bbb8-d4600e41d099':'m', #method with ret '261bd6e6-249c-4232-bb6f-84c2fbeef430':'gvl', #gvl_Persistent '98a2708a-9b18-4f31-82ed-a1465b24fa2d':'task', #task '085afe48-c5d8-4ea5-ab0d-b35701fa6009':'progInfo'#project information }; def save(text,path,name,tp): if not tp: tp='' else: tp='.'+tp+'.txt' with open(os.path.join(path,name+tp),'w') as f: f.write(text.encode('utf-8')) def print_tree(treeobj, depth, path): global info #record current Path curpath=path isfolder=False t='' #text tp='' #type # get object name name = treeobj.get_name(False) id = treeobj.type.ToString() if id in type_dist: tp = type_dist[treeobj.type.ToString()] #Print all type of objects #print("--Name: ", tp) else: info[id]=name if treeobj.is_device: deviceid = treeobj.get_device_identification() t = 'type='+str(deviceid.type) +'\nid=' +str(deviceid.id) + '\nver='+ str(deviceid.version) if tp == "progInfo": print("-- There is prog info, ", tp) print("-- It has textual declaration: , ", treeobj.has_textual_declaration) print("-- It has textual implementation: , ", treeobj.has_textual_implementation) print("-- It is folder: , ", treeobj.is_folder) print("-- It is children: , ", treeobj.get_children(False)) print("-- It is children len: , ", len(treeobj.get_children(False))) print("-- It is progInfo type: , ", type(treeobj.ScriptProject)) #for child in treeobj.get_children(False): # print_tree(child, depth+1,curpath) try: if treeobj.is_folder : #system.ui.prompt('folder:'+u, PromptChoice.YesNo, PromptResult.Yes) isfolder=true pass except: pass if treeobj.has_textual_declaration : t=t+'(*#-#-#-#-#-#-#-#-#-#---Declaration---#-#-#-#-#-#-#-#-#-#-#-#-#*)\r\n' a=treeobj.textual_declaration t=t+a.text if treeobj.has_textual_implementation: t=t+'(*#-#-#-#-#-#-#-#-#-#---Implementation---#-#-#-#-#-#-#-#-#-#-#-#-#*)\r\n' a=treeobj.textual_implementation t=t+a.text if treeobj.has_textual_declaration and not treeobj.has_textual_implementation: t=t+'(*#-#-#-#-#-#-#-#-#-#---NOT Implementation visible---#-#-#-#-#-#-#-#-#-#-#-#-#*)\r\n' if treeobj.is_task : exports=[treeobj] projects.primary.export_native(exports,os.path.join(curpath,name+'.task')) if treeobj.is_libman: exports=[treeobj] projects.primary.export_native(exports,os.path.join(curpath,name+'.lib')) if treeobj.is_textlist: treeobj.export(os.path.join(curpath,name+'.tl')) children = treeobj.get_children(False) if children or isfolder: if tp: curpath=os.path.join(curpath,name+'.'+tp) else: curpath=os.path.join(curpath,name) if not os.path.exists(curpath): os.makedirs(curpath) if t: save(t,curpath,name,tp) for child in treeobj.get_children(False): print_tree(child, depth+1,curpath) for obj in projects.primary.get_children(): print_tree(obj,0,save_folder) with open(os.path.join(save_folder,'ExportInfo.txt'),'w') as f: now = datetime.now() infTimeExecution = now.strftime("%Y-%m-%d %H:%M:%S") f.write("Export date and time: "+infTimeExecution + "\r\n" + str(info)) print("--- Script finished. ---") #system.ui.info('save ok') projects.primary.close()
Last updated: 2024-04-30

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

Post by elizaduke92 on Temu Ilk Alışveriş Indirim Kodu [acu639380] %40 Indirim Kazanın CODESYS Forge talk (Post)
E-ticaret dünyasında alışveriş yaparken tasarruf etmek herkesin istediği bir şeydir. Bu nedenle, Temu coupon code 40% off ile ilk alışverişinizde büyük indirim fırsatlarını kaçırmamalısınız. Bu özel acu639380 Temu indirim kodu, Türkiye'deki kullanıcılar için maksimum avantajlar sunuyor. Alışveriş yaparken bu kodu kullanarak tasarruf etmenin mutluluğunu yaşayacaksınız. Ayrıca, Temu coupon code 2024 for existing customers ve Temu 40% discount coupon ile mevcut müşterilere de birçok avantaj sağlanmaktadır. Hem yeni hem de mevcut kullanıcılar için harika fırsatlar sunuluyor. Temu Coupon Code 40% Off Nedir? Temu uygulaması ve web sitesinde, hem yeni hem de mevcut müşteriler için harika fırsatlar sunan Temu coupon 40% off kodunu kullanabilirsiniz. Bu kodu kullanarak 40% discount Temu coupon ile tasarruf etmenin keyfini çıkaracaksınız. acu639380: Yeni kullanıcılar için %40 düz indirim. acu639380: Mevcut kullanıcılar için %40 indirim. acu639380: Birden fazla kullanım için 100$ kupon paketi. acu639380: Yeni müşteriler için 100$ düz indirim. acu639380: Mevcut müşteriler için ekstra 100$ indirim kodu. Temu Coupon Code 40% Off Yeni Kullanıcılar İçin Yeni kullanıcılar, Temu uygulamasında indirim kodunu kullanarak en yüksek faydayı elde edebilirler. Temu coupon 40% off ve Temu coupon code 40 off for existing users ile alışveriş deneyiminizi zenginleştirebilirsiniz. acu639380: Yeni kullanıcılar için %40 düz indirim. acu639380: Yeni müşterilere özel 100$ kupon paketi. acu639380: Birden fazla kullanım için 100$ kupon paketi. acu639380: Türkiye'ye ücretsiz kargo imkanı. acu639380: İlk kez alışveriş yapanlar için ekstra %30 indirim. Temu 40% Off İndirim Kodunu Nasıl Kullanırım? Temu 40% off kodunu kullanmak oldukça basittir. İşte adım adım nasıl yapacağınız: Temu uygulamasını veya web sitesini açın. Alışveriş yapacağınız ürünleri sepetinize ekleyin. Sepete gidin ve “İndirim Kodu” bölümüne acu639380 yazın. İndiriminizi görün ve siparişinizi tamamlayın. Temu Coupon Code 40% Off Mevcut Kullanıcılar İçin Mevcut kullanıcılar da Temu uygulamasında indirim kodunu kullanarak avantaj elde edebilirler. Temu 40 off coupon code ve Temu coupon code for existing customers ile alışverişinizi daha keyifli hale getirin. acu639380: Mevcut Temu kullanıcıları için %40 ekstra indirim. acu639380: Birden fazla satın alma için 100$ kupon paketi. acu639380: Türkiye genelinde hızlı kargo ile ücretsiz hediye. acu639380: Mevcut indirimlerin üzerine ekstra %30 indirim. acu639380: Türkiye’ye ücretsiz kargo imkanı. Temu 40% Off İndirim Kodunu Mevcut Kullanıcılar Nasıl Kullanır? Temu coupon code 40 off kullanmak için aşağıdaki adımları izleyin: Temu uygulamasını veya web sitesini açın. Ürünlerinizi sepetinize ekleyin. Sepet sayfasında “İndirim Kodu” bölümüne acu639380 yazın. İndiriminizi görün ve siparişinizi tamamlayın. Temu Coupon Code 40% Off Nasıl Bulunur? Temu coupon code 40% off first order ve latest Temu coupons 40 off bulmak oldukça kolaydır. Temu bültenine abone olarak doğrulanmış kuponları alabilirsiniz. Ayrıca, Temu’nun sosyal medya hesaplarını takip ederek en güncel kampanya ve promosyonları öğrenebilirsiniz. Güvenilir kupon sitelerini ziyaret ederek en yeni ve geçerli Temu kupon kodlarını bulabilirsiniz. Temu 40% Off Kuponları Nasıl Çalışır? Temu coupon code 40% off first time user ile alışveriş yaparken, kullanıcılar %40 indirim kazanabilir. İndirim kodunu kullandığınızda, sepetinizdeki toplam tutar üzerinden indirim uygulanır. Bu kodlar, kullanıcıların alışveriş deneyimlerini daha uygun hale getirmek için tasarlanmıştır. Kupon kodu uygulandığında, kullanıcılar büyük tasarruflar yapabilirler. Yeni Müşteriler İçin Temu 40% Off Kuponlarını Nasıl Kazanabilirsiniz? Temu coupon code 40% off ile yeni müşteriler, alışverişlerinde büyük indirimler kazanabilirler. Yeni kullanıcılar, kayıt sırasında veya ilk alışverişlerinde bu kodu kullanarak tasarruf edebilirler. Kayıt işlemi sırasında, genellikle indirim kodu ile birlikte çeşitli promosyonlar sunulmaktadır. Bu sayede, alışverişlerinizde önemli avantajlar elde edebilirsiniz. Temu 40% Off Kuponlarının Avantajları Nelerdir? Temu 40% off coupon code legit ve coupon code for Temu 40 off kullanmanın birçok avantajı vardır: İlk alışverişte %40 indirim. Birden fazla kullanım için 100$ kupon paketi. Popüler ürünlerde %70'e varan indirim. Mevcut Temu kullanıcıları için ekstra %30 indirim. Seçili ürünlerde %90'a varan indirim. Yeni kullanıcılara ücretsiz hediye. Türkiye’ye ücretsiz kargo imkanı. Temu Ücretsiz Hediye ve Özel İndirimler Temu 40% off coupon code ve 40% off Temu coupon code kullanarak birçok avantaj elde edebilirsiniz. Bu fırsatlarla alışveriş deneyiminizi zenginleştirin. acu639380: İlk alışverişte %40 indirim. acu639380: Mevcut müşterilere %40 indirim. acu639380: Herhangi bir ürün üzerinde ekstra %30 indirim. acu639380: Yeni Temu kullanıcılarına ücretsiz hediye. acu639380: Temu uygulamasında herhangi bir üründe %70'e varan indirim. acu639380: Türkiye'ye ücretsiz kargo ile hediye. Temu İndirim Kodu 40% Off Kullanmanın Artıları ve Eksileri Temu coupon 40% off code ve Temu free coupon code 40 off kullanmanın bazı artıları ve eksileri vardır: Artılar: %40 indirim fırsatı. Ücretsiz kargo imkanı. Birden fazla kullanım avantajı. Hediye kampanyaları. Popüler ürünlerde büyük indirimler. Eksiler: Belirli ürünlerde geçerli olmayabilir. İndirim kodunun kullanılmadığı bazı kampanyalar. Belirli bir süreyle sınırlı olabilir. Temu 40% Off İndirim Kodunun 2024 Şartları ve Koşulları Temu coupon code 40% off free shipping ve Temu coupon code 40% off reddit hakkında bilgi sahibi olun. İşte bu kuponların şartları: İndirim kodlarının son kullanma tarihi yoktur, istedikleri zaman kullanılabilir. Kupon kodları hem yeni hem de mevcut kullanıcılar için geçerlidir. Kullanıcıların indirim kodunu kullanabilmesi için herhangi bir minimum alışveriş tutarı gerekmemektedir. Son Not Temu coupon code 40% off ile harika fırsatları kaçırmayın. Bu indirim kodu, alışverişlerinizde tasarruf yapmanızı sağlıyor. Ayrıca, Temu 40% off coupon kullanarak büyük avantajlar elde edebilir, alışveriş deneyiminizi zenginleştirebilirsiniz. Temu 40% Off İndirim Kodu ile İlgili Sıkça Sorulan Sorular Temu 40% indirim kodunu nasıl kullanabilirim? Temu uygulamasında alışveriş yaparken sepetinizde indirim kodunu girerek kullanabilirsiniz. Bu indirim kodu ne zaman geçerli? İndirim kodu sürekli olarak geçerlidir, yani istediğiniz zaman kullanabilirsiniz. İndirim kodu yalnızca yeni kullanıcılar için mi? Hayır, hem yeni hem de mevcut kullanıcılar için geçerlidir. Temu indirim kodu hangi ürünlerde geçerli? Genellikle tüm ürünlerde geçerli, ancak bazı sınırlamalar olabilir. İndirim kodunun bir son kullanma tarihi var mı? Hayır, bu kodların herhangi bir son kullanma tarihi yoktur.
Last updated: 2024-10-26

<< < 1 .. 6 7 8 (Page 8 of 8)

Showing results of 187

Sort by relevance or date