
ID 29867.06, Rev. 01
© 2007 Kontron Modular Computers GmbH
P R E L I M I N A R Y
29867
.06_01.VC.070319/151305
Page 25
ThinkIO
™
- P
PROGRAMMING ASSISTANCE GUIDE
CoDeSys PLC
6.3
Writing a Test Application
A new POU “PLC_PRG“ is created using the programming language ”ST“.
The following simple application will:
•
make a simple assignment in the statement part of the program
•
count the variable x
•
assign bit 0 of variable x to KBUS output 1 (KBUS_OUT1)
•
assign bit 1 of variable x to KBUS output 2 (KBUS_OUT2)
•
read KBUS input 1 (KBUS_IN1) and assign to variable kbus_input (bit 0)
•
read KBUS input 2 (KBUS_IN2) and assign to variable kbus_input (bit 1)
•
assign variable x to PROFIBUS output (PROFIBUS_OUT)
•
read PROFIBUS input (PROFIBUS_IN) and assign to variable profibus_input
If the test program can be compiled without any problems it can then be loaded into the
ThinkIO-P PROFIBUS Master.
PROFIBUS will be automatically initialized when the user program starts. The I/O communica-
tion with the slave and reading from and writing to K-Bus modules will start when the program
starts.