Today we will take some practice to do some pretty stuff, usually first programmer do in any programming language is saying " Hello World", now we gonna do this things so in Codesys using Ladder programming language.
If you need guidance to prepare the things before start i propose to see my previous post.
1. Create your first project, on start page or you can navigate to File > New Project
2. Create project with standard template, i propose this option if you are a beginner or newcomer with Codesys.
3. Select Raspberry Pi with ladder programming, i choose because it's very easy for beginner.
If you need guidance to prepare the things before start i propose to see my previous post.
- Transform Your Raspberry Pi to PLC with Codesys Runtime
- Learn 10+ Steps Mastering Headless Setup Raspberry Pi
1. Create your first project, on start page or you can navigate to File > New Project
2. Create project with standard template, i propose this option if you are a beginner or newcomer with Codesys.
3. Select Raspberry Pi with ladder programming, i choose because it's very easy for beginner.
4. After project was created, navigate to View > Devices, or you can press ALT + 0 for shortcut.
5. Double click on PLC_PRG(PRG), now navigate to ROW number 1 then drag and drop function BOX at the toolbox
6. Set function box name to MOVE.
7. Make 3 local variable as per picture describe.
8. Fill the input and output of function box, follow below picture and remember " left side of function box is input and the right side is output ".
9. Add one more row to make this program more fun, by right click one row 1 > Insert Row(Below)
10. Press F11 to build and check whether your code have error or not.
11. On the Device view (press ALT+0) double click on " Device (Codesys.....) "
12. On the Device Page navigate to Communication Setting > Scan Network, then click your PI
13. If your PI connected will be shown like picture below, after that press ALT+F8, to download program.
14. Press F5 to run your PLC and back to your ladder programming page.
15. From local variable you can change value on the "Prepared Value" column then press CTRL+F7.
Finally after 10+ steps we can made this PI says " Hello World " and after we try the code i make some conclusion :
1. This Raspberry Pi works our program using Codesys
2. After we turn variable called " trigger2 " the PI only says "Yey success" missing character "!" , its because length of variable PI_Says only 11 character.
Don't be shy to ask if you still have difficulty about this instruction, write down your question on comment below.
If you like this blog share to other people and subscribe so you can stay up to date. For all, thanks for reading and happy trying.
No comments:
Post a Comment