Search the Community
Showing results for tags 'twincat3'.
Found 3 results
Hi all, New to the forum. I've been pretty much able to do the things I wanted with Beckhoff, but now I'm finally running into a problem I can't seem to solve alone. I'm trying to set-up Modbus RTU RS485 communication in Twincat3, using an EL6021. I've implemented a sample program from the Beckhoff website, but can't get it to work. I've got the feeling I need to properly set up the EL6021 but most information on the Beckhoff website is about the KL-series IO. Does anybody have experience with this? The strange thing is that, when I enable the function to read some slave's registers, BUSY is set and remains set. No timeout is triggered. I don't have a slave connected yet but I would at least expect to see something on the output of the terminal, and then a timeout. I've bridged TxD+ and RxD+, and TxD- and RxD- and set 8000:06 of the EL6021 TRUE, half duplex mode enabled). A scope connected to TxD+ and TxD- shows nothing. Code added below. I've added a GVL called 'Variable_Configuration' with the following: VAR_CONFIG Main.MB.InData AT %IB0 : MB_KL6inData5B; Main.MB.OutData AT %QB0 : MB_KL6outData5B; END_VAR And then the MAIN: PROGRAM MAIN VAR bIoSyncMaster AT %I* : BOOL; MB : ModbusRTUmaster_KL6x5B; MBLedDriver : ARRAY[1..10] OF WORD; tmpExecute : BOOL; bError : BOOL; bBusy : BOOL; iErrorId: MODBUS_ERRORS; iNoDatByteRead: UINT; count: INT; freebyte: INT; TxError: INT; TxBlocked: BOOL; END_VAR MB( UnitID:= 41, Quantity:= 4, MBAddr:= 16#0020, cbLength:= SIZEOF(MBLedDriver), pMemoryAddr:= ADR(MBLedDriver), Execute:= tmpExecute, Timeout:= T#5S , BUSY=> bBusy, Error=> bError, ErrorId=> iErrorId, cbRead=> iNoDatByteRead); MB.ReadRegs(); count := MB.MBMaster.com.Buffer.Tx.count; freebyte := MB.MBMaster.com.Buffer.Tx.FreeByte; TxError := MB.MBMaster.com.Buffer.Tx.Error; TxBlocked := MB.MBMaster.com.Buffer.Tx.Blocked; tmpExecute:=FALSE;
Hello, I've been using a Beckhoff PLC and TwinCAT3 lately and I'm learning how it all works. Currently I'm using a ton timer in my program and I've noticed some weird behaviour. The timer.IN is set to true and afterwards I check for timer.Q in an IF statement. That statement should therefore only be true after the timer.PT delay value. However, the first time after I activate the configuration and timer.IN is set to true, timer.Q is immediately set to true for a very short amount of time. When I reset all values and try again without reactivating the configuration, this doesn't happen. I'm thinking that I don't initialse the timer in the correct way or something along those line. I have attached a code snippet. The problem I'm encountering is that the first time after I have activated the configuration and the tonTimeout.In is true. The following IF statement is also true without having run for the delay time. This sends my program to an error state. However, after resetting the values this doesnt happen anymore. Can anyone help me with this matter?
Hello all, I'm new to Beckhoff and running a PLC with EtherCAT I/O slaves. If one of the slaves is disconnected from the network (power loss or network cable broken) the whole PLC freezes, is there a way of configuring ethercat such that it remains (partially) operational, thus showing me the I/O on the unaffected stations.