Search talk: CAA types extern

 
<< < 1 .. 4 5 6 (Page 6 of 6)

Post by laruso on Runtime device Enable/Disable procedure CODESYS Forge talk (Post)
I implemented the parts from the CAA Device Diagnosis Example.project and could use it for switching on and off, the CAN devices that were located under the CANbus and CANopen_Manager. But i can't do the same with I2C_master_test_version or devices below this one. In the example project there is only the EtherCAT Master, CANbus and CANopen_Manager, and Ethernet with devices below.
Last updated: 2023-10-27

Post by micik on CAA File- FILE_OPERATION_DENIED error CODESYS Forge talk (Post)
Hello, I'm trying to use FILE.Open to open file that exists in the given location. sFileName is formed from "Copy as path" in Windows. So I'm sure file exists and it is in the given location. And still, I get thiss denied error. What could be the problem here? Attached is a screenshot with current implementation.
Last updated: 2024-05-16

Post by hoatran on Use third party actuator with IO-Link Master (IFM) CODESYS Forge talk (Post)
The generic sensor FB is for controlling the sensor via its cyclic input (PDI) and output (PDO). In this case, ifm raw cyclic input and output data are WORDs (16 bits total) The PDO data from the Buerkert unit are SINT (8 bits) In this case, I would use the unpackword fb from the CAA memory library to unpack the valve feed back value into the appropriate location.
Last updated: 2024-04-23

Post by micik on CAA File, how to check whether file exists or not CODESYS Forge talk (Post)
Hello, what would be the most efficient way to check whether the file exists or not. I don't want to use file.Open function, it seems like rather inefficiet operaton. I considered GetAttribute function, but this function doesn't accept filename (with path) as an input. Basically I need to check first time when program is loaded to the runtime i.e. when application is started for the first time, whether a file exists on the specific location or not.
Last updated: 2024-05-16

Post by paulorb on FB Factory example CODESYS Forge talk (Post)
I am trying to use FB Factory (to dynamically create FB), I am looking for documentation the only thing I found is this page: https://content.helpme-codesys.com/en/libs/CAA%20FB%20Factory/3.5.17.0/Factory/fld-Factory.html I am trying to find the examples, I search on the installed folder, I have the impression that it is no longer installed as part of the CODESYS installation. Where can I find it?
Last updated: 2024-08-12

Post by mini-developer on Precompilation Error NBS.UDP_Peer CODESYS Forge talk (Post)
Hello, I use the Library NBS from "caa net base services". After opening the Project i get 19 errors from the message window "Precompilation", most of them because it doesn't recognise a component of the FB "NBS.UD_Peer". (see photo) After compiling the Project at least 2 times, there are no errors. Is there a reason and solution for this behavior? Is there a problem with resolving the library? Thanks for any clue
Last updated: 2024-08-23

Post by alez on CANOpen SDO to write VISIBLE STRING CODESYS Forge talk (Post)
Hello, I am experiencing difficulties in configuring a CANopen device by sending SDOs. In particular I am attempting to write an Object Dictionary that has VISIBLE STRING as the Data Type. When I try to configure the sending of an SDO from Codesys to configure this parameter I am not allowed to enter a string value. In my particular case I am trying to change the Manufacturer Device Name ( Index 0x1008 ). Could it be that Codesys doesn't manage these types of variables?
Last updated: 2024-04-29

Post by engrahman on The current baud rate could not be determined in CR0020 IFM with maintenance tool CODESYS Forge talk (Post)
Hello everyone, im working with IFM CR0020 controller via RS232 protocol where im trying to connect it to my PC but, every time when im using the maintenance tool to identify the device i get the error "The baud rate could not be determined" i have tried to change the cable of RS232 with different types but the error presist, any idea how to fix it
Last updated: 2024-05-21

