Post by ara32 on CODESYS 4 Linux:
CODESYS Forge
talk
(Post)
Hello! I managed to correctly launch CODESYS Developer Studio 3.5.17, almost all functionality works. The only issue remaining is that when connecting to a device and obtaining its public key, the NCryptEncrypt function is called, which is not fully implemented in the DLL source code, resulting in the connection not being established. Currently, the code of this function in the Wine repository looks like this: SECURITY_STATUS WINAPI NCryptEncrypt(NCRYPT_KEY_HANDLE key, BYTE *input, DWORD insize, void *padding, BYTE *output, DWORD outsize, DWORD *result, DWORD flags) { struct object *key_object = (struct object *)key; TRACE("(%#Ix, %p, %lu, %p, %p, %lu, %p, %#lx)\n", key, input, insize, padding, output, outsize, result, flags); if (flags & ~(NCRYPT_NO_PADDING_FLAG | NCRYPT_PAD_OAEP_FLAG | NCRYPT_PAD_PKCS1_FLAG | NCRYPT_SILENT_FLAG)) { FIXME("Flags %lx not supported\n", flags); return NTE_BAD_FLAGS; } if (flags & NCRYPT_NO_PADDING_FLAG || flags & NCRYPT_PAD_OAEP_FLAG) { FIXME("No padding and oaep padding not supported\n"); return NTE_NOT_SUPPORTED; } if (key_object->type != KEY) return NTE_INVALID_HANDLE; return map_ntstatus(BCryptEncrypt(key_object->key.bcrypt_key, input, insize, padding, NULL, 0, output, outsize, result, flags)); } The program crashes due to the NCRYPT_PAD_OAEP_FLAG flag. I'm not proficient in C++, but I attempted to add handling myself, and here's the result: SECURITY_STATUS WINAPI NCryptEncrypt(NCRYPT_KEY_HANDLE key, BYTE *input, DWORD insize, void *padding, BYTE *output, DWORD outsize, DWORD *result, DWORD flags) { struct object *key_object = (struct object *)key; TRACE("(%#Ix, %p, %lu, %p, %p, %lu, %p, %#lx)\n", key, input, insize, padding, output, outsize, result, flags); if (flags & ~(NCRYPT_NO_PADDING_FLAG | NCRYPT_PAD_OAEP_FLAG | NCRYPT_PAD_PKCS1_FLAG | NCRYPT_SILENT_FLAG)) { FIXME("Flags %lx not supported\n", flags); return NTE_BAD_FLAGS; } if (flags & NCRYPT_NO_PADDING_FLAG) { FIXME("No padding not supported\n"); return NTE_NOT_SUPPORTED; } BCRYPT_OAEP_PADDING_INFO oaepInfo = { 0 }; oaepInfo.pszAlgId = BCRYPT_SHA1_ALGORITHM; NTSTATUS status = BCryptEncrypt(key_object->key.bcrypt_key, input, insize, &oaepInfo, NULL, 0, output, outsize, result, flags); if (key_object->type != KEY) return NTE_INVALID_HANDLE; return map_ntstatus(BCryptEncrypt(key_object->key.bcrypt_key, input, insize, padding, NULL, 0, output, outsize, result, flags)); } Now, when calling the connection, it crashes with the error "bcrypt:BCryptEncrypt flags 0x4 not implemented." Can anyone help with enhancing this functionality or at least point me in the right direction?
Last updated: 2024-03-22
Post by gseidel on CNC / G01 Speed is very slow (or go-stop motion) in Continuous short segment .
CODESYS Forge
talk
(Post)
Hi k2saki, I would recommend to have a look at SMC_SmoothMerge, followed by SMC_SmoothPath. SmoothMerge will combine the small G1 elements to longer splines, SmoothPath will avoid stops between the splines. https://content.helpme-codesys.com/en/libs/SM3_CNC/Current/SM_CNC_POUs/SoftMotion-CNC/SoftMotion-Function-Blocks/SMC_SmoothMerge.html For SmoothMerge to work, you have to configure a tolerance, i.e. by how much it may deviate from the lines. To graph the output of the interpolator, you can use the trace. (Add a trace object below the application, and add the variables you are interested in to the trace.) Best regards, Georg
Last updated: 2024-04-30
Post by timvh on FB string and naming
CODESYS Forge
talk
(Post)
I see, you want to initialize the FB. To be able to initialise it like you described, you need to add the FB_Init method to your FB. (right click on the FB, select add object --> method). Then press the arrow down, to select the FB_Init (overwrite default implementation). In the VAR_INPUT section of this method, add the variable --> Tag : STRING; Then in the code section of this method add: THIS^.Tag := Tag; // copy initial value to local variable in FB Search Google if you want to know more about FB_Init. PS, reflection + instance path, is also an option if you want to get the full name of the instance (path) of the Function Block. See: https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_pragma_attribute_instance_path.html
Last updated: 2024-09-30
After un upgrade of "CODESYS Control for Raspberry Pi MC SL" from v4.7 to v4.9 SysFileOpen function stopped working
CODESYS Forge
talk
(Thread)
After un upgrade of "CODESYS Control for Raspberry Pi MC SL" from v4.7 to v4.9 SysFileOpen function stopped working
Last updated: 2023-08-22
Post by sedoerr on Check For Open Dialogs On Client
CODESYS Forge
talk
(Post)
You need to create a function around this function to check the dialogs you use in your program. That's the way i have done it.
Last updated: 2023-09-26
Can a table be used as an input to date and time variables on a function block diagram?
CODESYS Forge
talk
(Thread)
Can a table be used as an input to date and time variables on a function block diagram?
Last updated: 2022-09-15
Why do I get C0434: Function block AbstractFunctionBlock is ABSTRACT and cannot be instantiated for a Reference?
CODESYS Forge
talk
(Thread)
Why do I get C0434: Function block AbstractFunctionBlock is ABSTRACT and cannot be instantiated for a Reference?
Last updated: 2022-08-14
Can a table be used as an input to date and time variables on a function block diagram?
CODESYS Forge
talk
(Thread)
Can a table be used as an input to date and time variables on a function block diagram?
Last updated: 2022-09-15
Function block that after 2 rising edge it gives a bool and resets every 3 seconds
CODESYS Forge
talk
(Thread)
Function block that after 2 rising edge it gives a bool and resets every 3 seconds
Last updated: 2023-04-07
Post by smartcoco on Function block method default arguments
CODESYS Forge
talk
(Post)
It's not that you missed something, it's that CODESYS doesn't have this feature. I hope CODESYS can add this feature. We also hope to add function overload functionality.
Last updated: 2023-12-22
Post by atone on System Date and Time Function
CODESYS Forge
talk
(Post)
SysTimeRtcConvertUtcToLocal is marked as obsolete, but there's not hint on the actual implementation. Which function should I use instead? Edit: even the new online help is still using SysTimeRtcConvertUtcToLocal as example...
Last updated: 2024-01-05
Post by smartcoco on Bit / Bool data types in function parameters
CODESYS Forge
talk
(Post)
Memory addressing is measured in bytes, with BOOL occupying one byte. BIT is quite unique as it occupies one bit. So, try not to use BIT in the program. You can use the Unpack function to solve your problem.
Last updated: 2024-01-18
Post by ragarcia on Error while using UpdateConfiguredIPSettings to change IP address
CODESYS Forge
talk
(Post)
I did check I cannot see any error log. It is when executing the Reconfigure function that I get an error as return from that function.
Last updated: 2024-02-19
Post by aniket-b on EtherCAT drive not moving
CODESYS Forge
talk
(Post)
I have EtherCAT drive communicating properly without an error but when I use MC_JOG function, it is not moving at all, I can use MC_Power function and drive does respond to that but other functions are not working,. Please suggest what is wrong here.
Last updated: 2024-03-04
Post by acc00 on Variable Sync Issue In Soft Plc Redundancy
CODESYS Forge
talk
(Post)
Hi arundara, I'm also experimenting with Redundandcy. Is the sync variable function the following: "RedundancySynchronizeData()" ? Does the Task time increase a lot when you activate the sync function?
Last updated: 2024-03-11
Post by mmpl on CAA Library Function
CODESYS Forge
talk
(Post)
I want to change date and time format. I am using CAA storage library function. I am not receiving any value in to output.
Last updated: 2024-04-16
Post by davelewis104 on J1939 SA
CODESYS Forge
talk
(Post)
I am curious if there is a function block or function that will allow me to monitor the J1939 CANBus and pull out all of the SAs that are on a particular bus, without having to have them loaded in the J1939 manager?
Last updated: 2024-04-30
Post by mtho on JSON Utilities - JSON file written with invalid structure
CODESYS Forge
talk
(Post)
I'm using the JSON Utilities SL library to write configurations in my program to a file. I'm generating the JSON data using the builder function block and all appears to work correctly. When I write the jsondata to file, I'm finding that some of the JSON elements are not being written in the right location in the file. Rather than writing they keys under the parent object, they get written outside the root JSON object at the end of the file. If I then try to read the file back into the program, I get an invalid_structure error. I don't get any errors when populating the JSON data or when writing the file. I attached an example of the JSON writer output. The problems begin with key P200. Each P200 should go under MBR1 through MBR3. Among the rest of the keys, they are supposed to be under different parent objects. I am using default values for wsLineBreak and encoding.
Last updated: 2024-03-06
Post by garrian on How to sort JSON object in codesys
CODESYS Forge
talk
(Post)
Hi there, I'm testing out MQTT from my Wago PLC using JSON object. I have managed to publish this {"Temperature":15.6,"Setpoint":38.0} to my broker. Now I', trying to subscribe to the same message. The result is this: '{"Temperature":15.6,"Setpoint":38.0}95}ê$10šå$04$Nå$08²Ÿå$0B` á$08@šå' First, why do I see 95}ê$10šå$04$Nå$08²Ÿå$0B` á$08@šå' at the end of the message? Second, how Can i sort out this data to use it in my program? I followed a youtube tutorial which gave me the attached result, which works. But I need some other smart way of doing this when the object gets even more data in it. Any help is very appreciated :)
Last updated: 2024-05-04
Post by jonasz on Discontinuity of A/B/C axis movement.
CODESYS Forge
talk
(Post)
Hi, My problem was related to the behavior of the modulo axis, but maybe you will find something useful from what I write. The solution lies in path processing. Codesys offers a G-code analysis tool. Insert a CNC object into the project. The CNC settings object will be added automatically. By inserting appropriate processing modules into the CNC settings object and parameterizing them, you can test the behavior of the axis. When the effect is satisfactory, remember to add the module from CNC settings in the correct order in the processing path. Each CNC machine case is different. You need to spend some time to get your design tailored like an Armani suit. Good luck.
Last updated: 2024-05-09
Post by yannick on Raspberry PI 5 not working
CODESYS Forge
talk
(Post)
Hello I'm using Codesys V3.5 SP19 Patch 6 and a Raspberry PI 5 4GB Bookworm 32bit with the Runtime 4.11.0.0 SL. I can install the runtime and download the software completly but after a few seconds the connection disconnects with the message no connection to device. Please scan network again. And the object reference was not set to an object instance. See screenshot. Can somebody help me with that? Thanks
Last updated: 2024-04-28
Post by narius on OPC-UA object instances preexisting in imported xml information model
CODESYS Forge
talk
(Post)
Hi all, is it possible to use object instances that are not instantiated by codesys itself, e.g. have been defined in UA-Modeler ? When I browse the plc with UA-Expert I see those instances, but I have not seen information in codesys or the web if these are writable in codesys. So far, I am under the impression, that it is not possible, but would like to hear from others. Also, is it correct, that it is not possible to create references inside codesys ? Thanks in advance and kr
Last updated: 2024-08-08
Post by simotion on Inheritance of axis
CODESYS Forge
talk
(Post)
I have developped a function block 'Axis' the inherits from 'AXIS_REF_SM3' -> FUNCTION_BLOCK Axis EXTENDS AXIS_REF_SM3 In my global variable list I define a variable MasterDrive of type Axis and assign Axis1. Axis1 is a virtual drive (AXIS_REF_VIRTUAL_SM3). This type should inherit from AXIS_REF_VIRTUAL. VAR_GLOBAL MasterDrive : Axis := Axis1; However I get the error 'Cannot convert type'. What is the way to obtain what I want : function block inheriting AXIS_REF_SM3 and initialising this function block with a Softmotion virtual or real axis?
Last updated: 2023-12-07
Post by apurv on Cannot pass array of constant size to a function as a reference
CODESYS Forge
talk
(Post)
I have a Array of constant size defined like this Var Constant MAX_SIZE :UINT := 10; End_var VAR array : ARRAY[0..MAX_SIZE] OF INT; END_VAR Now I want to pass this array to a function by reference, Function fun : INT VAR_IN_OUT CONSTANT MAX_SIZE : UINT; END_VAR VAR_INPUT array : REFERENCE TO ARRAY[0..MAX_SIZE] OF INT; END_VAR but when I run this it gives strange Errors Error : Cannot Convert type 'ARRAY [0..MAX_SIZE] OF INT' to type 'ARRAY[0..MAX_SIZE] OF INT'
Last updated: 2024-01-07
Post by sturmghost on Visualization using methods and cyclic ST-calls
CODESYS Forge
talk
(Post)
I found a way to do it: You can use, for example, the text variable property of any visualization element and call a function in it. Example: Write a test POU as a function (FUN), like MyTestFun which need a boolean Variable as an input value. Now write into the text variable property: MyTestFun(bBooleanValue) Thats it. The function is called at each visu_task cycle.
Last updated: 2024-01-22
To search for an exact phrase, put it in quotes. Example: "getting started docs"
To exclude a word or phrase, put a dash in front of it. Example: docs -help
To search on specific fields, use these field names instead of a general text search. You can group with AND
or OR
.