Search talk: REAL to FLOAT

 
<< < 1 .. 223 224 225 226 227 .. 231 > >> (Page 225 of 231)

Post by fless on FB having single input but initialized with Array CODESYS Forge talk (Post)
Why will it retain the sum value from the last call? This is how PLC work. Usually variables only get initialized after a download or a reset (i.e. power loss). RETAIN variables are saved in a special kind of RAM and keep their value after a power loss. To initialize variables on every call of your FB use the VAR TEMP block. VAR_TEMP sum : INT; END_VAR
Last updated: 2024-05-07

Post by tomas111 on OPC UA Client API CODESYS Forge talk (Post)
I ran into a problem. Uploaded an example (https://content.helpme-codesys.com/en/CODESYS%20Examples/_ex_uacapi_example.html) After launch. on the emulator. I see that I am having problems: - UaExpert does not connect. There are many servers but no connection. - I can’t transfer the certificate from quarantine to trusted ones. There is some problem with creating the certificate. CS 19.2. If anyone has had similar problems, please give me advice. Thank you.
Last updated: 2024-05-20

Post by yofi on Raspberry Pi 4 POU not running CODESYS Forge talk (Post)
I have this error where the pou doesn't run even for simple programs like contact and a coil if i remove the pou from the task and put another one it works for one run then it stops working again in the photo we can see a contact is on but the coil connected to it is still not on and the device is in run mode I had this issue again and again any help
Last updated: 2024-06-02

Post by yofi on Raspberry Pi 4 POU not running CODESYS Forge talk (Post)
I have this error where the pou doesn't run even for simple programs like contact and a coil if i remove the pou from the task and put another one it works for one run then it stops working again in the photo we can see a contact is on but the coil connected to it is still not on and the device is in run mode I had this issue again and again any help
Last updated: 2024-06-02

Post by arcadium on TargetVisu element stacking on top of each other CODESYS Forge talk (Post)
Hello, I'm new here so if I do something wrong please bare with me. I am using raspberry pi touchscreen made by comfile (CPi-C070WR4C). I also have a window 11 pc where I would like to have a second visualisation, but when I run a TargetVisu with it, all elements of the visualisation end up in the top left corner stacked on top of each other. I have same results running targetVisu on my laptop. Maybe someone had same issues and know the solution? Simas
Last updated: 2024-06-17

Post by s1mon on Two OneWireMaster on one Raspberry PI 5 CODESYS Forge talk (Post)
All Sensors from the OneWire Master are assigned already to a seperate task with low prio (26) that runs with 1s cycle time. My EtherCat Task is running with Prio 1. It all works fine, until I adjust the CODESYScontrol.cfg or the CODESYScontrol_Usr.cfg files so that it supports a 2nd OneWire Master in the Codeys Runtime. If I change something in this config file and reboot my EtherCat Master stops working.
Last updated: 2025-10-19

Post by mizi on SM_Drive_Virtual CODESYS Forge talk (Post)
Hi I recently started learning Codesys SoftMotion. At first, I mainly used YouTube videos. I stopped at two videos where the same problem keeps recurring. fbReadPos( Axis := X_Axis, Enable := TRUE, Position => gAxes.lrActualPos); <- axis cannot move I checked the entire code line by line. Zero errors. GPT spits out nonsense, throwing up increasingly worse errors. And when I copy its code, it says the code is wrong and gets stuck in a loop of its own stupidity. Can anyone explain why it doesn't work? Link to the video below: https://www.youtube.com/watch?v=CYa2HvYZgbM&list=PLsEhEcYjG7na0OveU7cqFXBx7ATyGGn0A&index=3
Last updated: 2025-10-21

Post by shaunvdm on OSCAT Scale_r function not working in LD 4.60 works in LAD2 on 3.5.21sp3 CODESYS Forge talk (Post)
Hi We have picked up an issue OSCAT_BASIC.Scale_r function call not working in the old lad and FBD version 4.60. Gives no output on the function call. When we convert this to LAD2 it works. As can be see by the two screenshot in normal LD not working in LAD2 it works. Please confirm if this is an issue with Oscat or with LAD in 3.5.21sp3, is there an workaround. Regards Shaun
Last updated: 2025-10-23

Post by shaunvdm on OSCAT Scale_r function not working in LD 4.60 works in LAD2 on 3.5.21sp3 CODESYS Forge talk (Post)
Hi We have picked up an issue OSCAT_BASIC.Scale_r function call not working in the old lad and FBD version 4.60. Gives no output on the function call. When we convert this to LAD2 it works. As can be see by the two screenshot in normal LD not working in LAD2 it works. Please confirm if this is an issue with Oscat or with LAD in 3.5.21sp3, is there an workaround. Regards Shaun
Last updated: 2025-10-23

Post by nxbp on About Compatibility CODESYS Forge talk (Post)
Let's say I have a CODESYS controller (PLC) with a runtime version around 3.5.19. If I use development software version 3.5.21.40 or a later version that will be released in the future for programming, could there be any problems or malfunctions in the controller's program execution or in the execution of the new, updated function blocks from the newer software? I mostly work with servo-based motion applications, so please keep that in mind when answering, and provide a detailed answer so I don't have to email you again about this topic.
Last updated: 2025-12-11

Post by timvh on History of Alarms CODESYS Forge talk (Post)
It is most likely related to the existing alarm log files in the Control Win. Depending on how you start up the Control Win, you can find the files in: C:\Users\<user name="">\AppData\Roaming\CODESYS\CODESYSControlWinV3x64\<unique id="">\PlcLogic\alarms\ Or C:\Windows\System32\config\systemprofile\AppData\Roaming\CODESYS\CODESYSControlWinV3x64\<unique id="">\PlcLogic\alarms\</unique></unique></user> Delete the files in this folder, download your project again and start the application. PS, if you have an older version of CODESYS, the files are in: C:\ProgramData\CODESYS\CODESYSControlWinV3x64\<unique id="">\PlcLogic\alarms</unique>
Last updated: 2026-01-07

Post by peder on Parker Compax3 controlled by Schneider LMC 201 CODESYS Forge talk (Post)
I have replaced a Parker PAC320 with a Schneider LMC 201 The system has some Parker Compax3 servodrive communicating over EtherCAT. PAC320 is programmed with Codesys 3.5.15. The program is opened in Machine Expert 3.2. But I can not get the commumication running to the Compax3. When I scan for hardware the it seems like the Compax3 is registated, but not the motors. Anyone that have succeded this replacement?
Last updated: 2026-01-13

Post by bertus on Can't get SMC_SmoothPath to work CODESYS Forge talk (Post)
Hello all, I am trying to run a XY trajectory from a static G-Code file. Everything works except the smoothing/blending of the corners. My setup: Codesys v3.5sp18 Raspberry Pi 4 CODESYS Control for Raspberry Pi SL, using demo license. Zero axes (only using the interpolator). The order of processing for my decoding is: SMC_NCDecoder (ok) SMC_SmoothMerge (ok) SMC_SmoothPath (not ok) SMC_LimitDynamics SMC_CheckVelocities I created following instances and buffers: fbNCDecoder: SMC_NCDecoder; fbSmoothMerge: SMC_SmoothMerge; fbSmoothPath: SMC_SmoothPath; fbLimitDynamics: SMC_LimitDynamics; fbCheckVelocities: SMC_CheckVelocities; aNCDecoderBuffer: ARRAY[0..49] OF SMC_GeoInfo; // buffer stage 1 (fbNCDecoder) aSmoothMergeBuffer: ARRAY[0..19] OF SMC_GeoInfo; // buffer stage 2 (fbSmoothMerge) aSmoothPathBuffer: ARRAY[0..99] OF SMC_GeoInfo; // buffer stage 3 (fbSmoothPath) aLimitDynamicsBuffer: ARRAY[0..39] OF SMC_GeoInfo; // buffer stage 4 (fbLimitDynamics) My original G-Code file has a lot of short G1 elements but this example, I reduced it to a simple square: N000 G51 D10 N010 G38 O1 N020 G00 X0 Y0 F50 E1000 E-1000 N030 G01 X0 Y-37.5 N040 G01 X-75 Y-37.5 N050 G01 X-75 Y37.5 N060 G01 X0 Y37.5 N070 G01 X0 Y0 N080 G50 N090 G39 O1 In the Codesys CNC settings, I have these instances activated: SMC_SmoothMerge SMC_SmoothPath SMC_LimitDynamics SMC_CheckVelocities And with those settings (and the path-preprocessing button actived), the G-Code viewer shows the square with nicely blended corners (see attached picture). However, when running it on the PLC, it doesn't blend the corners at all. Below the relevant part of my code. The process is started with bDecode. // stage 1: decoding G-code fbNCDecoder( ncprog := square, bExecute:= bDecode, bAbort:= NOT bDecode, nSizeOutQueue := SIZEOF(aNCDecoderBuffer), pbyBufferOutQueue := ADR(aNCDecoderBuffer) ); // stage 2: merge short linear segments fbSmoothMerge( bExecute := bDecode, poqDataIn := fbNCDecoder.poqDataOut, nSizeOutQueue := SIZEOF(aSmoothMergeBuffer), pbyBufferOutQueue := ADR(aSmoothMergeBuffer), piMaxDifference := PI_MAX_DIFFERENCE, usiMaxDegree := 5, wFeatureFlag := 1, wAdditionalParamNumber := 0, dMinimumCurvatureRadius := D_MIN_CURVATURE_RADIUS ); // stage 3: smooth corners fbSmoothPath( bExecute := bDecode, bAbort := NOT bDecode, poqDataIn := fbSmoothMerge.poqDataOut, eMode := SMC_SMOOTHPATHMODE.SP_SPLINE5_MIN_CURVATURE, eAddAxMode := SMC_SMOOTHPATHADDAXMODE.SPAA_NONE, nSizeOutQueue := SIZEOF(aSmoothPathBuffer), pbyBufferOutQueue := ADR(aSmoothPathBuffer), dAngleTol := D_ANGLE_TOL, bSymmetricalDistances := TRUE, bImprovedSymmetricCuts := TRUE ); // stage 4: keep acc/dec and velocity within limits fbLimitDynamics( bExecute := bDecode, bAbort := NOT bDecode, poqDataIn := fbSmoothPath.poqDataOut, wAxis := 16#07, nSizeOutQueue := SIZEOF(aLimitDynamicsBuffer), pbyBufferOutQueue := ADR(aLimitDynamicsBuffer), bIncludePathSettings := TRUE, dMaxVel := 2500, dMaxAccDec := 10000 ); // stage 5: check the path speed fbCheckVelocities( bExecute := bDecode, bAbort := NOT bDecode, poqDataIn := fbLimitDynamics.poqDataOut, dAngleTol := D_ANGLE_TOL); pathQueue := fbCheckVelocities.poqDataOut; // repeat until MaxDuration ... Any idea what I'm doing wrong? Is smooth path supposed to work at all when using a demo license? Thanks.
Last updated: 2025-12-17

Post by gseidel on Scara3 kinematic robot error CODESYS Forge talk (Post)
Hi aniket-b, the maximum cycle time of the EtherCAT_Task is very high, ca. 35 ms. Could you please check if this is just the first cycle after starting the application or if it happens during motion? (You can reset the times in the task configuration by right-clicking in the "monitoring" tab.) Another thing to try: put the SoftMotion_Planning task on a different core. Best regards, Georg
Last updated: 2026-01-07

Post by suyash on Device User Logon CODESYS Forge talk (Post)
Thanks for your reply @eschwellinger. Update : the is problem is resolved. It was done by renaming the User database file (/var/opt/codesys/.UserDatabase.csv) as deleting it was risky. After restart the IDE asked me to create new user. On doing that the problem got resolved. Reference for members facing similar problem/s : sudo systemctl stop codesyscontrol sudo mv /var/opt/codesys/.UserDatabase.csv_ /var/opt/codesys/.UserDatabase.csv_.old sudo systemctl start codesyscontrol
Last updated: 2026-05-14

Post by ph0010421 on ModbusTCP_FunctionCode06 CODESYS Forge talk (Post)
Hi You can add a channel to the standard Modbus TCP library with FC06. From the device tree, add Ethernet device, ModbusTCP master then finally a ModbusTCP slave (your power meter). You can add read/write channels (for any FC) in here. As you add these devices, the necessary libraries will be inserted for you. Alternatively, I have a ModbusTCP client/server library if your RT doesn't have Modbus (I think they all do these days?)
Last updated: 2026-05-18

Post by charly29160 on WebVisu scaling regression in V3.5.22 P2: frame size jumps when switching visualizations CODESYS Forge talk (Post)
Environment: - CODESYS V3.5.22 Patch 2 - CODESYS Control for Raspberry Pi MC SL - WebVisu in browser Problem: When switching between visualizations using a Register element (Registerkarten), the displayed frame size jumps incorrectly after returning to a previously viewed visualization. This behavior was introduced in V3.5.22 Patch 2. The same project worked correctly in V3.5.21 Patch 4. WebVisu settings in V3.5.21 (working): - Scaling: Isotropisch - Automatisch ermittelte Clientgröße verwenden: active - All visualizations: Automatisch erkannte Visualisierungsgröße Workaround?
Last updated: 2026-06-15

Post by baltzer on ICertificateVerifier.VerifyCertificate doesn't appear to override an ERR_CERT_HAS_EXPIRED rejection in TCP_Client.Upgrade() CODESYS Forge talk (Post)
Setup: Net Base Services (NBS), TCP_Client + TLSContext, ePurpose := CLIENT_SIDE, connecting to a third-party embedded device (Velux KLF200 home automation gateway) whose factory-installed TLS certificate expired on 2026-07-12 and has no user-facing renewal path. Tested on both CODESYS Control for Raspberry Pi SL (3.5.19.0) and CODESYS Control Win V3 x64, with identical results on both. Goal: Accept the peer's expired certificate via a custom ICertificateVerifier implementation, since the certificate itself can never be replaced. Implementation: FUNCTION_BLOCK FB_MyCertVerifier IMPLEMENTS NBS.ICertificateVerifier VAR udiCallCount : UDINT; aeCurStateLog : ARRAY[0..9] OF NBS.RTS_IEC_RESULT; END_VAR METHOD VerifyCertificate : UDINT VAR_INPUT hCert : NBS.RTS_IEC_HANDLE; eCurState : NBS.RTS_IEC_RESULT; END_VAR IF udiCallCount < 10 THEN aeCurStateLog[udiCallCount] := eCurState; END_IF udiCallCount := udiCallCount + 1; VerifyCertificate := 0; // also tried: VerifyCertificate := eCurState; Wired in via tlsContext.itfCertVerifer := certVerifier at declaration time, alongside itfTLSContext := tlsContext set at TCP_Client's own declaration (per an earlier forum thread here on ensuring inline start-values on FB-typed variables are actually honored when nested one level deep - that fix was needed and worked correctly for getting the handshake to start at all). Observed: - VerifyCertificate is confirmed called exactly once per connection attempt (via the call counter above). - eCurState passed in = 0x709 = ERR_CERT_HAS_EXPIRED - correctly reflecting the actual state of the peer's certificate. - Packet capture confirms the full TLS 1.2 handshake completes correctly at the wire level: ClientHello -> ServerHello -> Certificate -> ServerKeyExchange -> ServerHelloDone -> our ClientKeyExchange/ChangeCipherSpec/Finished -> server's ChangeCipherSpec/Finished. Both sides successfully complete the cryptographic handshake. - Despite this, TCP_Client.Upgrade() subsequently returns NBS.ERROR.CONNECTION_ERROR, and the connection is torn down with a plain TCP FIN (not a TLS alert) roughly 7-8ms after our side ACKs the server's Finished message. - TCP_Client.eErrorID (inherited from LCon) remains NO_ERROR throughout - the failure is only visible via Upgrade()'s return value. - Returning 0 (ERR_OK/ERR_CERT_OK - confirmed via the CmpErrors2 Interfaces documentation that these are literally the same value) makes no difference. - Echoing eCurState back unchanged (on the theory that this callback might work like mbedTLS's native verify callback, where the incoming state is a flags value to be cleared/modified and returned, rather than paired with a separate fixed "accept" sentinel) also makes no difference. - Identical result across udiVerificationMode := 0, 1, and 2. - Importing the peer's certificate into the runtime's trusted certificate store via cert-import trusted makes no difference either. - With itfCertVerifer left at its default (no custom verifier) and udiVerificationMode := 2, the underlying engine sends its own fatal TLS alert (handshake_failure) immediately after receiving the peer's Certificate message - suggesting built-in validation may reject at the record layer independent of whether a custom verifier is even present. Questions: 1. Is there an additional step required for a custom ICertificateVerifier to actually override an ERR_CERT_HAS_EXPIRED (or more generally, any ERR_CERT_*) rejection, or is certificate validation enforced unconditionally for a CLIENT_SIDE TLSContext regardless of what the verifier returns? 2. Is 0/ERR_OK genuinely the correct "accept" return value for VerifyCertificate, or does it expect something else (a specific bit pattern, a different constant, a value that must be computed from hCert itself)? 3. Is there a supported way to connect to a peer presenting a certificate that is both self-signed and expired, short of the peer issuing a new certificate? Happy to share the full packet captures or additional test combinations if useful. Also worth noting for anyone finding this thread later: a maintained Node-RED library for this same device (node-red-contrib-velux-klf200, forked to handle this exact expired-certificate situation) solves it by disabling built-in TLS validation entirely (rejectUnauthorized: false) and doing fingerprint-based pinning by hand after the handshake completes, rather than relying on a validation callback - which may be the more realistic approach here too if ICertificateVerifier genuinely can't override this class of rejection. Thanks in advance /Jørgen Disclosure: most of the CODESYS code and this investigation was developed with the help of Claude (Anthropic's AI assistant) - the state machine design, SLIP/checksum implementation, and debugging methodology (including the packet capture analysis) were worked through in an extended back-and-forth with it. Posting here because we've run out of self-serviceable options and this now looks like it needs input from someone with visibility into NBS's actual implementation.
Last updated: 2026-07-26

Post by clesio on CAA.File.Write – Unexpected characters when writing a CSV file CODESYS Forge talk (Post)
Hello everyone, I am trying to create a routine in CODESYS to export a report to a CSV file using the CAA.File library. The file is created successfully, but I am getting some unexpected/unknown characters in the generated CSV. The problem seems to be related to the SIZEOF() function. I am using it for the szSize parameter of File.Write, as recommended in the CODESYS documentation. However, when I use SIZEOF(), the CSV contains extra characters and parts of previous strings. I also tried using LEN(), but in my application the file is created empty, even though the string and the calculated length appear to be correct. Here is the relevant part of my code: PROGRAM Relatorio VAR // Bool b_Executa_fb_Cria_Arquivo : BOOL; b_Executa_fb_Fecha_Arquivo : BOOL; b_Escreve_dados : BOOL; b_Erro_fb_Escreve : BOOL; //STR s_Nome_Arquivo : STRING; s_Palavra : STRING; s_Palavra_Anterior : STRING; s_Data_Atualizada_Formatada : STRING; s_Dia : STRING; s_Mes : STRING; s_Ano : STRING; s_Hora_Atualizada_Formatada : STRING; s_Hora : STRING; s_Minu : STRING; s_Segu : STRING; //INT i_modo_fb_Cria_Arquivo : INT; i_ErroID_fb_Escreve : INT; //UINT i_Tamanho_Palavra : UINT; // Blocos de Funcao fb_Cria_Arquivo : FILE.Open; fb_Fecha_Arquivo : FILE.Close; fb_Escreve : FILE.Write; // DATA E HORA sc_DataTime : SysTimeRtc.RTS_SYSTIMEDATE; // STRUCT = sc uidResultRtcGet : UDINT; //stGetDate : SysTimeRtc.RTS_SYSTIMEDATE; uidResultConvertToDate : UDINT; uidResult : RTS_IEC_RESULT; END_VAR VAR_INPUT //BOOL b_SET_Executa_fb_Cria_Arquivo : BOOL; b_RES_Executa_fb_Cria_Arquivo : BOOL; b_Executa_fb_Escrita : BOOL; // INT i_Linhas_Cabecalho : INT; i_Linhas_Cabecalho_Anterior : INT; END_VAR // Para Testes s_Nome_Arquivo := 'relatorio/Teste1M.CSV'; i_modo_fb_Cria_Arquivo := 0; // TRATAMENTO DE DATOS DATA e HORA uidResultRtcGet := SysTimeRtcGet(uidResult); uidResultConvertToDate := SysTimeRtcConvertUtcToDate(dwTimestampUtc := uidResultRtcGet, pDate := sc_DataTime); // FORMATA DATA EM UMA STRING s_Dia := UINT_TO_STRING(sc_DataTime.wDay); s_Mes := UINT_TO_STRING(sc_DataTime.wMonth); s_Ano := UINT_TO_STRING(sc_DataTime.wYear); s_Data_Atualizada_Formatada := CONCAT(s_Dia, CONCAT('/', CONCAT(s_Mes, CONCAT('/', s_Ano)))); // FORMATA HORA EM UMA STRING s_Hora := UINT_TO_STRING(sc_DataTime.wHour); s_Minu := UINT_TO_STRING(sc_DataTime.wMinute); s_Segu := UINT_TO_STRING(sc_DataTime.wSecond); s_Hora_Atualizada_Formatada := CONCAT(s_Hora, CONCAT(':', CONCAT(s_Minu, CONCAT(':', s_Segu)))); // ABRE e CRIA ARQUIVO IF (b_SET_Executa_fb_Cria_Arquivo OR b_Executa_fb_Cria_Arquivo) AND NOT(b_RES_Executa_fb_Cria_Arquivo) THEN b_Executa_fb_Cria_Arquivo := TRUE; ELSE b_Executa_fb_Cria_Arquivo := FALSE; END_IF fb_Cria_Arquivo( xExecute := b_Executa_fb_Cria_Arquivo, sFileName := s_Nome_Arquivo, eFileMode := i_modo_fb_Cria_Arquivo, xExclusive := FALSE, ); //i_Tamanho_Palavra := SizeOf(s_Palavra); // ESCREVE NO ARQUIVO fb_Escreve( xExecute := b_Executa_fb_Escrita, hFile := fb_Cria_arquivo.hFile, szSize := SIZEOF(s_Palavra), pBuffer := ADR(s_palavra) ); // FECHA ARQUIVO fb_Fecha_Arquivo( xExecute := b_Executa_fb_Fecha_Arquivo, hFile := fb_Cria_arquivo.hFile ); IF Criacao_Edicao_Arquivos.b_Escreve_Cabecalho THEN CASE i_Linhas_Cabecalho OF 1 : s_palavra := 'ESTERILIZADOR'; 2: s_palavra := 'MAQ4; $R$L'; 3: s_palavra := CONCAT(CONCAT('CLIENTE: ',GVL.sReceitaAtual), '$R$L'); 4: s_palavra := CONCAT(CONCAT('NUMERO LOTE: ',DINT_TO_STRING(GVL.Lote)), '$R$L'); 5: s_palavra := CONCAT(CONCAT('OPERADOR: ', DINT_TO_STRING(GVL.Operador)), '$R$L'); 6: s_palavra := CONCAT(CONCAT('DATA: ', s_Data_Atualizada_Formatada), '$R$L'); 7: s_palavra := CONCAT(CONCAT('HORA: ', s_Hora_Atualizada_Formatada), '$R$L'); 8: s_palavra := '$R$L'; 9: s_palavra := 'PARAMETROS AJUSTADOS $R$L'; 10: s_palavra := CONCAT('TEMPO PRE COND.: ', CONCAT(INT_TO_STRING(GVL.rc_T_PreCondicionamento), ' min $R$L')); 11: s_palavra := CONCAT('PULSOS INERTIZACAO 1: ', CONCAT(INT_TO_STRING(GVL.rc_PulsosInertizacao_1), ' PULSOS $R$L')); 12: s_palavra := CONCAT('PULSOS INERTIZACAO 2: ', CONCAT(INT_TO_STRING(GVL.rc_PulsosInertizacao_2), ' PULSOS $R$L')); 13: s_palavra := CONCAT('PULSOS AERACAO: ', CONCAT(INT_TO_STRING(GVL.rc_PulsosAeracao_2), ' PULSOS $R$L')); 14: s_palavra := CONCAT('PRESSAO DE VACUO 1: ', CONCAT(REAL_TO_STRING(GVL.rc_PV1_max), ' bar $R$L')); 15: s_palavra := CONCAT('PRESSAO DE VACUO 2: ', CONCAT(REAL_TO_STRING(GVL.rc_PV2), ' bar $R$L')); 16: s_palavra := CONCAT('PRESSAO INERTIZACAO 1: ', CONCAT(REAL_TO_STRING(GVL.rc_PN1), ' bar $R$L')); 17: s_palavra := CONCAT('PRESSAO INERTIZACAO 2: ', CONCAT(REAL_TO_STRING(GVL.rc_PN2), ' bar $R$L')); 18: s_palavra := CONCAT('PRESSAO AERACAO: ', CONCAT(REAL_TO_STRING(GVL.rc_PAR), ' bar $R$L')); 19: s_palavra := CONCAT('PRESSAO ETO: ', CONCAT(REAL_TO_STRING(GVL.rc_PressaoETO), ' bar $R$L')); 20: s_palavra := CONCAT('PRESSAO Compl.: ', CONCAT(REAL_TO_STRING(GVL.rc_PressaoETO_2), ' bar $R$L')); 21: s_palavra := CONCAT('MASSA ETO: ', CONCAT(REAL_TO_STRING(GVL.rc_QuantidadeETO), ' Kg $R$L')); 22: s_palavra := CONCAT('TEMPO PRE COND. Vacuo/Vapor: ', CONCAT(INT_TO_STRING(GVL.rc_T_Vapor_1), ' min $R$L')); 23: s_palavra := CONCAT('SET-POINT: ', CONCAT(REAL_TO_STRING(GVL.ihm_SPTemperatura), ' °C $R$L')); 24: s_palavra := CONCAT('TEMPO ESTERILIZACAO: ', CONCAT(INT_TO_STRING(GVL.rc_TempoEsterilizacao), ' min $R$L')); 25: s_palavra := CONCAT('TEMPO PARADA: ', CONCAT(INT_TO_STRING(GVL.rc_T_PressaoParada), ' min $R$L')); 26: s_palavra := CONCAT('UMIDADE: ', CONCAT(REAL_TO_STRING(GVL.rc_UmidadeRelativa), ' % $R$L')); 27: s_palavra := '$R$L'; END_CASE END_IF Note: The code I am attaching does not include the execution/sequence management of the function blocks. I have omitted this part to keep the example focused on the CSV writing routine. The function blocks are triggered and managed by a separate state machine. I am not sure what the correct approach is in this case, especially since the official documentation recommends using SIZEOF() for szSize. I will attach my code and a screenshot of the generated CSV showing the issue. Has anyone experienced something similar or could suggest the correct way to write a changing STRING to a CSV file using CAA.File.Write?
Last updated: 2026-09-08

Post by clesio on CAA.File.Write – Unexpected characters when writing a CSV file CODESYS Forge talk (Post)
Hello everyone, I am trying to create a routine in CODESYS to export a report to a CSV file using the CAA.File library. The file is created successfully, but I am getting some unexpected/unknown characters in the generated CSV. The problem seems to be related to the SIZEOF() function. I am using it for the szSize parameter of File.Write, as recommended in the CODESYS documentation. However, when I use SIZEOF(), the CSV contains extra characters and parts of previous strings. I also tried using LEN(), but in my application the file is created empty, even though the string and the calculated length appear to be correct. Here is the relevant part of my code: PROGRAM Relatorio VAR // Bool b_Executa_fb_Cria_Arquivo : BOOL; b_Executa_fb_Fecha_Arquivo : BOOL; b_Escreve_dados : BOOL; b_Erro_fb_Escreve : BOOL; //STR s_Nome_Arquivo : STRING; s_Palavra : STRING; s_Palavra_Anterior : STRING; s_Data_Atualizada_Formatada : STRING; s_Dia : STRING; s_Mes : STRING; s_Ano : STRING; s_Hora_Atualizada_Formatada : STRING; s_Hora : STRING; s_Minu : STRING; s_Segu : STRING; //INT i_modo_fb_Cria_Arquivo : INT; i_ErroID_fb_Escreve : INT; //UINT i_Tamanho_Palavra : UINT; // Blocos de Funcao fb_Cria_Arquivo : FILE.Open; fb_Fecha_Arquivo : FILE.Close; fb_Escreve : FILE.Write; // DATA E HORA sc_DataTime : SysTimeRtc.RTS_SYSTIMEDATE; // STRUCT = sc uidResultRtcGet : UDINT; //stGetDate : SysTimeRtc.RTS_SYSTIMEDATE; uidResultConvertToDate : UDINT; uidResult : RTS_IEC_RESULT; END_VAR VAR_INPUT //BOOL b_SET_Executa_fb_Cria_Arquivo : BOOL; b_RES_Executa_fb_Cria_Arquivo : BOOL; b_Executa_fb_Escrita : BOOL; // INT i_Linhas_Cabecalho : INT; i_Linhas_Cabecalho_Anterior : INT; END_VAR // Para Testes s_Nome_Arquivo := 'relatorio/Teste1M.CSV'; i_modo_fb_Cria_Arquivo := 0; // TRATAMENTO DE DATOS DATA e HORA uidResultRtcGet := SysTimeRtcGet(uidResult); uidResultConvertToDate := SysTimeRtcConvertUtcToDate(dwTimestampUtc := uidResultRtcGet, pDate := sc_DataTime); // FORMATA DATA EM UMA STRING s_Dia := UINT_TO_STRING(sc_DataTime.wDay); s_Mes := UINT_TO_STRING(sc_DataTime.wMonth); s_Ano := UINT_TO_STRING(sc_DataTime.wYear); s_Data_Atualizada_Formatada := CONCAT(s_Dia, CONCAT('/', CONCAT(s_Mes, CONCAT('/', s_Ano)))); // FORMATA HORA EM UMA STRING s_Hora := UINT_TO_STRING(sc_DataTime.wHour); s_Minu := UINT_TO_STRING(sc_DataTime.wMinute); s_Segu := UINT_TO_STRING(sc_DataTime.wSecond); s_Hora_Atualizada_Formatada := CONCAT(s_Hora, CONCAT(':', CONCAT(s_Minu, CONCAT(':', s_Segu)))); // ABRE e CRIA ARQUIVO IF (b_SET_Executa_fb_Cria_Arquivo OR b_Executa_fb_Cria_Arquivo) AND NOT(b_RES_Executa_fb_Cria_Arquivo) THEN b_Executa_fb_Cria_Arquivo := TRUE; ELSE b_Executa_fb_Cria_Arquivo := FALSE; END_IF fb_Cria_Arquivo( xExecute := b_Executa_fb_Cria_Arquivo, sFileName := s_Nome_Arquivo, eFileMode := i_modo_fb_Cria_Arquivo, xExclusive := FALSE, ); //i_Tamanho_Palavra := SizeOf(s_Palavra); // ESCREVE NO ARQUIVO fb_Escreve( xExecute := b_Executa_fb_Escrita, hFile := fb_Cria_arquivo.hFile, szSize := SIZEOF(s_Palavra), pBuffer := ADR(s_palavra) ); // FECHA ARQUIVO fb_Fecha_Arquivo( xExecute := b_Executa_fb_Fecha_Arquivo, hFile := fb_Cria_arquivo.hFile ); IF Criacao_Edicao_Arquivos.b_Escreve_Cabecalho THEN CASE i_Linhas_Cabecalho OF 1 : s_palavra := 'ESTERILIZADOR'; 2: s_palavra := 'MAQ4; $R$L'; 3: s_palavra := CONCAT(CONCAT('CLIENTE: ',GVL.sReceitaAtual), '$R$L'); 4: s_palavra := CONCAT(CONCAT('NUMERO LOTE: ',DINT_TO_STRING(GVL.Lote)), '$R$L'); 5: s_palavra := CONCAT(CONCAT('OPERADOR: ', DINT_TO_STRING(GVL.Operador)), '$R$L'); 6: s_palavra := CONCAT(CONCAT('DATA: ', s_Data_Atualizada_Formatada), '$R$L'); 7: s_palavra := CONCAT(CONCAT('HORA: ', s_Hora_Atualizada_Formatada), '$R$L'); 8: s_palavra := '$R$L'; 9: s_palavra := 'PARAMETROS AJUSTADOS $R$L'; 10: s_palavra := CONCAT('TEMPO PRE COND.: ', CONCAT(INT_TO_STRING(GVL.rc_T_PreCondicionamento), ' min $R$L')); 11: s_palavra := CONCAT('PULSOS INERTIZACAO 1: ', CONCAT(INT_TO_STRING(GVL.rc_PulsosInertizacao_1), ' PULSOS $R$L')); 12: s_palavra := CONCAT('PULSOS INERTIZACAO 2: ', CONCAT(INT_TO_STRING(GVL.rc_PulsosInertizacao_2), ' PULSOS $R$L')); 13: s_palavra := CONCAT('PULSOS AERACAO: ', CONCAT(INT_TO_STRING(GVL.rc_PulsosAeracao_2), ' PULSOS $R$L')); 14: s_palavra := CONCAT('PRESSAO DE VACUO 1: ', CONCAT(REAL_TO_STRING(GVL.rc_PV1_max), ' bar $R$L')); 15: s_palavra := CONCAT('PRESSAO DE VACUO 2: ', CONCAT(REAL_TO_STRING(GVL.rc_PV2), ' bar $R$L')); 16: s_palavra := CONCAT('PRESSAO INERTIZACAO 1: ', CONCAT(REAL_TO_STRING(GVL.rc_PN1), ' bar $R$L')); 17: s_palavra := CONCAT('PRESSAO INERTIZACAO 2: ', CONCAT(REAL_TO_STRING(GVL.rc_PN2), ' bar $R$L')); 18: s_palavra := CONCAT('PRESSAO AERACAO: ', CONCAT(REAL_TO_STRING(GVL.rc_PAR), ' bar $R$L')); 19: s_palavra := CONCAT('PRESSAO ETO: ', CONCAT(REAL_TO_STRING(GVL.rc_PressaoETO), ' bar $R$L')); 20: s_palavra := CONCAT('PRESSAO Compl.: ', CONCAT(REAL_TO_STRING(GVL.rc_PressaoETO_2), ' bar $R$L')); 21: s_palavra := CONCAT('MASSA ETO: ', CONCAT(REAL_TO_STRING(GVL.rc_QuantidadeETO), ' Kg $R$L')); 22: s_palavra := CONCAT('TEMPO PRE COND. Vacuo/Vapor: ', CONCAT(INT_TO_STRING(GVL.rc_T_Vapor_1), ' min $R$L')); 23: s_palavra := CONCAT('SET-POINT: ', CONCAT(REAL_TO_STRING(GVL.ihm_SPTemperatura), ' °C $R$L')); 24: s_palavra := CONCAT('TEMPO ESTERILIZACAO: ', CONCAT(INT_TO_STRING(GVL.rc_TempoEsterilizacao), ' min $R$L')); 25: s_palavra := CONCAT('TEMPO PARADA: ', CONCAT(INT_TO_STRING(GVL.rc_T_PressaoParada), ' min $R$L')); 26: s_palavra := CONCAT('UMIDADE: ', CONCAT(REAL_TO_STRING(GVL.rc_UmidadeRelativa), ' % $R$L')); 27: s_palavra := '$R$L'; END_CASE END_IF Note: The code I am attaching does not include the execution/sequence management of the function blocks. I have omitted this part to keep the example focused on the CSV writing routine. The function blocks are triggered and managed by a separate state machine. I am not sure what the correct approach is in this case, especially since the official documentation recommends using SIZEOF() for szSize. I will attach my code and a screenshot of the generated CSV showing the issue. Has anyone experienced something similar or could suggest the correct way to write a changing STRING to a CSV file using CAA.File.Write?
Last updated: 2026-09-08

Post by winki on Error in licence activation CODESYS Forge talk (Post)
Hello, Despite receiving an activation message after entering the license number, I don’t have any license installed on my gateway. I went to check in /var/opt/codesys/ and there is no License file. I searched the entire gateway for a .lic file and found no license. I’m really stuck—how can I fix this, please? When I am using the licence tools I got this picture: But nothing that have been activated. Loic,
Last updated: 2026-02-03

Post by winki on Error in licence activation CODESYS Forge talk (Post)
Hello, Despite receiving an activation message after entering the license number, I don’t have any license installed on my gateway. I went to check in /var/opt/codesys/ and there is no License file. I searched the entire gateway for a .lic file and found no license. I’m really stuck—how can I fix this, please? When I am using the licence tools I got this picture: But nothing that have been activated. Loic,
Last updated: 2026-02-03

Post by william on Unit testing support / libraries for EcoStruxure Machine Expert (CODESYS) CODESYS Forge talk (Post)
Hi, We are investigating available libraries and frameworks for automated PLC unit testing in Schneider EcoStruxure Machine Expert. Specifically, we are looking for: Assertion libraries or test frameworks compatible with Machine Expert CODESYS‑based solutions that are not TwinCAT‑specific Any official or community‑recommended approach for unit testing FB/FC logic offline We have found several open‑source examples, but many appear to be TwinCAT‑dependent and therefore not compatible. Are there any known libraries, best practices, or recommended approaches for implementing unit tests in Machine Expert? Thanks in advance.
Last updated: 2026-02-19

Post by alexgooi on No Bootproject possible CODESYS Forge talk (Post)
Dear Forum, When using a online-change I often get the following message: No Bootproject possible in this state: application out of memory. Perform full download first. I'm using Codesys virtual control for linux SL running on a docker server with plenty of memory available, therefore I’m not expecting a hardware limitation. Is there a setting available to for example reserve more memory, so the controller is not that quick out of memory? thank you in advance. Alex
Last updated: 2026-03-27

Post by darwin03 on Mismatch between coordinate monitor and actual motion using SMC_GroupJog2, MC_MoveLinearAbsolute (6DOF) CODESYS Forge talk (Post)
Hi Guys!!! I am experiencing an issue when trying to move 6DOF using SMC_GroupJog2 and MC_MoveLinearAbsolute, but I don't understand why, when I jog only X or Y, the coordinate I monitor just changes the X or Y value. It's true, but in reality, Joint6 is still running like the video. Am I wrong somewhere? Many thanks for considering my request.! Video: https://drive.google.com/drive/folders/1vRHQ3AtTO3mijptqZgn5OcP9pyi527Jm?usp=sharing
Last updated: 2026-04-06

<< < 1 .. 223 224 225 226 227 .. 231 > >> (Page 225 of 231)

Showing results of 5767

Sort by relevance or date