Post by mase on Python script: Launch Codesys, Execute Script, Exit Codesys CODESYS Forge talk (Post)
Hi, sorry I can´t help you with your issue, but I hope you can give me a hint on getting GUID for other objects than POUs. Your code states "Guid("6f9dac99-8de1-4efc-8465-68ac443b7d08")". We can I find the GUID / ObjectIds`? I wasn´t able to get details about the GUID of DataTypes (STRUCT/ENUM,..)m, Functions (FUN), GLOBALS and TYPES. I want to create markdown of all available project elements. Thanks for your help
Last updated: 2024-08-06

Post by lsislsis on SIGABRT Error CODESYS Forge talk (Post)
Please help us. Why we take this errors. We try different versions like 4.12.0 and 4.13.0 with same results. ;*********;<loggername>codesyscontrol.log</loggername>;<logoptions>; <enable>1</enable>; <type>normal</type>; <timestamp>rtc high resolution</timestamp>; <deactivatable>0</deactivatable>; <dump>always</dump>; <filter>0x0000000f<filter>; <maxentries>100000</maxentries>; <maxfiles>1</maxfiles>; <maxfilesize>1000000</maxfilesize>;</filter></filter></logoptions>;<entries>;Timestamp, CmpId, ClassId, ErrorId, InfoId, InfoText;ClassId: LOG_INFO =1;ClassId: LOG_WARNING =2;ClassId: LOG_ERROR =4;ClassId: LOG_EXCEPTION =8;ClassId: LOG_DEBUG =16;ClassId: LOG_PRINTF =32;ClassId: LOG_COM =64;</entries>;*********2024-11-05T08:23:59.728Z, 0x0000100c, 1, 0, 0, VisuFctCheckForUnusedClients: Removing Client with IEC-ID: 1 Time delta: T#33s1ms Locks: Paintbuffer: TRUE 2024-11-05T08:23:59.728Z, 0x0000100c, 1, 0, 0, VisuFctCheckForUnusedClients: Successfully Removed Client at Address: 547195449944, IEC-ID was: 1, EXT-ID: 431000373 2024-11-05T08:28:57.913Z, 0x0000100c, 1, 0, 0, Visu_PRG: Creating Client for Extern-ID: 347055752 2024-11-05T08:28:57.926Z, 0x0000100c, 1, 0, 0, Visu_PRG: Creating Client successful for Extern-ID: 347055752 Returned IEC-ID: 1 2024-11-05T08:30:51.103Z, 0x0000100c, 1, 0, 0, Visu_PRG: Successfully Removed Client with IEC-ID: 1, Extern-ID: 347055752 2024-11-05T08:37:36.517Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state* We recommend a reboot of the controller now! 2024-11-05T08:37:36.517Z, 0x00000111, 8, 260, 3, #### Exception: HANDLED EXCPT <excpt>NonContinuable</excpt> in CH_COMM_CYCLE 2024-11-05T08:47:42.117Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state We recommend a reboot of the controller now! 2024-11-05T08:47:42.117Z, 0x00000111, 8, 260, 3, #### Exception: HANDLED EXCPT <excpt>NonContinuable</excpt> in CH_COMM_CYCLE 2024-11-05T09:14:41.316Z, 0x00000071, 1, 0, 13, Webserver stopped 2024-11-05T09:14:44.485Z, 0x0000013d, 1, 0, 4, Number of licensed cores for IEC-tasks: 1 from 4 2024-11-05T09:14:44.487Z, 0x0000013d, 1, 0, 4, Number of licensed cores for IEC-tasks: 4 from 4 2024-11-05T09:14:44.540Z, 0x00000002, 1, 0, 2, Application [<app>Application</app>] loaded via [Download] 2024-11-05T09:14:55.894Z, 0x00001012, 1, 0, 0, Opened alarm storage file, version: 6 2024-11-05T09:14:55.951Z, 0x0000100c, 1, 0, 0, Visuinitialization starting. 2024-11-05T09:14:55.983Z, 0x0000100c, 1, 0, 0, Visuinitialization done. 2024-11-05T09:14:55.995Z, 0x00000071, 1, 0, 12, Webserver started 2024-11-05T09:15:01.753Z, 0x0000100c, 1, 0, 0, Visu_PRG: Creating Client for Extern-ID: 2279884529 2024-11-05T09:15:01.753Z, 0x0000100c, 1, 0, 0, Visu_PRG: Creating Client successful for Extern-ID: 2279884529 Returned IEC-ID: 0 2024-11-05T09:34:44.667Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state We recommend a reboot of the controller now! 2024-11-05T09:34:44.667Z, 0x00000111, 8, 260, 3, #### Exception: More than 2 exceptions in CH_COMM_CYCLE: Stop logging 2024-11-05T10:13:26.867Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state We recommend a reboot of the controller now! 2024-11-05T10:15:21.966Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state We recommend a reboot of the controller now! 2024-11-05T10:19:12.167Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state We recommend a reboot of the controller now! 2024-11-05T10:26:02.566Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state We recommend a reboot of the controller now! 2024-11-05T10:31:42.866Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state We recommend a reboot of the controller now! 2024-11-05T11:01:54.468Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state We recommend a reboot of the controller now! 2024-11-05T11:09:29.868Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state We recommend a reboot of the controller now! 2024-11-05T11:14:44.540Z, 0x0000100d, 1, 0, 0, Demo mode expired. 2024-11-05T11:27:20.868Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state We recommend a reboot of the controller now! * Regards
Last updated: 2024-11-05

Post by mp9876 on Problem using MeasureFrequence FB CODESYS Forge talk (Post)
Hi everyone, new at Codesys and PLC programming in general. I am using Codesys Win V3.5 SP20 I would like to measure an encoder's frequency output (obtaining that pulse train from Factory IO) and intended to use the MeasureFrequence FB (Intern/CAA/Utilities/CAA Mathematics/3.5.19.0). As mentioned in the title what I need to measure is low frequency, such as lower than 40hz (a cycle every 25mS) or so; I could even go lower frequency if required as this is for test purposes) therefore I am not expecting problem measuring a low frequency with that FB The library in question appears to be installed as I can retrieve it from the Library Repository. I can also see it from the Device's Library Manager. Problem arises when I am trying to instantiate this particular FB. I go like this: VAR MeasF:MeasureFrequence; END_VAR Please note that as soon as I start typing the "MeasureFrequence", the MeasureFrequence comes out as a viable option in auto-typing; seems to indicate that the FB is recognized somehow. But there is no way I can compile this as it comes back with the following: C0046: Identifier 'MeasureFrequence' not defined. Tried to rename that to ABC instead of MeasF; same issue. Possibly that the library is not properly installed ? Placeholder ? I would greatly appreciate a bit of guidance if possible. Thank you and regards, Mike
Last updated: 2024-06-24

Post by nikgind on Codesys Communication Manger - Required information model version exists in the model repository but is not found CODESYS Forge talk (Post)
Hi I am trying to import a custom information model that I created using UA Modeler. I have only added two new methods and two new object types. It is possible to add the information model to the Communication Manager and the two new object types are shown in the Information Model tab. After compiling i get the following error: Communication Manager [Device: PLC Logic: Application]: The information model http://opcfoundation.org/UA/ is required by http://yourorganisation.org/Bsp_3.1/ with a minimal publication date from 15.12.2023 but the device has only a model from 15.09.2021 installed. Probably the information model from 15.09.2021 is missing in the information model repository. The error message does not make sense to me. Should it not be “Probably the information model from 15/12/2023 is missing in the information model repository”? Anyway I have installed the information model from 15/12/2023 but not from 15/09/2021. Which makes the error message even stranger.
Last updated: 2024-06-09

Post by mainak on Opaque NodeId in the OPC UA server CODESYS Forge talk (Post)
Hello all, I am using the OPC UA server with my custom information model. I have used the communication manager to add my information model under my application and created instances from OPC UA types. I see that the created instances in the OPC UA server has some opaque nodeid (attached screenshot) and I want to change that. Therefore I have the following questions: 1. Is there a way to configure the NodeIds of instances in the OPC UA server? I tried to edit it using the UaExpert client but got error "BadNotWriteable". is it possible to configure it somewhere so that the nodeids can be changed using an external client? 2. Is there a way to define the rule for creating instance nodeids within the codesys IDE? 3. Is it possible to create the instances before e.g. using a modelling tool like UaModeler and import them as part of the information model and use them later? Using the communication manager, I can only create instances from types. I couldn't find a way to map my existing instances to plc tags from my application. It would be nice if someone could help me with these issues. Thanks in advance. :)
Last updated: 2024-10-19

Post by fredsta on Unable to load dynamic modules (Download failed: Application=Application) CODESYS Forge talk (Post)
Hey there, I am currently trying to find a good solution for the communication between CODESYS Control on Raspberry Pi and "the rest of the world", i. e. the things apart from CODESYS on my linux. My first approach was to use the c-integration. So I created a lib, defined extern fbs, compiled the code on my Pi using the SDK and put the .so into my lib project. When I try to log into the Pi and load the program, I get the error message which you can see in the attached picture. "Die dynamischen Module der C-Integration konnten nicht auf das Laufzeitsystem geladen werden" is german and means roughly "the modules from the c-integration could not be loaded onto the runtime system." Is this normal? Am I doing something wrong? I will have a look at the unix domain socket thing next, as I am still in the process of finding the best solution for the communication.
Last updated: 2024-02-15

Post by bjarne-pagaard on Codesys v3.5 Sint to byte CODESYS Forge talk (Post)
Hi A SINT is a short (signed) integer. It is already only 1 byte - so you should have no problem casting it to a byte like so: bMyByte := TO_BYTE(sintMyShortInt); If you have a regular INT you want to put in 2 bytes - there are a lot of ways you can do this. A Union is certainly one of them. You could have a union with 2 memebers: An array of 2 bytes as one member, and an integer value as another member. Another way would be to look at MEMCPY to put the value into your CAN-message. .. or create a function to take your input value as input, and giving you 2 individual bytes as output. This could be handy if you need to change the byte-order. Integer data types: https://help.codesys.com/webapp/_cds_datatype_integer;product=codesys;version=3.5.17.0 -Bjarne
Last updated: 2024-04-24

Post by installwhat on IDialogOpenedListener CODESYS Forge talk (Post)
Why do you develop things like this? The workflow should be highly dependent on autocomplete, then if that's not super obvious browse to definition and everything is made clear possibly with the checking of a few types. The nature of how things are done makes me think these libraries aren't developed for general use and are actually internal or for partners. The example projects include objects that don't appear in autocomplete and then lead nowhere obvious when browsing. Do you consider developer workflow when creating these libraries? Are some libraries really for public use such as Visu Utils and others not? If so which? It's really hard to tell.
Last updated: 2024-08-06

Post by opineiro on How to manage variable types larger than 64 bits - Ethernet/IP CODESYS Forge talk (Post)
Hi there, I have a Keyence bar code reader connected to my plc through Ethernet/IP. The Bar code is 20 digits long (like 30100790020493036016), the scanner reads it correctly (I can verify that through the keyence software) but when it sends it through ETH/IP, it doesn't fit into a 64 bit variable and it trunks the data.(I've tried ULINT and LWord without success). When I loaded the EDS file, the read variable was defined as a byte with 128 bits length, which is quite strange for me. (see attached picture) How do I manage this variable? Thanks!
Last updated: 2024-09-23

Post by rabaggett on Reading Named Pipes in Linux Is there a better way? CODESYS Forge talk (Post)
I have a Python program that will handle things in my application such as VISA over IP and Telnet control of instruments. I want the main control and HMI in Codesys. My problem is communication between the two. I have looked at several ways to accomplish this, and settled on having the Python program create two named pipes, one to send information to Codesys, and one for Codesys to send information to Python. The information would be packetized with \n for end of packet.. Seems simple. I think the named pipes method should work, but file reading in Codesys using the CAA file library starts to get difficult when the file is never ending, as in this case. Before I spend too much time making something that may be fundamentally flawed I want to ask. Is there a better way? Is there a way to read the file 'one line at a time' which might solve my never ending file problem? Thanks!
Last updated: 2024-05-09

Post by duvanmoreno24 on Modbus writing on value change CODESYS Forge talk (Post)
Yes, I tried to do what you put in the first code. However, I have a problem with that and that is that the inputs must be declared with the type. I have many data types running in my code (real, int, uint, bool) and I can't put them in the same function, another thing is that I need to instantiate that function for everything I want to write to the slave. You put a for to 200 but it means that it has to be the same data type and inside the array, but I want to get them individually. I'm struggling to do it in a good and efficient way like wago's E-cockpit does. in the first screenshot you can see, you simply type in value, change the package of things you want to write in value change and it does everything by itself automatically, without comparing any old and new values and even less having the need to activate a bool. , it is perfect.
Last updated: 2024-04-03

Post by r-niedermayer on OPC UA subscriber not operational CODESYS Forge talk (Post)
Hi. As far as projects in "old version"s are concerned, these can be upgraded to newer versions at any time. To do this, the device must be updated accordingly and the copilers and library versions must be adapted. You can find instructions on how to proceed in the online help/FAQ: https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_changing_compiler_version.html https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_cmd_update_device.html See also 4.3.22.4 "How to open an Example Project" within the following pdf for more details on the single steps: https://forge.codesys.com/lib/counit/tickets/_discuss/thread/3e991befbc/ca97/attachment/Public%20FAQ-v13-20240610_075228.pdf Regaring your OPCUA connection state always showing just "DISABLED", without knowing both sides of the assembly in detail, one can only approach the problem theoretically. We can give a chekclist on how to proceed: Fist, please recheck the communication settings in the OPC UA connection function block to ensure that the server URL, endpoint URL, and other settings are correct and match the configuration of the OPC UA server. Verify that the OPC UA server is running and accessible. -You can try to connect to the OPC UA server using a separate client, such as UAExpert, to ensure that the issue is not related to the OPC UA server itself. Test the security settings in the OPC UA connection function block to ensure that the correct security policy and certificate are selected. If you are using a dynamic connection to the OPC UA server, probe that the connection settings are correctly configured and that the OPC UA client is able to establish a connection to the OPC UA server. Also, please loock into the log files for any errors related to the OPC UA connection function block, these should be listet there. The log files may also provide additional information about the issue and help you to further troubleshoot the problem. FYI - Please see https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_data_source_communication_opc_ua_server.html: Her you can finde the Communication settings via OPC UA Server -> layout Browse Live Server: The client connects to the server and detects the existing variables and types. From Information Model The client reads the data structure (layout) of the OPC UA Server from the information model set here and as a result receives the information about available variables and types. A connection to the server is not required. The list contains the information models installed in the OPC UA Information Model Repository. "Read Connection" Settings from IEC Variable (option set): - The connection settings used by the device are not read here from the dialog, but at runtime from the IEC variable specified here. - For this possibility, please see the Using a Dynamic Connection to an OPC UA Server (https://content.helpme-codesys.com/en/CODESYS%20Communication/_comm_use_dynamic_opc_ua_server_comm_settings.html) The settings for the communication of a Client-data source to an OPC UA Server can also be dynamically configured from the IEC code and can also be changed at runtime. For such a purpose, a structure is available in the DatasourceOpcUAServer library (For a description of the OPC UA Server, there is one included in the standard installation of CODESYS, https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_encrypt_communication_data_sources_opc_ua_client.html)
Last updated: 2024-11-04

Post by gilbert-mh on CAA net base TCP client cause PLC to crash - Kernel message : N0HZ_local_softirq_pending 80 CODESYS Forge talk (Post)
Hello all, I have been trying to implement a TCP client on a Festo PLC (CPX-E-CEC-M1) and it looks like it works well except that after some time (greatly varies between a few hours to more than 100h) my PLC crash. When I look into the log file the only thing I see is that before the crash happens a few kernel warnings : N0HZ_local_softirq_pending 80 and then the crash. I've looked into this warning and from what I could find on the net it seems that this is warning is triggered when the ethernet link is down. I've tried to correct this bug for quite some time and what I know is that : - The crash is caused by my TCP client, when I remove it from my code I see no crash - The crash happens more quickly the more the TCP client is used. - The time before the crash is not directly proportional to the number of communications or their size. But it looks like it is just more likely to happen if the client connect to the server at a higher frequency. - The precedent observation makes it seem unlikely that the crash is caused by some memory overflow because then the crash speed would be more proportional to the amount of data exchanged. SO from these observations, I believe that the crash could be caused by the PLC trying to connect to a server while there is some kind of issue with the ethernet link resulting in the PLC getting stuck in some indefinite state and making it crash. This still seems a bit unlikely to me because if the ethernet is down it simply shouldn't be able to contact the server and the communication would just fail which doesn't cause my PLC to crash. Has anyone encountered the same kind of problem (with the same kernel message) ? I am pretty sure the warning is not the direct cause of the crash but just an indicator that something is wrong with my PLC. Thanks in advance
Last updated: 2024-01-12

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 .. 4 5 6 (Page 6 of 6)

Showing results of 147

Sort by relevance or date