TwinCAT Structured Text Programing (LOOP)

Hello Everyone:

I have been able to read value via canopen interface using ADS protocol.
Actually my Structured Text Programming is weak. I can read the value only when I toogle 'Read' in the ADS. I want the READ the value automatically whenever I write a new value. But instead I have to toogle the READ everytime I write the a new value.

Can somebody send me the code in structured text of LOOP that I have to implement to READ so that it goes on automatically whenever I write a new value.

How to perform a loop on 'READ' in structured text? 'READ' is just a toogle bit. Please reply
 
Hi Shooter. I have tried these 2 codes. But they are not working. Actually i want that whenever I write a new value the read toogle bit automatically becomes true.
In the first case scVoltage is the scaled voltage that I get after writing the value. But the read toogle bit does not go False and it remains True.

IF scVoltage>=1THEN
fbADSREAD.READ:=TRUE;
ELSE
fbADSREAD.READ:=FALSE;
END_IF

In this case whenever my write goes true my read goes true but the problem is that it reads the previous value.

IF fbADSWRITE.WRITE=TRUE
THEN
fbADSREAD.READ:=TRUE;
ELSE
fbADSREAD.READ:=FALSE;
END_IF

So what will be the code then in such a way that whenever I write a new value I automatically read the value.I dont have to toogle the bit by pressing
cntrl+f7.
Thanks
Regrds
 
IF scVoltage <> oldvoltage THEN
fbADSREAD.READ:=TRUE;
put here also to fill the array with the newvalues.
oldvoltage=scVoltage;
ELSE
fbADSREAD.READ:=FALSE;
END_IF
 

Similar Topics

Hi all, I've inherited someone else's program and can't for the life of me figure out his use of the # symbol in one of his structured text...
5
Replies
3,333
Views
Hello everyone: I have been able to read and write data via canopen interface through ADS read and write functional blocks in Twincat PLC...
9
Replies
6,622
Views
Hi, i'm really struggling to get any decent examples of the above. Can anyone help??
3
Replies
11,539
Views
Scope: I'm trying to access SEW inverters over EtherCAT by using the EtherCAT master mailbox. I can ping the mailbox from inside the PLC, but not...
0
Replies
139
Views
Hello everyone. I recently changed my work laptop. I installed the latest version of Twincat 3 on it however I'm running in the following...
4
Replies
539
Views
Top