Learning CoDeSys

bopol

Member
Join Date
Feb 2008
Location
Singapore
Posts
46
Hi guys! really enjoyed reading the threads about the different "languages" used in programming PLC... learned a lot!

anyway, i just want to ask for sage advice on CoDeSys programming... since I come from AB background (and a little Schneider) which means im used to drag/drop, index addressing, automatic file type conversion, and all those silly things that made my life soo much easier before!lol

Right now I am working for a company that uses CoDeSys and Siemens software, but Id like to learn codesys first since that is what we mostly use... I have already explored the software and found out that even the most "basic" logic does not have the same result... like in programming interlocking contacts, I found out that once you turn a contact to a "true" state, it remains that way unless you right another ladder to make it false (more like "IF THEN" statement and you have to put the "ELSE" statement to make it go "false" again). also in the use of SET/RESET contact, you can use RESET before SET without having problem in the logic unlike in AB where Latch will not turn on if Unlatch is put before it (due to the program cycle). Ladder logic is reaalllly limited in codesys so im trying to learn structured text and the other languages but im most comfortable in ladder.

Any other things I have to watch out for when using ladder logic?
 
Hi!
... like in programming interlocking contacts, I found out that once you turn a contact to a "true" state, it remains that way unless you right another ladder to make it false

I don't follow you here. Do you use (S) and (R) instructions?
Could you post a code snapshot?

also in the use of SET/RESET contact, you can use RESET before SET without having problem in the logic unlike in AB where Latch will not turn on if Unlatch is put before it (due to the program cycle).

You have got SR and RS boxes available, one is set dominant the other reset dominant. I planned to make an example, but some days ago I tried to install ABB Control Builder, and it messed up my CoDeSys totally. šŸ™ƒ I'll fix it on a rainy day...


Ladder logic is reaalllly limited in codesys so im trying to learn structured text and the other languages but im most comfortable in ladder.

Any other things I have to watch out for when using ladder logic?

You are aware of that there are lots of libraries available for CoDeSys? You can also make you own reusable functions that can be called from your LAD programs.

Kalle
 
ah, yes...those libraries are the good things about codesys... a pretty powerful software! the structured text has its own advantages, especially math functions. i have made some function blocks already, will be making more once i get a better hold of how codesys works...im still in the getting to know you phase so there's more to dig...

attached is the sample of the code (i don't use S and R here).

Thanks for the advice.

Also, any idea how to use the counter modules (750-404/000-005)?i have already read the manual but i have trouble understanding it since i don't have the hardware yet... i have trouble about the addresses used,
which address to write, which addresses to read from...basically, i want to know the equivalent of CTU.acc, CTU.Pre, and CTU Reset (from AB software) but i think i got it all mixed up..would have been easier if the hardware was here

codesys_sample.jpg
 
in the sample above, if i didn't write ladder 5 then al_overrange will remain true once it is set to true. the code is for analog input scaling function block with overrange and underrange detection.

BTW, im using CoDeSys V2.3 =)
 
in the sample above, if i didn't write ladder 5 then al_overrange will remain true once it is set to true. the code is for analog input scaling function block with overrange and underrange detection.

BTW, im using CoDeSys V2.3 =)

I don't think your problem is that al_overrange is staying true, the real problem is that in Ladder 4 you're using a move where you want to be using a "SEL"ect command so that when there is no overrange you send analog_input to ai_pv and when you have an overrange condition you switch the raw_max to ai_pv.
 
hmm...im not familiar with that command yet, ill explore that tomorrow... but the end result is the same as you suggest, when there is no overrange analog_input is sent to ai_pv and when there is an overrange condition the raw_max is switched to ai_pv.
but using this style allows me to use the al_overrange and al_underrange bits as var_out for alarm/warning. as they say, many ways to skin a lion =D

thanks for the info RMA ;)
 

Similar Topics

I've recently inherited a project from one of our sister companies. We have a range of machines that all use various versions of Codesys. I'm...
Replies
4
Views
2,633
Hi All, I used Codesys for Lenze Servo drives recently. Now I've seen that Mitsubishi is certified for PLCOpen since 2015. I am a Siemens...
Replies
3
Views
2,623
I'm beginning a new job soon and the next place uses only Wago PLC's. All of my previous experience is in RSLogix 500/5000 and DirectLogic. I'm...
Replies
8
Views
3,594
I've gotten to the learning curve where I can program a call for pump to come on at set point but I'm not sure how to turn the same pump off when...
Replies
1
Views
119
I want to pick up an Allen Bradley PLC so I can practice writing programs. I have 10 years as a maintenance tech and a good understanding of...
Replies
8
Views
228
Back
Top Bottom