Post by timvh on Clarifications regarding the appropriate runtime system to use
CODESYS Forge
talk
(Post)
If you are not using any specific Raspberry Pi functionality, then probably the "universal" Control Linux ARM SL is the approriate runtime to run on the Pi. For the license it doesn't matter which runtime version you choose, because this is not hardware based anymore, but application based. Best is to use the latest version of CODESYS. To determine which license you need, double click on your device, go to the tab License metrics.... Generate the code for your application and see which license you need based on the metrics of your application.
Last updated: 2024-09-24
Post by timvh on Visuutils FbOpenDialog(Extended) not open Dialog from POUs
CODESYS Forge
talk
(Post)
I had a similar situation recently where this didn't work, but read to the end to see the solution. The reason is that CODESYS only downloads visualisations (dialogs) if they are part of the project or linked to the project. In your case the dialog is not loaded onto the controller. But the solution is pretty simple: Double click on the Visualization Manager in your application. Select the Tab "Visualizations". Here you can see that your dialog is not "checked". Do this manually and load your project on the controller. Then your code should be able to open the dialog, because now it exists on the controller.
Last updated: 2024-09-28
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
Post by struccc on HTML5 Controls - string(>80) values
CODESYS Forge
talk
(Post)
Dear all, does anyone have experience with HTML5 controls recently? CODESYS 3.5.20.30 / Visualization 4.6.0.0 I'd like to create a simple lightweight text editor, with proper multiline handling, cut & paste, scrolling, etc. And it seems to work fine, just have problems with strings longer than 80 bytes.... Declaring a variable sText1 : STRING(8000) and referencing it in the HTML5 Controls corresponding value property works perfectly one way: the code receive the data as a string (See log1)... (Note TypeID 1000...) Also sending back the data (seems to work (See log2) except it doesn't change the value of the bound variable. Probably the issue is with using SendSimpleValue method... Naturally, I could do a workaround, but maybe there is a more standard way to implement this... Please let me know if you have any suggestions.
Last updated: 2024-10-23
Post by niallel on CamBuilder and first boundary position not zero
CODESYS Forge
talk
(Post)
Hi, I've read the CamBuilder documentation and it shows to use the left boundary of the first segment as SMCB.BoundImplicit(), so that the transition is as smooth as possible. With this it sets X and Y to 0. My first slave position is not 0 (say for example it's 100), so I would set it with SMCB.Bound(0,100). My question is that when the cam goes back to the start (Periodic := TRUE) , will it blend with the last position (360, 100) if I do this? I imagine it will, but the documentation isn't clear as the information in the Periodic Cams only says to set Smooth Transition in the cam properties - but when I'm defining it with code there isn't an option for Smooth Transition to be set. Hope this makes sense? Many thanks,
Last updated: 2024-10-23
Post by bertcom on Converting each character to a string into ASCII
CODESYS Forge
talk
(Post)
Good afternoon, I have a project where i need to split a string and send it in ascii code to an Domino Printer. Concept: i get an String from an Zebra scanner looking like this : " R002043;5410761402862;Oil Plus 2C Comp.A - Gris Belge;1286193824;" To start is the ";" the seperator. i found some functions to delete the ";" in a string. this is okay but now i want to convert each digit in the string into ascii like this: R=82 0=48 0=48 2=50 0=48 ... This because the printer wants to receive a string like this: <esc>OQ001TE 82 48 48 50 48 ...<eot></eot></esc> Anyone who can help me with setting me on the right track with some advice?
Last updated: 6 days ago
Post by bertcom on Converting each character to a string into ASCII
CODESYS Forge
talk
(Post)
Good afternoon, I have a project where i need to split a string and send it in ascii code to an Domino Printer. Concept: i get an String from an Zebra scanner looking like this : " R002043;5410761402862;Oil Plus 2C Comp.A - Gris Belge;1286193824;" To start is the ";" the seperator. i found some functions to delete the ";" in a string. this is okay but now i want to convert each digit in the string into ascii like this: R=82 0=48 0=48 2=50 0=48 ... This because the printer wants to receive a string like this: <esc>OQ001TE 82 48 48 50 48 ...<eot></eot></esc> Anyone who can help me with setting me on the right track with some advice?
Last updated: 6 days ago
Post by fefefede on Get the numer of day
CODESYS Forge
talk
(Post)
Hello i tro to create a program to turn on or off the air condition in relationship temperature and numer of day. I can't get the number of day. I try this after installing SysTime library but this not work and have this error on debug ------ Build started: Application: Device.Sim.Device.Application ------- Typify code... Generate code... [ERROR] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0032: Cannot convert type 'Unknown type: 'SysTimeCore(TRUE)'' to type 'TIME' [ERROR] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0035: Program name, function or function block instance expected instead of 'SysTimeCore' [ERROR] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0032: Cannot convert type 'Unknown type: 'DayOfWeek(CurrentTime)'' to type 'INT' [ERROR] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0035: Program name, function or function block instance expected instead of 'DayOfWeek' [INFORMATION] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0181: Related position Build complete -- 4 errors, 0 warnings : No download possible PROGRAM PLC_PRG VAR Temperatura: UDINT; AriaCondizionata: BOOL := FALSE; CurrentDayOfWeek: INT; //Variabile Giorno CurrentTime: TIME; GiornoDellaSettimana: INT; DayOfWeek: INT; END_VAR CurrentTime := SysTimeCore(TRUE); // Ottieni l'ora corrente CurrentDayOfWeek := DayOfWeek(CurrentTime); CASE GiornoDellaSettimana OF 1: // Azioni per Lunedì 2: // Martedì se più 10° accend altrimenti spegni IF Temperatura >= 10 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 3: // Mercoledì se più di 50° accendi altrimenti spegni IF Temperatura >=50 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 4: // Giovedì se più di 40° accendi altrimenti spegni IF Temperatura >=40 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 5: // Venerdì se più di 50° accendi altrimenti spegni IF Temperatura >=50 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 6: // Sabato se più di 25° accendi altrimenti spegni IF Temperatura >=25 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 7: // Domenica sempre spenta AriaCondizionata := FALSE; END_CASE
Last updated: 2023-09-14
Post by martinlithlith on Device User Logon and No device is responding.. Pi4b codesys 3.5 SP19 2 + (64-bit)
CODESYS Forge
talk
(Post)
Hi! Im slowly starting to loose it and i need som help! After a few night of reading up and testing i´m still stuck as a rock and you guys and girls are my last resort for this project. Basic facts; Win 11 Codesys 3.5 SP19 2 + (64-bit) Raspberry pi 4 model b 2 gb Raspian release 11 aarch64 What keeps me up late at night; Username and Password when trying to connect to device and device only beeing connectable for a few seconds. Some of the things I have tried; Username and passord; Credientials from the raspberry Administrator Administrator admin admin Admin Admin administrator administrator Usernames and passwords that I sometimes use (this was a longshot i know, but i was running out of ideas and energy). :) Epand filesystem, activating i2c, spi, 1-wire I can start the gateway and start the runtime. I cant install the edgearm64, arm64 runtime package eventhough I guess i should, i get code [ERROR] Error output: dpkg: error processing archive /tmp/codesysedge_edgearm64_4.8.0.0_arm64.deb (--install): [ERROR] Error output: package architecture (arm64) does not match system (armhf) [ERROR] Error output: Errors were encountered while processing: [ERROR] Error output: /tmp/codesysedge_edgearm64_4.8.0.0_arm64.deb code as a respons. I have tried to Reset Origin Device - no change. I have tried to remove the /etc/CODESYSControl_User.cfg [CmpUserMgr] but i could not find it and i was not sure if i should add it instead but i did not want to mess somthing up. I have tried to create a second gateway with the specific ip if the pi, that did not help. Could it be that i´m currently connected to the pi through WIFI? I can ping the pi and I can connect and control it through VNC. When i scan to select gateway target (scan edge gateway) i find 17-21 devices but can find the pi throug the mac adress. I started of trying to use the "CODESYS Control for Raspberry Pi SL" (I have a license sience earlier) as i read somewhere that this could be used on a Pi4 as well but now i´m trying with the MC SL, no changes, same problem. Right now - gateway version 4.8.0.0 (edgearmHF, armhf), Runtime Package 4.5.0.0 (raspberry, armhf). Any sugestions are very welcome! As mentioned above, theese are some of the things that i have tried/done - but i have been going at this for a while. Best, Martin
Last updated: 2023-09-10
Post by spiessli on Raspberry Pi 4 with Legacy Drivers and Codesys 3.5.19 Patch 4
CODESYS Forge
talk
(Post)
Hi, I wanted to use the Adafruit Hat for the Raspberry and get acquainted with Softmotion using servos for RC models. This did work great with Codesys 3.5.19 Patch 1, but with Patch 4 and 5 i get errors. I suspect changes in the SoftMotion library have broken dependencies in the legacy drivers, might that be true? Thanks for any hint, spiessli Here the error log: ------ Übersetzungslauf gestartet: Applikation: Device.Application ------- Code typisieren... Code erzeugen... [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0032: Typ 'Unbekannter Typ: 'ConfigGetParameterValueLREAL(pParam, 0)'' kann nicht in Typ 'LREAL' konvertiert werden [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0046: Bezeichner 'ConfigGetParameterValueLREAL' nicht definiert [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0035: Programmname, Funktion oder Funktionsbausteinstanz an Stelle von 'ConfigGetParameterValueLREAL' erwartet [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0032: Typ 'Unbekannter Typ: 'ConfigGetParameterValueLREAL(pParam, 0)'' kann nicht in Typ 'LREAL' konvertiert werden [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0046: Bezeichner 'ConfigGetParameterValueLREAL' nicht definiert [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0035: Programmname, Funktion oder Funktionsbausteinstanz an Stelle von 'ConfigGetParameterValueLREAL' erwartet [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0032: Typ 'Unbekannter Typ: 'ConfigGetParameterValueLREAL(pParam, 0)'' kann nicht in Typ 'LREAL' konvertiert werden [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0046: Bezeichner 'ConfigGetParameterValueLREAL' nicht definiert [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0035: Programmname, Funktion oder Funktionsbausteinstanz an Stelle von 'ConfigGetParameterValueLREAL' erwartet [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0032: Typ 'Unbekannter Typ: 'ConfigGetParameterValueLREAL(pParam, 0)'' kann nicht in Typ 'LREAL' konvertiert werden [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0046: Bezeichner 'ConfigGetParameterValueLREAL' nicht definiert [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0035: Programmname, Funktion oder Funktionsbausteinstanz an Stelle von 'ConfigGetParameterValueLREAL' erwartet [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0032: Typ 'Unbekannter Typ: 'ConfigGetParameterValueLREAL(pParam, 0)'' kann nicht in Typ 'LREAL' konvertiert werden [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0046: Bezeichner 'ConfigGetParameterValueLREAL' nicht definiert [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0035: Programmname, Funktion oder Funktionsbausteinstanz an Stelle von 'ConfigGetParameterValueLREAL' erwartet Übersetzung abgeschlossen -- 15 Fehler, 0 Warnungen : Kein Download möglich
Last updated: 2023-12-19
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 greenwood on CODESYS Control Raspberry Pi mit Servotreiber T6 von StepperOnline
CODESYS Forge
talk
(Post)
Hallo, ich versuche, eine Modbus-RTU-Kommunikation zwischen meinem Raspberry Pi mit CODESYS Control für Raspberry Pi 64 SL und einem Servotreiber von StepperOnline, Typ T6, herzustellen. Die Verbindung ist wie folgt: RJ45-Stecker am Servotreiber -> Kabel mit RJ45 an einem Ende und USB-A-Stecker am anderen Ende -> Seriell-zu-USB-Konverter -> Raspberry Pi. Der Seriell-zu-USB-Konverter und die Kabel habe ich zusammen mit dem Motor und Treiber von StepperOnline gekauft und sie sind dafür gedacht, den Servotreiber mit einem Computer zu verbinden, auf dem deren Setup-Software läuft. dmesg | grep tty auf dem Pi sagt mir, dass der USB-zu-Seriell-Konverter auf ttyusb0 ist. Ich weiß nicht, wie man das in einen COM-Port übersetzt, ich habe COM 1 genommen. Ich habe ein Projekt in Codesys erstellt und ein Modbus_COM-Gerät hinzugefügt, einen Modbus_Master_COM_Port und einen Modbus_Slave_COM_Port angehängt. Auf der Registerkarte "Allgemein" des Modbus_COM habe ich die folgenden Werte eingestellt: Slave address 1 Baud rate 9600 Parity None Data bits 8 Stop bits 2 Ich habe den Servotreiber auf die gleichen Werte eingestellt. (Ich habe auch andere Werte getestet, aber mit dem gleichen Ergebnis). Auf der Registerkarte "Modbus Slave Channel" des Modbus_Slave_COM_Port habe ich einen Kanal hinzugefügt und die folgenden Werte eingetragen: Access type Read Holding Registers (Function Code 3) Read Register offset 0x0000 Length 1 Ich habe noch keinen Code geschrieben, weil ich noch nicht herausgefunden habe, wie man die Kommunikation programmiert. Wenn ich das Projekt zum Raspberry Pi herunterlade scheint der Modbus_Master_COM_Port zu laufen (grünes Symbol), aber der Modbus_Slave_COM_Port nicht (rotes Dreiecksymbol). Wenn ich einen anderen COM-Port eintrage, haben sowohl der Master als auch der Slave das rote Dreiecksymbol. Ich habe dies auch mit meinem Windows-PC unter Verwendung von Codesys Control Win 64 versucht und die gleichen Ergebnisse bekommen. Ich wäre dankbar für jede Hilfe oder Tipps, wie ich den Grund dafür herausfinden kann, warum der Servotreiberreiber nicht reagiert.
Last updated: 2024-05-31
Post by george32 on CSV file and string manipulation.
CODESYS Forge
talk
(Post)
Dear folks, I think I have a rather simple question but I could not find the right answer to my question: I have made with Excel a CSV file where I would like to have some general data regarding my program variables. I have made an program what let me read the file. The string I am currently get is at follows: 'IP_Adres;192.168.45.12$R$NPort_number;2000$R$NCycle_time;43$R$NStart_Standard_IO;20$R$N' Now I want to split the string in multiple part, which I later would connect to the right variable. By Google and experimenting I have reached to the following code for the first part of the splitting proces: // Splitting the BOM of the string: Received_string := FileReadString; IF LEFT(STR:=New_string,3)= '' THEN Received_string_without_BOM :=RIGHT(STR:= Received_string,SIZE:= (LEN(STR:= Received_string))-3); END_IF //Splitting the remaining string in part for later declaration. WHILE index = 0 DO index_split_part := FIND(STR1:= Received_string_without_BOM,STR2:= '$R$N'); Part_of_String[index]:=LEFT(STR:=Received_string_without_BOM, SIZE:= index_split_part); index := index + 1; END_WHILE However in the splitting proces I could not understand what is really happening. I understand that the Find() function returns the first value the $R$N in the Received_string_without_BOM. This would mean that the index_split_part := 23 I|P| _ |A |d|r|e|s|;|1_|9 |2 |. |1 |6 |8 |. |4 |5 |. |1 |2 |$ |R |$ |N |P | 1|2| 3 |4 |5|6|7|0|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27| So the next part is to read the first 23 characters of the Received_string_without_BOM with the LEFT() function. I expected that the outcome the following was: 'IP_Adres;192.168.45.12$'. However the outcome is: 'IP_Adres;192.168.45.12$R'. I do not understand where the R after the $ sign comes from, because its place is 24 so it would not be added to the part_of the_string[index]. If I hard coded value 24 for the size it gives me the following return: 'IP_Adres;192.168.45.12$R$N'. I would expect everything till the R but the code adds the $N also to the string. I hope someone could explain to my what I am seeing wrong in my point of view? With kind regards, George
Last updated: 2024-09-27
Post by sunfloweeerrry on Edgelogix-rpi-1000-cm4102032 SPI port connection to PiFace I/O Driver in CodeSys.
CODESYS Forge
talk
(Post)
Hello, I hv a problem. Couldn't solve this for 2 days now. So I'm quite new at CodeSys and I have to use the spi port x30 on the edgelogix rpi 1000. So what I have to do is just 'add device' at the SPI where I hv to pick the 'SPI master' after that I hv to change the parameters according to the edgelogix I did found in the spidev.h but nothing got updated so I 'add device' again where I pick the PiFace I/O Driver and I put my variables at the I/O Mapping, which i put the input startbit at the in part and led at the out part. I want to make the led blink according to my structured text code but somehow the hardware didn't connected with the CodeSys spi port. Nothing happens. Any idea what I have to do?
Last updated: 2023-08-18
Post by rossanoparis on After un upgrade of "CODESYS Control for Raspberry Pi MC SL" from v4.7 to v4.9 SysFileOpen function stopped working
CODESYS Forge
talk
(Post)
Hello at all. After un upgrade of "CODESYS Control for Raspberry Pi MC SL" from v4.7 to v4.9 SysFileOpen function stopped working. I'm not able to read or write files from the PLC application. Before this upgrade all worked fine. I've read this thread [ https://forge.codesys.com/forge/talk/Engineering/thread/3da9ded84e/ ] Despite I followed that indications I couldn't get my code working again. Perhaps I'm missing something or I didn't understand how to use placeholders at all. Is there a different syntax to use for "SysFileOpen" in order to use placeholders? Thanks in advance for your help. Information Compiler: CODESYS V3.5 SP19 Patch 2 Runtime: codesyscontrol 4.9.0 HW: KUNBUS RevPi Connect S Below the paths I want to access (The entire CODESYSControl_User.cfg file is attached) [SysFile] PlaceholderFilePath.1=/home/pi/hpca/bin, $hpcabin$ PlaceholderFilePath.2=/home/pi/hpca/cfg, $hpcacfg$ PlaceholderFilePath.3=/home/pi/hpca/logs, $hpcalogs$ PlaceholderFilePath.4=/home/pi/hpca/resources, $hpcares$
Last updated: 2023-08-22
Post by garyl on Comments in arrays and assigning RST coil's to 600 outputs
CODESYS Forge
talk
(Post)
Hello all, im working on a project that requires me to convert an old automation direct DirectSoft PLC d2-250-1. One of the problems im encountering is that all of the comments are attached to members of the different addresses. When i convert the addresses (1777 "C" registers, 777 X registers, and 20,0000 V registers) im running into difficulties keeping the inputs/outputs correct since they are missing documentation. Is there a good way to retain the comments of the indexes in the array? Secondly, initially i was declaring the "C" and "V" addresses individually and this worked to retain the comments as to which register did what, however i ran into a problem when one rung reset (or set to 0) approximately 600 C Addresses. Since each tag is separately declared this proved to be nearly impossible without a literal wall of code that attempted to crash the program. So i converted all of the registers (C,X,Y,V) into separate structs, declared them as arrays and pointed all of the original call outs in the program to the newly defined structs. However i have now lost comments and the program is very hard to follow. Thanks for any help with this issue.
Last updated: 2023-08-31
Post by oi18ct on ARM SL Development Board Recommendation
CODESYS Forge
talk
(Post)
Hello codesys forum, My company is looking at developing a solution with Codesys ARM SL. The requirements will not tax the capabilities of Codesys. I would like to buy an AMR 7 or 8 Dev Board for experimenting. I am looking for a recommendation as I have minimal experience with Linux. Any input from the forum would be most appreciated as the hardware requirements as provided by Codesys for ARM SL seem pretty minimal (basically a arm7 or 8 with Debian is all). Our needs are small in scale- something like 8 digital inputs, 6 digital outputs, 2 analog inputs and 1 analog output. A small gui will be published via web visualization for external display (no local display). Communications with ModbusTCP and uart/RS485. It may be necessary to access i2c and make c or python calls to some existing code that is pretty small. Something like the EMCraft STM32MP1 SOM Starter Kit or Octavo Systems OSD32MP1-RED development board? Ideally something that has a path to a SoM for production. Kontron appears to have some interesting options too. Just having a hard time deciding where to start. Thanks in advance... LC
Last updated: 2023-11-11
Post by arundara on Variable Sync Issue In Soft Plc Redundancy
CODESYS Forge
talk
(Post)
Hello, I was trying to create a redundancy POC for our application where we read data from few modbus tcp devices. As there is a limitaion that modbus tcp device support only for single master device, we wanted to test how the variable sync happens in redundancy mode. For that i have used the redundancy sample code added a variable "b" under a condition. What i observed was while active controller is running, if passive controller is powerup, passive controller is able to sync all the data configured for redundacny. But after that the variable data which resided under a condition is not synching from active to passive controller. I have attached the image where i have highlighter the variable. Can some help me to understand how redundacny work in codesys soft plc and if there is a solution to sync variable which are under condition, please explain the same or suggestion to achieve the same. Hardware - Raspberry Pi (2 qty) Redundancy licence used - yes in both controllers. Codesys runtime - 4.9.0.0 Codesys software version - V3.5 SP19 if i have posted this question in wrong section, please do let me know in whcih section i have to post this question.
Last updated: 2023-12-01
Post by ph0010421 on How to create a stopwatch?
CODESYS Forge
talk
(Post)
Do you need an 'hours-run' counter? And 1 second resolution is ok? I think you're over-thinking it. (The task time needs to be < 1second) Have a look at the LAD... Then, the time in seconds can be made into hh:mm:ss with this FUNction Declarations: FUNCTION funSecondsToStringTime: string VAR_INPUT InSeconds: UDINT; END_VAR VAR AsString: STRING; Minutes: UDINT; Hours: UDINT; Seconds: UDINT; MinutesAsString: STRING(2); HoursAsString: STRING(2); SecondsAsString: STRING(2); END_VAR and the code: Hours := InSeconds / 60 / 60; //Derive hours Minutes := (InSeconds - (Hours * 60 * 60)) / 60; //Derive minutes Seconds := InSeconds - ((Hours * 60 * 60) + (Minutes * 60));//Derive seconds HoursAsString := UDINT_TO_STRING(Hours); MinutesAsString := UDINT_TO_STRING(Minutes); SecondsAsString := UDINT_TO_STRING(Seconds); IF LEN(HoursAsString) = 1 THEN HoursAsString := CONCAT('0',HoursAsString); END_IF; IF LEN(MinutesAsString) = 1 THEN MinutesAsString := CONCAT('0',MinutesAsString); END_IF; IF LEN(SecondsAsString) = 1 THEN SecondsAsString := CONCAT('0',SecondsAsString); END_IF; AsString := CONCAT(HoursAsString, ':'); //assemble string AsString := CONCAT(AsString,MinutesAsString); AsString := CONCAT(AsString,':'); AsString := CONCAT(AsString, SecondsAsString); funSecondsToStringTime := AsString;
Last updated: 2023-12-08
Post by nz-dave on Bool turning on in case stament in wrong state?
CODESYS Forge
talk
(Post)
I had the FB called via a for loop to call a few instances of my FB I have removed it the for loop and just called them 1 by 1. Seems to have sorted the problem. tho, i have other FB's and for loops doing the same thing but they are all fine. below is basically what was happening. var: mVibrator : ARRAY[1..GVL_Settings.Number_Of_Products] OF Main_Vibrator; end_var Controller(PRG) call: FOR v := 1 TO GVL_Settings.Number_Of_Products BY 1 DO; mVibrator[v] (); END_FOR So at state 30: the mVibrator[1].start was turning on 30: Main_Mixer.Start := TRUE; Process_State := 2; IF Main_mixer.Done THEN Main_Mixer.Start := FALSE; Control_State := 40; END_IF but its not till state 50: that it is actual in the code. 50: Main_Suction_valve.Open_Input := TRUE; mVibrator[1].Start := TRUE; Process_State := 4; IF GVL_Weigh_hopper.LoadCell_Weight = 0 THEN Main_Suction_valve.Open_Input := FALSE; mVibrator1.Start := FALSE; Control_State := 60; END_IF Thanks for your input.
Last updated: 2023-12-16
Post by vahasa on CAN TPDO / RPDO
CODESYS Forge
talk
(Post)
Hi I'm automation engineering student and I'm not yet quite familiar with CAN-bus. What I am trying to achieve, to send two byte message via CAN from Epec display to Scott Drive inverter. I'm using code template made with Epec Multitool in Codesys 3.5 Problem i'm facing is that drive responds with same COB-ID. In multitool, you can create TPDO/RPDO. And depending on that, display either sends or only receives. This is problem, because for parameter polling from drive, you need to send two byte request to 0x399 and drive responds with eight bytes. If request is longer, drive don't respond. 0x399 is currently setted as RPDO, so display doesn't send anything on startup and I made program that sends messages to 0x399 bytes 0 and 1 and bytes 3-7 are shown in display. If setted as TPDO, display send all eight bytes and therefor drive cannot respond. But, I think because they are defined as RPDO, display won't send message, although monitoring with Codesys, values are changed. Question is, how should COB-ID be configured in Codesys, so it wouldn't automatically start to send message but would send when needed?
Last updated: 2023-12-19
Post by levih on DocScripting
CODESYS Forge
talk
(Post)
Hello I'm trying to use the DocScripting collection in Codesys. I've made it work on one PC(1) for the 3.5.16.4 version of the script collection. But when I try the same setup on another PC(2), I get an error message: Error loading Python DLL: D:\SCRIPTING\3.5.16.40\python27.dll (error code 14001) My setup on both PC's is thus: 1. Downloaded and installed Python 2. Copied the folder with the scripting collection to C: (because of admin rights) 3. Placed my .library file in the same folder as the scripting collection Only difference is that Python is v3.12.0 on PC1 and v3.12.1 on PC2. I thought maybe it was something with Python, but then I have tried using the scripting collection from 3.5.16.1, and that seems to work. Just not for scripting collection 3.5.16.4. I also can't seem to find any scripting collections on newer versions of Codesys? (e.g. 3.5.19.10) Thanks in advance!
Last updated: 2024-01-22
Post by axilleas on SMC_Interpolator + SMC_controAxislbyPos
CODESYS Forge
talk
(Post)
dear all I am working on a very generic gantry system (virtual drives + win v3 control) reading gcode from external file. In order to stop the interpolator function from running when gaps are detected, SMC_controlAxisByPos FB has the bStopIpo output which according to the manual is connected to the Interpolator's bEmergencyStop. Lets assume that the axis are parked in position X1000 Y1000 and the initial G code movement is G00 X500 Y500. The normal behavior is to travel from the actual x1000 y1000 to G00 X500 Y500. The SMC_Interpolator always gets the X0 Y0 as the initial position, meaning that the bStopIpo is active until the axis are in X0 Y0 and the release the interpolator to set the new positions to X500 Y500. Is there a suggested method to solve this behavior? bonus question: I get a lot of bStopIpo during standard interpolation movements (not gaps). While working with virtual axis this is not a problem but when real axis are installed this will be an issue. What exactly triggers the bStopIpo output? Slow axis accelerations compare to Gcode defaults? Kind Regards
Last updated: 2024-02-05
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 timl on BacNet "Unaufgelöste Referenz"
CODESYS Forge
talk
(Post)
Hallo, ich habe Probleme beim nachbauen des BacNet2 Tutorials "Erste Schritte" aus der CODESYS Online Help. https://content.helpme-codesys.com/de/CODESYS%20BACnet/_bacnet_first_steps.html Das Anlegen des BacNet2 Servers und der danach folgenden BacNet Datenpunkte erfolgt ohne Probleme. Der Code lässt sich mit F11 auch Fehlerfrei generieren. Beim Download auf die SPS tritt dann der Fehler auf dem Bild auf. Anbei auch ein Bild des Logs nach dem Download. CODESYS BACnet 2.0.0.0 ist über den Installer runtergeladen. Device: CODESYS Control Win V3 x64 Version 3.5.19.40 CODESYS 3.5.19.40 Im Bibliotheksverwalter ist BACnet2 2.0.0.0 aufgeführt Die Konfigurationsdatei habe ich mit folgenden anpassungen abgespeichert: [ComponentManager] Component.1=CmpTargetVisuStub Component.2=CmpWebServer Component.3=CmpWebServerHandlerV3 Component.4=SysCpuMultiCore Component.5=SysReadWriteLock Component.6=SysCpuBreakpoints Component.7=SysPipeWindows ;Component.8=CmpHilscherCIFX ;Component.9=CmpPCANBasicDrv ;Component.10=CmpCANFoxDrv ;Component.11=CmpIxxatCANDrv ;Component.12=CmpBlkDrvCanServer ;Component.13=CmpBACnet Component.14=CmpBACnet2 [CmpBACnet2] ;configuration file of the BACnet stack IniFile=$PlcLogic$/bacstac2.ini ;task priority of the BACstack process task, default: TASKPRIO_NORMAL_END (159) TaskPrio=128 ;name of the named pipe for the communication with the BACstack AppName=/tmp/BACnetServer Habe ich etwas vergessen?
Last updated: 2024-02-16
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
.