WinPLC help Contents

Welcome to Power WinPLC!

What is Power WinPLC?

System Requirements

How to install WinPLC?

WinPLC Licence agreement?

WinPLC version history

WinPLC feedback

WinPLC Basics

Components of WinPLC

- The menu bar

- The direct card access

- The command box

- The program box

- The control buttons

WinPLC instruction set

- General Commands

- Special Commands

- WinPLC Control Commands

- Program Variables

- Digital Operations

- Channel Start Commands

- Channel Stop Commands

- Channel Invert Commands

- Random Channels

- Memory Commands

- Time Commands

- Analog Outputs

- Networking Commands

- Stepmotor Commands

Working with events

The WinPLC variables

Hidden features

Stack & Pointers

Programming Tactics

- Variable Execution Speed

- Endless Loops

- Counters

- Networking

Extra WinPLC Features

- Digital/Analog lightcomputers

- GUI editor

This help file was created with the free trial version of HelpScribble.


What is WinPLC

Power WinPLC is windows based software to control the Velleman interface card K8000. If you don't know this card, visit the velleman site to read about it. Although the software was originally written for the velleman card, it might be adapted to use with other interface cards as well.

The first version of WinPLC was written in June 1997, because there were people who could use the Interface Card but they didn't know how to make programs for it. This is the point where I decided to start with the WinPLC project. One of the goals was to create a language for the card, which was very easy to understand. A second goal was to invent a system which allowed the user to make his applications very quickly while typing as many as possible. Now, 6 years later this goals has certainly become true: WinPLC is very easy to use and the commands are very powerful.

If you aren't very good in programming, you might consider using WinPLC. But also if you are tired of typing very large codes for an easy application, you might consider WinPLC as well. But keep in mind WinPLC isn't a compiler, you can't make your own executables with the program.

I hope you like this application.

Bart

This help file was created with the free trial version of HelpScribble.


System Requirements

WinPLC is currently in a beta faze, this means it can and it will still be changed before the official fourth release will be placed on my site. It currently runs on a Intel Pentium III 500 MHz computer, with Windows 2000 as the operating system. It hasn't been tested on other platforms yet. WinPLC hasn't really system requirements, except you have to have connected the K8000 card to your computer before you can run this application. Also, you need the Windows platform, probably Windows 9x (not tested yet) to Windows NT / Windows 2000 / Windows XP.

When you are testing your version of WinPLC on one of the untested systems, please mail your comments to me at bartv@pandora.be. It is the only way to get a very stable version of WinPLC, although WinPLC now already is a very stable application which seems to have a very little bugs in it.

This help file was created with the free trial version of HelpScribble.


How to install WinPLC?

The only way to get WinPLC from me, is to download it from my site at http://users.pandora.be/bartv/winplc. Go to the download section, and get the files for the latest version of WinPLC. You will have to download 2 files: the DriverLINX Port IO driver, and the WinPLC setup application. After installing WinPLC and rebooting your computer, you can immediately start it.

DriverLINX Port IO Driver

This is the driver WinPLC uses to communicate with the printerport. You really need to install this driver, because WinPLC won't work without. DriverLinx is a third party driver for WinPLC, created by "Scientific Software Tools". This is a freeware driver, but Scientific Software Tools requests to distribute the package in its entirety without removing their name and copyright information. When installing this software on an NT platform, you need to be logged in as administrator.

WinPLC setup application

The second file you need to download from the site, is a ZIP file with the WinPLC setup files in it. Unzip the files to a certain folder, and run setup.exe to start the setup wizard. You don't have to install WinPLC in the same directory as the DriverLINX Port IO driver.

This help file was created with the free trial version of HelpScribble.


WinPLC Licence Agreement

WinPLC is a freeware software program. This always will remains so, an agreement with Velleman has been signed on this matter. You can distribute WinPLC like you wish, but you MAY NOT make a financial profit with it. If you want to earn some money, write your own software and sell it afterwards!

WinPLC is able to control the Velleman K8000 card. If WinPLC fails, unexpected conditions could occur. So: I am not responsible for any damage that occurs by using WinPLC. You shouldn't use the software is a malfunctioning could cause dangerous situations. This warning doesn't mean WinPLC is bad. No-one ever complained about a WinPLC crash so far.

WinPLC's source code is not available for downloading, but if you feel like you can help a lot with the program you may contact to become a software helper. The application is completely written in Visual Basic 5.0 Professional, and currently has 13000 lines of source code.

Power WinPLC   copyright © 1997 - 2003   Vanderhaegen Bart

This help file was created with the free trial version of HelpScribble.


WinPLC version history
Version history

Version 1 (Power WinPLC)

WinPLC was first written in June 1997, and was very limited. It had commands to start and stop I/O channels, make some time delays and to jump to labels. Also, the K8000 instruction set was completely written in Dutch.

Version 2 (Power WinPLC Professional)

Version 2 had a lot of great improvements. Unfortunately, the source code was lost after a computer crash (March 2000) because backups were not made. The language was still DUTCH, and it now supported commands like "ALS" (English: IF).

Version 3 (PW+ Pro 2000)

A friend found the source code from a previous version of WinPLC on his computer, so the source code wasn't totally lost. I remade WinPLC to attemp making it the same as the lost Version 2. Also the language of the instruction set was converted to ENGLISH, to allow more people to use the WinPLC.

Version 3 (PW+ Pro 2002)

A new year, a new version so PW+ Pro 2002 just came out. This new version supports a lot of new commands (Internet connections, Sub programs, reading AD channels, ...) , and now has a help file. The software changed a lot since version 1, but it's still very easy to create programs. Version 3 isn't compatible with the previous version because the file format (*.PLC files) changed).

Version 4 (PW+ Pro 2002)

Version 4 was released during April 2002. In the mean time, this version was renewed up to version 4.3. Especially the IF functions were improved, but WinPLC also supports up to 4 K8000 cards now.

Version 5 (Power WinPLC)

Version 5 of WinPLC was released in februari 2003. This version contains some important bug fixes. The name of "PW+ Pro 2002" changed back to "Power WinPLC" (the orginal name of the software). This was done because this is the most used name for the software!

Version 6 (Power WinPLC)

Version 6 is the latest and final version of WinPLC. This is a new, very powerful, version with lots of new features. But with this version, the limits are almost reached. I can't keep adding new commands, it would become too hard to navigate through the several commands.

This help file was created with the free trial version of HelpScribble.


WinPLC feedback

WinPLC is software, and like every other piece of software it may have bugs in it. If you find a bug, you really should send me the information at bartv@pandora.be about this bug so I can make a bugfix. Also WinPLC is only tested on a Windows 2000 platform yet, if you 've tested it on other platforms please let me know if WinPLC works. WinPLC will get better if you do this!

This help file was created with the free trial version of HelpScribble.


WinPLC Lightcomputers

WinPLC has 2 light computers in it, a "Digital" and an "Analog" light computer. The purpose of these subprograms, is to create light effects for your card very easy.

At your left, you can see a list with 500 numbers. Each number represents a memory location in WinPLC. You can assign a certain I/O state to each memory location, by checking or unchecking the checkboxes at the right bottom. With the start button, you can loop all of these memory locations. The "Time Interval" , or the speed how this loop happens, can be set by clicking the "Time Interval" button. You can define an end for your light effect, by selecting the last command and click "Set end". By checking the "repeat when end is reached" box, you can make an endless loop for your light computer. These light computer programs can be saved to disk, but they also can be converted to the WinPLC program list. The analog light computer works the same way for DAC's.

This help file was created with the free trial version of HelpScribble.


WinPLC basics

WinPLC has it's own instruction set, currently this is the instruction set "EN3". This set isn't compatible with the other instruction sets in previous versions of WinPLC (because they were DU1 and DU2, which stands for "Dutch Version 1" and "Dutch Version 2"). WinPLC applications are created in a list box, you just can select items in this list while typing directly to the box isn't possible. During execution time, the commands in the listbox will be executed from top to bottom. When the last command is reached, the execution will be halted. The picture below, shows a sample program in the program box.

During executing, the current command will always be selected which allows you to follow the progress of your program. During editing time, you can select any command you wish. With the buttons you can move the selected command up and down, left or right (this is to make your application more readable). You can delete the selected command, or you can modify it (not all commands can be modified).

This help file was created with the free trial version of HelpScribble.


POPUP-FILENEW
Use this command to clear your current program to

start a new one. If your existing program isn't saved

yet, you will be promped to.

This help file was created with the free trial version of HelpScribble.


POPUP-FILEOPEN
Use this command to open an existing WinPLC

program. If your existing program isn't saved

yet, you will be promped to.

This help file was created with the free trial version of HelpScribble.


POPUP-FILESAVE
Use this command to save your WinPLC

file to disk.You always be prompted

to enter a filename if there is no name

assigned to your program yet.

This help file was created with the free trial version of HelpScribble.


POPUP-FILESAVEAS
Use this command to save your WinPLC

file to disk.You always will be prompted

to enter a filename.

This help file was created with the free trial version of HelpScribble.


POPUP-IMPORT
Use this command to import an existing

WinPLC program to your current program.

Watch out for double subroutines and/or

goto's in your program!

This help file was created with the free trial version of HelpScribble.


POPUP-EXIT
Exits WinPLC

This help file was created with the free trial version of HelpScribble.


POPUP-UNDO
Undo the last action you did to your program. You only

have one undo available, so you can't undo more than

one action. When you know what you are doing, you

won't need this command very often.

This help file was created with the free trial version of HelpScribble.


POPUP-COPY
Place a command on WinPLC's internal clipboard. With

"insert before" and "insert after" you can paste it back to

WinPLC, before or after the selected command in your

program.

This help file was created with the free trial version of HelpScribble.


POPUP-INSERT
Paste a command to your program, that was copied with

the WinPLC copy function. You cannot paste text which

is on the Windows Clipboard.

This help file was created with the free trial version of HelpScribble.


POPUP-DELETE
Deletes the current selected command in

your program.

This help file was created with the free trial version of HelpScribble.


POPUP-JUMPLABEL
This is a tool to find a label in WinPLC very quickly. Just

pick a label in the list and you will jump to it.

This help file was created with the free trial version of HelpScribble.


POPUP-COMMAN
The command manager allows you to show/hide certain program groups in the WinPLC main screen command list. This is meant to turn the groups out , you never use. This increases the speed to build an application because you will find the commands you do need fasted. By unchecking a group  in the command manager, the commands in this group still will be executed if they are used in your program.

This help file was created with the free trial version of HelpScribble.


POPUP-ICC
The Interface Card configuration is a tool which allows you

to let WinPLC know which channels are inputs and which

channels are outputs.

This help file was created with the free trial version of HelpScribble.


POPUP-LIGHTCOMP
This command starts the analog or digital lightcomputer.

This addin is used to make lighteffects to use in your

WinPLC programs. See the lightcomputer section to get

more information about this addons.

This help file was created with the free trial version of HelpScribble.


POPUP-VIEWCOMMAND
Shows the originally command toolbox in the main screen of WinPLC.

This help file was created with the free trial version of HelpScribble.


POPUP-VIEWVAR
Shows a list of the analog variables, instead of the command toolbox in the main screen. This list shows the analog variables for the card, like the DAC output levels, or the read AD inputs. Variables always begin with a $ token. They are refreshed every 100 milliseconds.

This help file was created with the free trial version of HelpScribble.


POPUP-HELP
Shows version information about WinPLC

This help file was created with the free trial version of HelpScribble.


WinPLC Main Screen

After starting WinPLC you will see a screen which is called the "WinPLC Main Screen". This screen gives you access to the several functions and menu's. The screen is competely resizable, while its minimum sizes are 9540 x 6225 pixels. A picture of this screen is show below.

This screen has several specific objects:

- The menu bar gives you access to several options.

- The direct card access allows you to set and read the I/O channels directly (below the menu bar).

- The command box contains all the instructions (left box)

- The program box contains your own program (right box)

- The control buttons allows you to manipulate the program box

This help file was created with the free trial version of HelpScribble.


The Menu Bar

The WinPLC main screen's menu bar gives you access to several functions within WinPLC.

File

New

Open

Save

Save As

Import

Export

Export to an HTML file

Export to a TXT file

Print

Exit

Edit

Undo

Copy command

Insert Before

Insert After

Delete Command

Goto Label

Extra

Command Manager

Interface Card Configuration

Configure Card 1

Configure Card 2

Configure Card 3

Configure Card 4

Digital Lightcomputer

Analog Ligtcomputer

GUI Editor

Subroutine Wizard

Options & Setup

K8000 Setup Wizard

View

Show Command Box

Show Variables

Show Internal Variables

Show Received Data

Help

About Power WinPLC

This help file was created with the free trial version of HelpScribble.


Direct Card Access

The direct card access is a very useful tool, because it allows you to set and view I/O channels in real time (without having a WinPLC program running). Also this can be very interesting to test your WinPLC programs, without having devices like switches attached to your K8000 board yet. On the direct card access, you can see 16 checkboxes, they represents I/O channels on your card. When a checkbox is checked, the I/O channel is on, otherwise the I/O channels is off.

The direct card access also have options to clear all the I/O channels at once, or to invert them all. A third button allows you to clear all the DAC outputs.

This help file was created with the free trial version of HelpScribble.


The command box

The command box contains all the commands you can use in your program. You can click any item on the list, except the 'group descriptions'. They are just information lines, and are meant to organize your commands. They can be recognized by the ---- lines behind them. Also the command box can contain 2 type of instructions: interactive and non-interactive commands. Interactive commands can be recognized because by the question mark they have in the command box. Those commands requires extra information (parameters) before you can add them to your WinPLC application. The figure below shows a sample of such a command.

This help file was created with the free trial version of HelpScribble.


The program box

The program box keeps your program. It lists all the commands you have added to your WinPLC program, you can easily modify/move/delete those commands. The figure below shows a sample of a program box.

It is possible to right click a commands in this box. A popup screen like below will appear, with options you can run on the current selection.

- Delete command

Delete the command

- Modify command

Edit the command

- Copy command

Copy the command to the internal clipboard

- Insert Before

Insert the contents of the clipboard before this selected command

- Insert After

Insert the contents of the clipboard after the selected command

- Command Disabled

Disable the selected command. This can be used for debugging.

This help file was created with the free trial version of HelpScribble.


The control buttons

In the middle of the WinPLC main screen, you will find the "control buttons". They allow you to add new commands to your WinPLC program, to delete commands, to change commands, or to move them in any direction (left, right, up, down).

1. buttons to insert or replace commands

With these buttons, you can insert or replace commands from the command box to the control box. The 2 buttons on the top are for inserting commands into your program, the place where will be inserted depends on the current selected command in the program box. The first button (arrow vertical up) will insert BEFORE that command, the second button (arrow vertical down) will insert AFTER that command. A third button is to replace commands in your program by an other command.

2. buttons to move commands

Commands can be moved up or down in your program (remember the program will be executed from top to bottom), use the arrow up and arrow down button for this. The left and right buttons are to move your command in a horizontal direction. This is not useful, except to make your program more readable.

3. buttons to edit/delete/execute commands

A third group of buttons is to edit or delete commands. You cannot delete the last command in your programma: there must be at least one command for compatibility reasons with other modules (also, when creating a new program you always will have a default label "WINPLC"). Some commands, if they have parameters, can be edited. If not, the edit button will be grayed (unavailable). A third button is the "execute" button, to start your program. You can stop your program at all times, by clicking this button again. While your program runs, you cannot modify the program or click the menu's.

This help file was created with the free trial version of HelpScribble.


Options & Setup

The WinPLC options menu allows you to do all settings, and is divided in 4 tabs:

Connection

Communication Port: used port to communicate with K8000

Remind me for K8001: shows a message about K8001 every time you start WinPLC

General

Maximum Performance: Don't automatically select the command that is executed

Allow Direct Card Access: Allow direct set/clear IO channels from the main screen

Show icon in system tray: hides WinPLC when minimized

Warn before opening webpages: shows a warning before opening links from the help menu

Switch to "variables" view during execution: shows the variables when executing a program

Allow external subroutine calling: allow other software to trigger winplc events

Startup

Register WinPLC files on startup: assign the .PLC filetype to WinPLC

Load last used program: load last used program when starting winplc

Execute loaded program: execute loaded program when starting winplc

Minimize on startup: minimize winplc when starting

Start WinPLC when windows starts: start winplc automatically

Program folders

Specify the location of the folder where to store the WinPLC files.

Startup

Program Folder

This help file was created with the free trial version of HelpScribble.


The subroutine wizard

The subroutine wizard can be used to create some kind of subroutines. Currently only one subroutine is supported: the SENDMAIL subroutine. This is a subroutine which can send an E-mail message. Just fill in all the parameters, and WinPLC will generate the code for the subroutine. Every time you call this subroutine, a mail will be send.

•	Your name: will appear in the FROM field of the E-mail

•	Your E-mail: will appear in the FROM field of the E-mail

•	Receiver name: the name of the person you want to mail

•	Receiver E-mail: the e-mail address of the person you want to mail

•	Subject: the subject of the mail message

•	Message: the actual message you need to send

•	Mailserver: the SMTP server you want to use

note you can enter variables in the message field

This help file was created with the free trial version of HelpScribble.


WinPLC Instruction Set

WinPLC has it's own instruction set, currently this is the instruction set "EN3". This set isn't compatible with the other instruction sets in previous versions of WinPLC (because they were DU1 and DU2, which stands for "Dutch Version 1" and "Dutch Version 2". Currently the instructions are sorted in 10 groups, by general purpose. You see a complete listing of these groups and their commands below.

Group 01: General Commands

This is a group for general commands. Some of them aren't even executable, like comments or empty lines. The group has 3 instructions in it: 2 interactive commands and one non - interactive command.

- [Empty Line]

- [Comment Line]

- STOP

- #DIRECTIVE_RUN_MAX_SPEED

Group 02:  Special Commands

This is one of the most powerful groups in WinPLC, which gives you access to commands you also can find in the well known programming languages like Visual Basic and C/C++. There are 8 commands in this group, 6 of them are interactive commands.

- SELECTCARD ?

- LABEL ?

- GOTO ?

- CALL ?

- SUB ?

- END SUB

- EXIT SUB

- LOGFILE = ?

- WRITELOG ?

- OPENFILE ?

- IF [condition] THEN ?

- ELSE

- END IF

Group 03:  WinPLC Control Commands

This is one of the most powerful groups in WinPLC, which gives you access to commands you also can find in the well known programming languages like Visual Basic and C/C++. There are 8 commands in this group, 6 of them are interactive commands.

- LOADGUI ?

- CHANGEGUI ?

- MINIMIZE

- MAXIMIZE

- UNLOADGUI

Group 04:  Program Variables

This group contains commands to manipulate program variables. They can be compared with the DAC variables, but they have a larger range (between 0 and 1023). You can use these variables to create program counters.

- TEXTVAR = ?

- VAR1 = ?

- VAR2 = ?

- VAR3 = ?

- VAR4 = ?

- VAR1 = VAR1 + ?

- VAR2 = VAR2 + ?

- VAR3 = VAR3 + ?

- VAR4 = VAR4 + ?

- VAR1 = VAR1 - ?

- VAR2 = VAR2 - ?

- VAR3 = VAR3 - ?

- VAR4 = VAR4 - ?

- ARRAY[VAR1] = ?

- ARRAY[VAR2] = ?

- ARRAY[VAR3] = ?

- ARRAY[VAR4] = ?

- ARRAY[VAR1] = ARRAY[VAR1] + ?

- ARRAY[VAR2] = ARRAY[VAR2] + ?

- ARRAY[VAR3] = ARRAY[VAR3] + ?

- ARRAY[VAR4] = ARRAY[VAR4] + ?

- ARRAY[VAR1] = ARRAY[VAR1] - ?

- ARRAY[VAR2] = ARRAY[VAR2] - ?

- ARRAY[VAR3] = ARRAY[VAR3] - ?

- ARRAY[VAR4] = ARRAY[VAR4] - ?

Group 05:  Digital Operations

The digital operations group contains commands which applies to the digital I/O channels. They are very commands, such as I/O shifters.

- SHIFTALLIO UP

- SHIFTALLIO DOWN

Group 06: Channel Start Commands

The channel starts group contains commands which all are relevant to starting channels. Group 5 and 6 have almost the same purpose, except the fact they are to STOP of INVERT channels. The group has 18 commands, only one of them is an interactive command. Channels which are configured as I/O input channels (in WinPLC) won't be set by these commands!

- SETALLIO

- SETION ?

- SETIO 01

- SETIO 02

- SETIO 03

- SETIO 04

- SETIO 05

- SETIO 06

- SETIO 07

- SETIO 08

- SETIO 09

- SETIO 10

- SETIO 11

- SETIO 12

- SETIO 13

- SETIO 14

- SETIO 15

- SETIO 16

Group 07: Channel Stop Commands

This group is almost the same as the "Channel Start Commands", except the commands here are to stop I/O channels. Channels which are configured as I/O input channels (in WinPLC) won't be cleared by these commands! The group has 18 commands, only one of them is an interactive command.

- CLEARALLIO

- CLEARION ?

- CLEARIO 01

- CLEARIO 02

- CLEARIO 03

- CLEARIO 04

- CLEARIO 05

- CLEARIO 06

- CLEARIO 07

- CLEARIO 08

- CLEARIO 09

- CLEARIO 10

- CLEARIO 11

- CLEARIO 12

- CLEARIO 13

- CLEARIO 14

- CLEARIO 15

- CLEARIO 16

Group 08: Channel Invert Commands

This group has commands to invert I/O channels. Inverting a channel means the status will be read, and turned around: a high output will become low and a low output will become high. Input channels won't be affected by the commands in this group. The group has 18 commands, only one of them is an interactive command.

- INVERTALLIO

- INVERTION ?

- INVERTIO 01

- INVERTIO 02

- INVERTIO 03

- INVERTIO 04

- INVERTIO 05

- INVERTIO 06

- INVERTIO 07

- INVERTIO 08

- INVERTIO 09

- INVERTIO 10

- INVERTIO 11

- INVERTIO 12

- INVERTIO 13

- INVERTIO 14

- INVERTIO 15

- INVERTIO 16

Group 09: Random Channels

This group has commands to randomize  I/O channels, which means channels will get a random state (you never know what state a channel will get). Input channels won't be affected by the commands in this group. The group has 20 commands, 2 of them are interactive.

- RANDOM = ?

- SETRANDOMIO

- CLEARRANDOMIO

- RANDOMION ?

- RANDOMIO 01

- RANDOMIO 02

- RANDOMIO 03

- RANDOMIO 04

- RANDOMIO 05

- RANDOMIO 06

- RANDOMIO 07

- RANDOMIO 08

- RANDOMIO 09

- RANDOMIO 10

- RANDOMIO 11

- RANDOMIO 12

- RANDOMIO 13

- RANDOMIO 14

- RANDOMIO 15

- RANDOMIO 16

Group 10: Memory Commands

This group of commands is meant to save the states of all the I/O outputs. You can recall that save then at a later time, keep in mind this memory will be lost if you restart WinPLC (it's stored in the RAM memory of your computer, not on the Hard Disk Drive). This command might dissapear in the future , because it's not very useful. The group has 17 commands, none of them is interactive.

- CLEAR

- SAVE LIGHT1

- SAVE LIGHT2

- SAVE LIGHT3

- SAVE LIGHT4

- SAVE LIGHT5

- SAVE LIGHT6

- SAVE LIGHT7

- SAVE LIGHT8

- LOAD LIGHT1

- LOAD LIGHT2

- LOAD LIGHT3

- LOAD LIGHT4

- LOAD LIGHT5

- LOAD LIGHT6

- LOAD LIGHT7

- LOAD LIGHT8

Group 11: Time Commands

Group 8 is very interesting and important for WinPLC, because you can set time intervals with this group: making WinPLC delay commands for a certain time, or just to wait a time before continuing to the next command. This group counts 4 commands, while 2 of them are interactive.

- WAIT ?

- TIMESTEP = ?

- TIMESTEP = TIMESTEP + ?

- TIMESTEP = TIMESTEP - ?

- TIMESTEP ON

- TIMESTEP OFF

Group 12: Analog Outputs

Group 12 is the only group that can work with analog channels (except group 2 - special commands - with the IF instruction). Currently there is only support for the 6 bit DAC output channels the interface card has (6 bits , which means 64 different output levels or a number of 0 to 63). There is something special in the command box, because this group is separated in 2 smaller groups, but WinPLC sees them as one single group. This group has 28 commands, 27 of them are interactive commands.

- CLEARALLDAC

- DAC01 = ?

- DAC02 = ?

- DAC03 = ?

- DAC04 = ?

- DAC05 = ?

- DAC06 = ?

- DAC07 = ?

- DAC08 = ?

- DACN = ?

- DA1 = VAR1

- DA2 = VAR1

- DA3 = VAR1

- DA4 = VAR1

- DAC01 = DAC01 + ?

- DAC02 = DAC02 + ?

- DAC03 = DAC03 + ?

- DAC04 = DAC04 + ?

- DAC05 = DAC05 + ?

- DAC06 = DAC06 + ?

- DAC07 = DAC07 + ?

- DAC08 = DAC08 + ?

- DAC01 = DAC01 - ?

- DAC02 = DAC02 - ?

- DAC03 = DAC03 - ?

- DAC04 = DAC04 - ?

- DAC05 = DAC05 - ?

- DAC06 = DAC06 - ?

- DAC07 = DAC07 - ?

- DAC08 = DAC08 - ?

Group 13: Networking Commands

Group 13 is an advanced group with networking commands. People without the right technical expertise proably won't be able to make applications with these commands. Group 11 allows you to connect to remote computers and send certain strings to those computers. This group counts 4 commands, with 2 interactive commands.

- CONNECT ?

- DISCONNECT

- SEND ?

- SENDEMPTY

Group 14: Stepmotor Commands

Group 14 is a group with stepmotor commands. These commands allow you to control the Velleman K8005 stepmotor module.

- STOPALLMOTORS

- SENDMOTOR ?

This help file was created with the free trial version of HelpScribble.


WinPLC variables

WinPLC contains 2 sort of variables: internal variables and external variables. Only the external variables can be used by you.

Internal variables

•	SP: StackPointer: count how deep subroutines are nested

•	EPR: Execution_Progress: keeps the current command number in the program

•	TSE: TimeStepEnabled: keeps the state of the timestep

•	TS: TimeStep: keeps the value of the timestep

•	SUB: CurrentSubroutine: keeps the name of the current subroutine

•	ISP: IFstackPointer: keeps the nesting level of IF statements

•	VAR: TextVAR: shows the contents of the textvar variable

•	EP: EventPointer: keeps the number of events that must be processed

•	DP: DataPointer: keeps the number of received data after establising a connection with CONNECT

•	DPL: DataPointer: keeps the latest received dataline

External variables

These variables can be used in several commands, like logging and internet sending.

•	$TIMESTEP

•	$ENTER: is the equivalent for an ENTER character (ascii code 10)

•	$TIME: the time in hh:mm format

•	$XTIME: the time in hh:mm:ss format

•	$DAY: the day of the month

•	$WEEK: the week of the year

•	$MONTH: the month of the year

•	$YEAR: the year

•	$DAYOFWEEK: the day of the week (0 ... 6)

•	$CONNECTED: the state of the internet-connection

•	$VAR1 ... $VAR4: the contents of the VAR variables

•	$IO01 ... $IO16: the state of the I/O channels

•	$AD01 ... $AD04: the value of the AD channels

•	$AD01/4 ... $AD04/4: the value of the AD channels, divided by 4

•	$DAC01 ... $DAC08: the value of the DAC channels

This help file was created with the free trial version of HelpScribble.


Group 01: [Empty Line]

command information:

Type	non-interactive

Timestep	no

Unique	no

The empty line command isn't a real WinPLC command which will be processed, it just adds an empty line to your program. This can help you to make your program more readable: you can separate different SUB routines by this command, for example. During execution time, this command will be skipped because it isn't a useful command. It also means the TIMESTEP variable has no effect on this line. An example of the empty line follows below:

//application that switches I/O channels on and off

//created by Vanderhaegen Bart

TIMESTEP = 1000

TIMESTEP ON

SETALLIO

CLEARALLIO

SETALLIO

CALL END

// program sub routine END, which stops execution.

SUB END

INVERTALLIO

STOP

END SUB

This help file was created with the free trial version of HelpScribble.


Group 01: [Comment Line]

command information:

Type	interactive

Timestep	no

Unique	no

The comment line is used to add comments to your WinPLC programs. Doing so, you won't forget what every piece of code was meant for. This is very useful, because you may always know what you are doing, but others don't. The comments line helps others to understand what certain functions are for, ... You are advised to put as many as possible comment lines to your program.

The comment line is an interactive command, so you will be prompted to enter extra parameters after you choose to insert this command to your program. A window above will show up to enter the parameters. In this case, this is only the comment you want to put on this line. Comments lines always start with // to let WinPLC know they are comments, this makes sure your comments won't be intepreted as WinPLC commands.

Dialog box to enter the comment line's parameters

In the example below, you can see some comments lines for a program. The program reads the temperature in a room, and waits until the temperature has reached a certain value before switching a lamp on.

// temperature check, which turns on a light after

// temperature has reached a minimum value.

//created by Vanderhaegen Bart

// go as soon as possible!

TIMESTEP OFF

// Loop which will be scrolled over and over again

// until value = 20. (this isn't 20 degrees, but the

// analog value between 0 and 255 which was read

// from the AD convertor input.

LABEL LOOP

IF AD01 < 020 THEN GOTO LOOP

// the temperature was ok, now switch the LAMP

// on. This lamp is attached to I/O channel 01.

STARTIO 01

// program execution halted

STOP

This help file was created with the free trial version of HelpScribble.


Group 01: STOP

command information:

Type	non-interactive

Timestep	no

Unique	no

The STOP command is the only command that can interrupt your K8000 program. When the command was executed, WinPLC will skip execution immedeately and reset all execution variables. The I/O and DAC output channels, however, won't be affected by this command. You will have to turn them on manuelly, or to make sure your program clears all those outputs before performing the STOP command. Stopping WinPLC itself from a WinPLC program isn't possible, you always have to quit WinPLC manuelly. Below you can see what happens within WinPLC when you start/stop your applications:

WinPLC program start initialisation

- update start button logo & caption

- checking the program if the SUB's are valid

- sets timestep to 750 milliseconds

- clear the DAC outputs

- disable the menu bar

- disable the control buttons

- disable the program box

- disable the commands box

- disables the analog variables list

- call the execution module

WinPLC program stop procedures

- enables the analog variables list

- enables the command box

- enables the program box

- enables the control buttons

- enables the menu bar

- update start button logo & caption

Below follows a short program that stops after the user has pressed a switch, which is attached to I/O channel 07. In the mean time, channel 01 to 04 will go on and off. Remark WinPLC isn't able to stop execution immedeately after channel 07 become high. It can take a second to stop, for the application below.

// timestep information

TIMESTEP = 1000

TIMESTEP ON

// Loop until channel seven is ON

LABEL CYCLE

// STOP WHEN IO07 = 1

IF IO07 = 1 THEN STOP

INVERTION 1111000000000000

GOTO CYCLE

This help file was created with the free trial version of HelpScribble.


Group 01: #DIRECTIVE_RUN_MAX_SPEED
Group 01: #DIRECTIVE RUN_MAX_SPEED

command information:

Type	non-interactive

Timestep	no

Unique	no

The #DIRECTIVE command allows you to give special instructions to WinPLC. For now, there is only directive available: #DIRECTIVE RUN_MAX_SPEED. This directive will cause WinPLC programs to execute as fast as possible.

Once you called the directive in a program, you cannot undo this call. You only have to call it once in a program, it's preferred to make this directive the first command in your programs.

This help file was created with the free trial version of HelpScribble.


Group 02: LABEL ?

command information:

Type	interactive

Timestep	no

Unique	yes

LABELS are used as the reference points to jump to with the GOTO command. It is a interactive command, which means it requires a parameter: the name for the label. A label needs a unique name, it can only be used once in the program. When you try to create a label that already exits, you will see a message that says the label is already in use. In that case, you will need to give an other name to your label. Labels are not affected by the TIMESTEP , as soon as the WinPLC execution module sees a label it skips the label like it does with the empty line and the comment line instructions.

Dialog box to enter a new label

In the example below, a construction is displayed which can select a certain state from an analog pressure meter. When the pressure is too high, a led will flash on (I/O 01). When the pressire is normal, I/O 02 will flash and when the pressure is too low I/O 03 will flash.

// Program to monitor a pressure meter on AD01

//	input level = 30 : normal

//	input level < 30 : to small

//	input level > 30 : to high

// set timestep

TIMESTEP = 1000

TIMESTEP OFF

// Main Loop

LABEL CYCLE

// check input

IF AD01 = 30 THEN GOTO L_NORMAL

IF AD01 < 30 THEN GOTO L_SMALL

IF AD01 > 30 THEN GOTO L_HIGH

LABEL L_NORMAL

CLEARION 1010000000000000

INVERTIO 02

GOTO CYCLE

LABEL L_HIGH

CLEARION 0110000000000000

INVERTIO 01

GOTO CYCLE

LABEL L_SMALL

CLEARION 1100000000000000

INVERTIO 03

GOTO CYCLE

This help file was created with the free trial version of HelpScribble.


Group 02: GOTO ?

command information:

Type	interactive

Timestep	no

Unique	no

A GOTO command makes the program jump to a certain LABEL. You always have to make sure the label you want to jump is available in the program, otherwise the GOTO will be ignored and time delayed but the execution module will not stop on the error. You are allowed to make multiple reference's to one label. When adding the command to your program, you will see a window like displayed below:

Dialog box to define a label jump

The example belows shows you and endless loop for an alarm system (connected to I/O 16), and the switch that triggers the alarm is connected to I/O 01. The user can turn the alarm off by disabling the system. The switch for this is connected to I/O 02.

// Alarm System by Vanderhaegen Bart

// 	trigger	: I/O 01

//	disabler	: I/O 02

//	sirene	: I/O 16

// don't use the timestep

TIMESTEP OFF

// wait for a trigger for the alarm

LABEL BEGIN

CLEARIO 16

LABEL CYCLE

IF IO02 = 1 THEN GOTO ALERT

IF IO01 = 1 THEN GOTO ALERT

GOTO CYCLE

// System alerted

LABEL ALERT

// stop if user interrupted alarm

IF IO02 = 1 THEN STOP

// enables alarm

SETIO 16

// wait for user to disable alarm

LABEL ALERTLOOP

IF IO02 = 1 THEN STOP

GOTO ALERTLOOP

This help file was created with the free trial version of HelpScribble.


Group 02: CALL ?

command information:

Type	interactive

Timestep	no

Unique	no

CALL statements are related to SUB routines, which includes the SUB , END SUB and EXIT SUB statements. To get a clear picture of making subroutines, you should also read about those commands.

WinPLC offers you the ability to divide your program into subroutines: splitting your program into smaller pieces of code. Doing this, has a lot of great advantages for your programs because you can make it smaller ánd more readable. Subroutines can be compared with WinPLC commands, but commands that you can create at your own. The only difference between a WinPLC function and your userdefined function is you can't pass parameters to the function, also your functions always must start with the CALL statement. WinPLC wouldn't recognize your commands with the CALL statement. A SUB routine starts with the SUB statement, and ends with the END SUB statement. If you don't end the SUB, you will get an error from WinPLC. The routines between these 2 statements will belong to the SUB routine, with the name "DEMO" for the example below:

SUB DEMO

...

...

...

...

END SUB

Restrictions

+ a subroutine MUST be closed with an END SUB, otherwise you get an error message.

+ you can't create a SUB in a SUB.

+ you can't use an END SUB without a SUB.

+ you can't call a SUB from within a SUB.

SUB Handling

When the WinPLC run module sees a SUB routine during execution (a SUB statement), it jumps to the end of the SUB routine. This means the commands in the SUB won't be executed unless you have called the SUB. When you call a sub , WinPLC will perform default actions:

+ remember the position of the CALL statement in the program

+ jump to the subroutine

+ resume program execution in the subroutine

+ when the subroutine ends (or the user gave the EXIT SUB command), the program jumps back to the command after the CALL statement.

Why using subroutines?

Sometimes you have a lot of the same code, which occurs a few times in the program. You can centralize this code into a subroutine, and call the subroutine a few times. This is obviously a way to reduce program memory and your program will be more readable.

example 1

The first example shows a big code with pieces that are always the same. The second example will show how to reduce the program and make it more readable. Hint: make use of the horizontal movement possibilities for commands.

// program where the user must press a button

// three times before the door opens. The switch

// is connected to I/O 08.

// first press detect

LABEL LOOP1

// wait for the switch to become high

IF IO08 = 1 THEN GOTO LOOP2

GOTO LOOP1

LABEL LOOP2

// wait for the switch to become low

IF IO08 = 0 THEN GOTO LOOP3

GOTO LOOP2

// second press detect

LABEL LOOP3

// wait for the switch to become high

IF IO08 = 1 THEN GOTO LOOP4

GOTO LOOP3

LABEL LOOP4

// wait for the switch to become low

IF IO08 = 0 THEN GOTO LOOP5

GOTO LOOP4

// third press detect

LABEL LOOP5

// wait for the switch to become high

IF IO08 = 1 THEN GOTO LOOP5

GOTO LOOP5

LABEL LOOP6

// wait for the switch to become low

IF IO08 = 0 THEN GOTO LOOP7

GOTO LOOP6

// OPENS THE DOOR!

SETIO 01

example 2

You can see this program is much more easier to understand as the previous one. So make use of subroutines, they can help you a lot!

// user must press buttons 3 times

CALL WAIT_PRESS

CALL WAIT_UNPRESS

CALL WAIT_PRESS

CALL WAIT_UNPRESS

CALL WAIT_PRESS

CALL WAIT_UNPRESS

// open door

SETIO 01

SUB WAIT_PRESS

LABEL WPLOOP

IF IO08 = 0 THEN EXIT SUB

GOTO WPLOOP

END SUB

SUB WAIT_UNPRESS

LABEL WUPLOOP

IF IO08 = 0 THEN EXIT SUB

GOTO WPULOOP

END SUB

This help file was created with the free trial version of HelpScribble.


Group 02: SUB ?

command information:

Type	interactive

Timestep	no

Unique	yes

SUB statements are related to SUB routines, which includes the CALL , END SUB and EXIT SUB statements. Check those commands for more information about SUB routines. The name of a SUB routine must be unique, labels in a subroutine must also be unique in the whole program.

creating subroutines

This help file was created with the free trial version of HelpScribble.


Group 02: END SUB

command information:

Type	non-interactive

Timestep	no

Unique	no

END SUB statements are related to subroutines, which includes the SUB , END SUB and EXIT SUB statements. Check those commands for more information about SUB routines

This help file was created with the free trial version of HelpScribble.


Group 02: EXIT SUB

command information:

Type	non-interactive

Timestep	no

Unique	no

EXIT SUB statements are related to subroutines, which includes the SUB , END SUB and EXIT SUB statements. Check those commands for more information about SUB routines. An EXIT SUB statement will exit the current subroutine, even if it the routine isn't completed yet. This will mostly be used in IF constructions inside subroutines.

This help file was created with the free trial version of HelpScribble.


Group 02: OPENFILE ?

command information:

Type	interactive

Timestep	yes

Unique	no

The OPENFILE is a replacement for the old WinPLC's DU1.0 language set command "SOUND". The SOUND isn't supported anymore in WinPLC because it made WinPLC hang while a sound was playing. To play sounds (the main reason why OPENFILE was created), you can use this new OPENFILE command. The command is capable to open files with their default reader. This means you can give the command to WinPLC to open any audiofile like *.MP3, *.WAV, *.MID, *.WMA, where WinPLC only supported wave files back in the old days. When the default player for a format isn't installed, WinPLC will skip the command (the timestep, however, will still have affect on the OPENFILE statement).

WinPLC will prompt you to enter a file to open

The example below will play a little sirene on your computer when someone came in the door of a little store around the corner. This is sensored with a infrared beam that is connected to I/O channel 03. Note: WinPLC cannot stop the sound once it started playing.

// set the timestep off

TIMESTEP OFF

// cycle for sound

LABEL BEGIN

IF IO03 = 1 THEN CALL ALERT

GOTO BEGIN

// subroutine alert

SUB ALERT

OPENFILE "C:\SIRENE.WAV"

// wait until the beam isn't interrupted anymore

LABEL LOOP

IF IO03 = 1 THEN GOTO LOOP

END SUB

This help file was created with the free trial version of HelpScribble.


Group 02: IF [condition] THEN ?

command information:

Type	interactive

Timestep	no

Unique	no

IF statements are thé power of WinPLC, which make WinPLC what it is. The principle of an IF statement is, that a command only will be executed if a certain condition is true. The picture below will give you a good idea about the principle of the IF command.

At the left, you see possible IF conditions which will be checked during execution if they are true or false. When the condition is true, the command in the right list box will be executed during execution time. Almost every normal WinPLC command is available here, except the commands [Empty Line] and a [Comment Line]. (it just isn't useful have them listed here). Also, you don't have an IF statement available here in this box. This means you only can use one IF statement in a program line.

You can choose to use only an IF condition. In this case, you don't have to select a command that must be executed if the condition is true. Such IF constructions must be ended with the END IF command. If the condition is true, the complete code between IF and END IF is executed. If the condition is false, WinPLC skips to the END IF statement.

As condition, you can:

1. Check if a certain I/O channels is high or low. This condition cannot be changed, since they don't use variables.

2 Check the value of an DAC channel, like:  IF DAC01 = 10 THEN or IF DAC01 > 10 THEN or IF DAC01 < 10 THEN. This means you can compare (equal? greater than? smaller than?) a DAC channel with a fixed value (it is not possible to compare with another variable yet). The third possible conditions are AD related (analog/digital convertor). They work the same as normal DAC conditions but since the AD channels are 8 bit, you can compare with a number between 0 and 254.

3. Check the time, like IF TIME = 12:20 THEN. Where the command will be executed if the current time match with a preset value. It is also possible to perform an action if the current time doesn't match with a preset value: IF TIME != 12:20 THEN.

4. Check the time, like IF XTIME = 12:20:20 THEN. Where the command will be executed if the current time match with a preset value. It is also possible to perform an action if the current time doesn't match with a preset value: IF TIME != 12:20:20 THEN. The difference between TIME and XTIME is that XTIME also work with the seconds, where the regular IF TIME doesn't.

5. Check the day, like IF DAY = 20 THEN. The command will be executed here if the given day equals to the current day of the month. It's also possible to perform an action when the day doesn't equal to the preset day: IF DAY != 20 THEN.

6. Check the week, like IF WEEK = 20 THEN. The command will be executed here if the given day equals to the current week of the year. It's also possible to perform an action when the week doesn't equal to the preset week: IF WEEK != 20 THEN.

7. Check the month, like IF MONTH = 05 THEN. The command will be executed here if the given month equals to the current month of the year. It's also possible to perform an action when the month doesn't equal to the preset month: IF MONTH != 05 THEN.

8. Check the year, like IF YEAR = 2002 THEN. The command will be executed here if the given year equals to the current year. It's also possible to perform an action when the year doesn't equal to the preset year: IF YEAR != 2002 THEN.

9. Check the day of the week (Monday, Tuesday, ...), like IF DAYOFWEEK = 3 THEN. The command will be executed here if the given day of the week equals to the current day of the week. This day is represented by a number: Sunday = 1 , Saturday = 7.. It's also possible to perform an action when the year doesn't equal to the preset day of the week: IF DAYOFWEEK != 3 THEN.

10. Check the internal WinPLC variables, like IF VAR1 = 0005 THEN. These variables can be checked on a value between 0 and 1023. You can use these variables for program counters etc.

11. Check if a certain key on the keyboard was pressed:  IF KEYPRESSED = 030 THEN. This means the command will be executed when you press the key with ASCII code 30 on the keyboard. Almost every keys can be used to perform this action. It's also possible to check if a key is NOT pressed on the keyboard: IF KEYPRESSED != 030 THEN. When using this command, you'll get a little window where you can press any key of the keyboard (or the mouse!). WinPLC will automatically determine what the ASCII code for this key is.

11. Check if WinPLC is connected to an external server:  IF CONNECTED = 1 THEN or IF CONNECTED = 0 THEN. The connected variable is "1" if WinPLC is connected, otherwise the variable is 0. You can connect WinPLC to an external server with the CONNECT command.

12. Check if the incoming data from an external server is equal to the TEXTVAR variable, or not: IF INDATA = TEXTVAR THEN or IF INDATA != TEXTVAR THEN. You need to set the TEXTVAR variable before checking this condition. INDATA represents the incoming data which was received, after making an external connection with the CONNECT command. This data is received in an buffer, an can only be read by executing this command. After performing this check, the data will be deleted from the buffer. If the buffer is empty, the INDATA variable is equal to an empty string: "".

12. Check if the incoming data from an external server contains a certain text: IF INDATA isin TEXTVAR THEN or IF TEXTVAR isin INDATA THEN. These commands check if a certain substring exists in the TEXTVAR or INDATA variables. You need to set the TEXTVAR variable before checking this condition. INDATA represents the incoming data which was received, after making an external connection with the CONNECT command. This data is received in an buffer, an can only be read by executing this command. After performing this check, the data will be deleted from the buffer. If the buffer is empty, the INDATA variable is equal to an empty string: "".

main window

set DAC compare level

set AD compare level

Set time

Choose key on the keyboard

This help file was created with the free trial version of HelpScribble.


Group 02: SELECTCARD ?

command information:

Type	interactive

Timestep	no

Unique	no

The K8000 allows a master/slave configuration with 3 other K8000 interface cards. This gives you a range of 64 I/O channels, 32 DAC channels, 4 DA channels and 16 AD channels. With the SELECTCARD command, you can select the current active card. All other commands will apply on that command then.

Dialog box to select the active K8000 card

The example belows shows how to light up channels on more than one K8000 card.

// K8000 multiple card sample

// don't use the timestep

TIMESTEP OFF

// set channels on card 1

SELECTCARD 1

SETIO 02

SETIO 03

// set channels on card 3

SELECTCARD 3

SETIO 02

SETIO 03

This help file was created with the free trial version of HelpScribble.


Group 02: ELSE

command information:

Type	non-interactive

Timestep	no

Unique	no

The ELSE can be used to define what actions should be performed when the result of a certain IF check is NOT true. You always need to use the following construction:

IF [condition] THEN

// ... code to execute when condition = true

ELSE

// ... code to execute when condition = false

END IF

First, the condition will be checked. If the condition is true, WinPLC runs the code between the IF and the ELSE. When the execution reaches the ELSE, a jump to the END if will occur. If the condition is false, WinPLC runs the code between the ELSE and the END if. Multiple lines commands can be added between IF and ELSE, and between ELSE and END IF.

The example belows shows how to use this command.

// don't use the timestep

TIMESTEP OFF

// set channels on card 1

IF IO01 = 1 THEN

// IO01 = 1

SETIO 02

ELSE

// IO01 = 0

CLEARIO 02

END IF

This help file was created with the free trial version of HelpScribble.


Group 02: END IF

command information:

Type	non-interactive

Timestep	no

Unique	no

The END IF defines the end of an IF ... END IF block. The code inside this block (scope) will only be executed if the [condition] is TRUE. If the condition is false, WinPLC jumps to the END IF statement OR to the ELSE statement, if there is any. You can add as many commands as you want within these slopes, including other IF constructions.

IF [condition] THEN

// ... code to execute when condition = true

ELSE

// ... code to execute when condition = false

END IF

The example belows shows how to use this command.

// don't use the timestep

TIMESTEP OFF

// set channel 2?

IF IO01 = 1 THEN

// IO01 = 1

SETIO 02

ELSE

// IO01 = 0

CLEARIO 02

END IF

This help file was created with the free trial version of HelpScribble.


Group 02: LOGFILE = ?

command information:

Type	interactive

Timestep	no

Unique	no

The "LOGFILE" variable, is a WinPLC variable which allows you to assign a logfile to your program. A logfile is a file you can append text to, so important events can be logged. You need to set this variable before you can use logging. If you want to change the logfile during execution, use this "LOGFILE = ?" command again. To write data to the logfile, use the WRITELOG ? command.

The example belows shows how to use logging:

// K8000 logging example

LOGFILE = "C:\k8000 logfile.log"

WRITELOG "logfile initiated at $time on $date"

// write your code here ...

IF IO01 = 1 THEN

WRITELOG "IO channel 01 is on ($io01)"

END IF

This help file was created with the free trial version of HelpScribble.


Group 02: WRITELOG ?

command information:

Type	interactive

Timestep	no

Unique	no

The "WRITELOG ?" command allows you to append a logstring to the WinPLC logfile. (This logfile must be set with the "LOGFILE = ?" command). With every "WRITELOG ?" command, new data will be appended to the end of this logfile. It's also possible to use variables names in the logstring. WinPLC will replace these variables names by the variable contents during execution of the code.

The example belows shows how to use logging.

// K8000 logging example

LOGFILE = "C:\k8000 logfile.log"

WRITELOG "logfile initiated at $time on $date"

// write your code here ...

IF IO01 = 1 THEN

WRITELOG "IO channel 01 is on ($io01)"

END IF

This help file was created with the free trial version of HelpScribble.


Group 03: LOADGUI ?

command information:

Type	interactive

Timestep	no

Unique	no

This is a command to load a user defined GUI (graphical user interface) in memory: your own custom Window. This custom window can be build using the GUI editor (menu extra\GUI Editor). This .GUI information is stored in external files, with the .GUI extension. With the LOADGUI ? command, this information can be loaded into WinPLC memory. After using this command, your user defined form will appear. You can move/minimize this window, but you cannot close it. To hide it, stop your program or use the UNLOADGUI command. You can also modify an open GUI using the CHANGEGUI ? command.

The example belows shows how to open a GUI file, and to close it:

LOADGUI "C:\MYWINDOW.GUI"

WAIT 2000

CLOSEGUI

This help file was created with the free trial version of HelpScribble.


Group 03: CHANGEGUI ?

command information:

Type	interactive

Timestep	no

Unique	no

This is a command to change a user defined GUI. You can change the name of the buttons, or the title bar of this Window. This command only can be used if a GUI is loaded into memory by the LOADGUI ? command. It's possible to use variables{linkID=4010}for the form and button names.

the interface of the changeGUI screen

The example belows shows how to open a GUI file, set the title bar to the current time, and to close it.

LOADGUI "C:\MYWINDOW.GUI"

CHANGEGUI 0 "WinPLC - starttime is $time"

WAIT 2000

CLOSEGUI

This help file was created with the free trial version of HelpScribble.


Group 03: MINIMIZE

command information:

Type	interactive

Timestep	no

Unique	no

This command minimizes WinPLC itself. This command was introduced to get rid of WinPLC when the user defined GUI is showed. Use the MAXIMIZE command to maximize the window again.

The example belows shows how to open a GUI file, set the title bar to the current time, and to close it.

LOADGUI "C:\MYWINDOW.GUI"

MINIMIZE

CHANGEGUI 0 "WinPLC - starttime is $time"

WAIT 2000

UNLOADGUI

This help file was created with the free trial version of HelpScribble.


Group 03: MAXIMIZE

command information:

Type	interactive

Timestep	no

Unique	no

This command maximizes WinPLC itself. Use the MINIMIZE command to minimize the window again.

The example belows shows how to open a GUI file, set the title bar to the current time, and to close it. WinPLC is hidden during the execution.

LOADGUI "C:\MYWINDOW.GUI"

MINIMIZE

CHANGEGUI 0 "WinPLC - starttime is $time"

WAIT 2000

UNLOADGUI

MAXIMIZE

This help file was created with the free trial version of HelpScribble.


Group 03: UNLOADGUI

command information:

Type	interactive

Timestep	no

Unique	no

This command unloads the user defined GUI from memory. This GUI must first be loaded by the LOADGUIcommand. The example belows shows how to open a GUI file, and then close it.

LOADGUI "C:\MYWINDOW.GUI"

UNLOADGUI

This help file was created with the free trial version of HelpScribble.


Group 04: TEXTVAR = ?

command information:

Type	interactive

Timestep	no

Unique	no

This command allows you to set the TEXTVAR command. This is the only WinPLC command which can contain textual values. The variable can only be used in IFstatements. You can use variable names in the TEXTVAR. They will be replaced by their values during program runtime.

TEXTVAR = "$timestep"

TEXTVAR = "testing WinPLC ..."

This help file was created with the free trial version of HelpScribble.


Group 04: VAR1 = ? ... VAR4 = ?

command information:

Type	interactive

Timestep	no

Unique	no

WinPLC contains 4 variables, with a value range between 0 and 1023. The VAR1 = ? and VAR4 = ? commands can be used to assign a value to this variable. This value can be a number, or the value of another variable.

the interface of the variable screen

This example shows how to assign a value to a variable, and to copy the contents of one variable into another variable.

VAR1 = 10

VAR2 = VAR1

This help file was created with the free trial version of HelpScribble.


Group 04: VAR1 = VAR1 + ? ... VAR4 = VAR4 + ?

command information:

Type	interactive

Timestep	no

Unique	no

These commands can be used to increase the value of a certain variable with a fixed value, of a value which is stored into another variable.

the interface of the variable screen

This example shows how to assign a value to a variable, and to increase it with another value.

VAR1 = 10

VAR2 = VAR1 + 10

VAR1 = 20

This help file was created with the free trial version of HelpScribble.


Group 04: VAR1 = VAR1 - ? ... VAR4 = VAR4 -?

command information:

Type	interactive

Timestep	no

Unique	no

These commands can be used to decrease the value of a certain variable with a fixed value, of a value which is stored into another variable.

the interface of the variable screen

This example shows how to assign a value to a variable, and to decrease it with another value.

VAR1 = 10

VAR2 = VAR1 - 10

VAR1 = 20

This help file was created with the free trial version of HelpScribble.


Group 04: ARRAY[VAR1]=? ... ARRAY[VAR4]
Group 04: ARRAY[VAR1]=? ... ARRAY[VAR4]=?

command information:

Type	non-interactive

Timestep	no

Unique	no

Starting from WinPLC 6.5, the program now supports the use of arrays. An array can be compared to a table, having a certain number of rows and columns. Each "cell" of the table can be filled with data.

The arrays in WinPLC are tables with 1024 rows and only one column. A WinPLC developper can fill up the table and put numerical data in each of those 1024 rows. Each row is identified by a unique number, called "the index". You can see an example of an array below:

ARRAY[0]=5	' value at index 0

ARRAY[1]=6	' value at index 1

ARRAY[2]=8	' value at index 2

ARRAY[3]=12	' value at index 3

ARRAY[4]=25	' value at index 4

...

ARRAY[1023]=122	' value at index 1023

The array in WinPLC allows you to store up to 1024 numbers, one at each index.

It isn't possible to specify the index number directly in WinPLC. The desired index number to access, must be put in one of the variables VAR1, VAR2, VAR3 or  VAR4. For setting a value at index 10 of the array, you have to use:

VAR1=10	' set the index to 10

ARRAY[VAR1]=125	' put some data at index 10

VAR1 can be called a pointer value. Because its value points to the desired index in the array.

Example: show how you can fill up the complete array

VAR1=0

LABEL LOOP

IF VAR1 <1024 THEN

ARRAY[VAR1]=10

VAR1=VAR1+1

GOTO LOOP

END IF

This help file was created with the free trial version of HelpScribble.


Group 04: ARRAY[VAR1]=ARRAY[VAR1]+? ... ARRAY[VAR1]=ARRAY[VAR1]-?
Group 04: ARRAY[VAR1]=ARRAY[VAR1]+? ... ARRAY[VAR4]=ARRAY[VAR4]+?

command information:

Type	non-interactive

Timestep	no

Unique	no

These commands can be used to increase the value of a certain value in an array variable with a fixed value, of a value which is stored into another variable.

the interface of the variable screen

This example shows how to assign a value to the pointer VAR1, and increase the value at that index in the array

VAR1 = 10	// use index 10

ARRAY[VAR1]=12

ARRAY[VAR1]=ARRAY[VAR1]+10	// increase the value at index 10 with 10

This help file was created with the free trial version of HelpScribble.


Group 04: ARRAY[VAR1]=ARRAY[VAR1]-? ... ARRAY[VAR4]=ARRAY[VAR4]-?

command information:

Type	non-interactive

Timestep	no

Unique	no

These commands can be used to decrease the value of a certain value in an array variable with a fixed value, of a value which is stored into another variable.

the interface of the variable screen

This example shows how to assign a value to the pointer VAR1, and decrease the value at that index in the array

VAR1 = 10	// use index 10

ARRAY[VAR1]=12

ARRAY[VAR1]=ARRAY[VAR1]-10	// decrease the value at index 10 with 10

This help file was created with the free trial version of HelpScribble.


Group 06: SETALLIO

command information:

Type	non-interactive

Timestep	yes

Unique	no

The command SETALLIO will set all the I/O channels on your interface card, except the channels configured as digital inputs. This command is affected by the TIMESTEP. The example below shows how to set I/O channel 1 to 16, and the use of the SETALLIO.

// example: set the IO channels

SETALLIO

// example 2: set the IO channels as soon as possible one by one

// very large coding!!!

TIMESTEP OFF

SETIO 01

SETIO 02

SETIO 03

SETIO 04

SETIO 05

SETIO 06

SETIO 07

SETIO 08

SETIO 09

SETIO 10

SETIO 11

SETIO 12

SETIO 13

SETIO 14

SETIO 15

SETIO 16

This help file was created with the free trial version of HelpScribble.


Group 06: SETION ?

command information:

Type	interactive

Timestep	yes

Unique	no

The command SETION will set all the I/O channels you want on your interface card in a single command, except the channels configured as digital inputs. This command is affected by the TIMESTEP. The example below shows how to set I/O channel 1 to 5.

// set the IO channels

SETION 1111100000000000

The command is interactive, and requires a parameter: the channels you want to set. This is a string of 16 digital numers (1 , represents "channel on". 0, represents "channel off"). The dialog window you can set this with, is listed underneath this text. Channels you check here, will be set, others will be unset. Hint: use the command to make lightcomputers.

selecting channels for the SETION command

This help file was created with the free trial version of HelpScribble.


Group 06: SETIO 01 ... SETIO 16

command information:

Type	non-interactive

Timestep	yes

Unique	no

The commands SETIO 01 to SETIO 16 sets a channels between 1 and 16. There is not much to say about this command, except the fact digital inputs won't be affected by this command. The  command can be delayed with the timestep!

This help file was created with the free trial version of HelpScribble.


Group 05: SHIFTALLIO UP

command information:

Type	non-interactive

Timestep	yes

Unique	no

The SHIFTALLIO UP command will shift all the I/O channels upwards. This means there will be a rotation in the outputs: every output n gets the value of the LED n - 1 (n is a number between 1 and 64). This command is affected by the TIMESTEP. The example below shows how you can use the command.

// example: clears the IO channels

CLEARALLIO

SETIO 01	// I/O 01 will light up

SHIFTALLIO UP	// IO 02 will now light up, it gets the value of IO 01

SHIFTALLIO UP	// IO 03 will now light up, it gets the value of IO 02

This help file was created with the free trial version of HelpScribble.


Group 07: CLEARALLIO

command information:

Type	non-interactive

Timestep	yes

Unique	no

The command CLEARALLIO will clear all the I/O channels on your interface card, except the channels configured as digital inputs. This command is affected by the TIMESTEP. The example below shows how to clear I/O channel 1 to 16, and the use of the CLEARALLIO.

// example: clears the IO channels

CLEARALLIO

// example 2: clear the IO channels as soon as possible one by one

// very large coding!!!

TIMESTEP OFF

CLEARIO 01

CLEARIO 02

CLEARIO 03

CLEARIO 04

CLEARIO 05

CLEARIO 06

CLEARIO 07

CLEARIO 08

CLEARIO 09

CLEARIO 10

CLEARIO 11

CLEARIO 12

CLEARIO 13

CLEARIO 14

CLEARIO 15

CLEARIO 16

This help file was created with the free trial version of HelpScribble.


Group 07: CLEARION ?

command information:

Type	interactive

Timestep	yes

Unique	no

The command CLEARION ? will clear all the I/O channels you want on your interface card in a single command, except the channels configured as digital inputs. This command is affected by the TIMESTEP. The example below shows how to clear I/O channel 1 to 5.

//clear the IO channels

CLEARION 1111100000000000

The command is interactive, and requires a parameter: the channels you want to clear. This is a string of 16 digital numers (1 , represents "channel off". 0, represents "channel unchanged"). The dialog window you can set this with, is listed underneath this text. Channels you check here, will be set, others will stay unchanged.

selecting channels for the CLEARION command

This help file was created with the free trial version of HelpScribble.


Group 07: CLEARIO 01 ... CLEARIO 16

command information:

Type	non-interactive

Timestep	yes

Unique	no

The commands CLEARIO 01 to CLEARIO 16 clears a channels between 1 and 16. There is not much to say about this command, except the fact digital inputs won't be affected by this command. The  command can be delayed with the timestep!

This help file was created with the free trial version of HelpScribble.


Group 05: SHIFTALLIO DOWN

command information:

Type	non-interactive

Timestep	yes

Unique	no

The SHIFTALLIO DOWN command will shift all the I/O channels downwards. This means there will be a rotation in the outputs: every output n gets the value of the LED n + 1 (n is a number between 1 and 64). This command is affected by the TIMESTEP. The example below shows how you can use the command.

// example: clears the IO channels

CLEARALLIO

SETIO 10	// IO 10 will light up

SHIFTALLIO DOWN	// IO 09 will now light up, it gets the value of IO 10

SHIFTALLIO DOWN	// IO 08 will now light up, it gets the value of IO 09

This help file was created with the free trial version of HelpScribble.


Group 08: INVERTALLIO

command information:

Type	non-interactive

Timestep	yes

Unique	no

The command INVERTALLIO will invert all the I/O channels on your interface card, except the channels configured as digital inputs. This command is affected by the TIMESTEP.

// example: inverts the IO channels

INVERTALLIO

This help file was created with the free trial version of HelpScribble.


Group 08: INVERTION ?

command information:

Type	interactive

Timestep	yes

Unique	no

The command INVERTION ? will invert all the I/O channels you want on your interface card in a single command, except the channels configured as digital inputs. This command is affected by the TIMESTEP. The example below shows how to invert I/O channel 1 to 5.

//invert the IO channels

INVERTION 1111100000000000

The command is interactive, and requires a parameter: the channels you want to invert. This is a string of 16 digital numers (1 , represents "channel off". 0, represents "channel unchanged"). The dialog window you can set this with, is listed underneath this text. Channels you check here, will be inverted, others will stay unchanged.

selecting channels for the INVERTION command

This help file was created with the free trial version of HelpScribble.


Group 08: INVERTIO 01 ... INVERTIO 16

command information:

Type	non-interactive

Timestep	yes

Unique	no

The commands INVERTIO 01 to INVERTIO 16 inverts a channels between 1 and 16. There is not much to say about this command, except the fact digital inputs won't be affected by this command. The  command can be delayed with the timestep!

This help file was created with the free trial version of HelpScribble.


Group 09: RANDOM = ?

command information:

Type	interactive

Timestep	no

Unique	no

This command will give a value to the RANDOM variable, which serves several different purposes in the random commands group. The variable is a number between 1 and 16, and isn't delayed by the timestep command. See the other commands like SETRANDOMIO, CLEARRANDOMIO, RANDOMIO 01 ... RANDOMIO 16 and RANDOMIO ? for the specific use of the RANDOM command. The example below shows the use of the variable to set a random channel.

// set the random variable to 12

RANDOM = 12

// set a channel between IO 01 and IO 12

SETRANDOMIO

This help file was created with the free trial version of HelpScribble.


Group 09: SETRANDOMIO

command information:

Type	non-interactive

Timestep	yes

Unique	no

This command will set a random I/O channel between I/O 01 and I/0 RANDOM , where random represents the number of the maximum channel that can be set. For example, if you assign 4 to the random-variable, and use the SETRANDOMIO a channel between 1 and 4 will be started. The example below shows how you can start a random channel on your card where any channel can become active

// set the random variable to 16. This means

// all 16 I/O channels

RANDOM = 16

// set a random channel.

SETRANDOMIO

This help file was created with the free trial version of HelpScribble.


Group 09: CLEARRANDOMIO

command information:

Type	non-interactive

Timestep	yes

Unique	no

This command will clear a random I/O channel between I/O 01 and I/0 RANDOM , where random represents the number of the maximum channel that can be clear. For example, if you assign 5 to the random-variable, and use the CLEARRANDOMIO a channel between 1 and 5 will be stopped. The example below shows how you can clear a random channel on your card where any channel can become inactive. It's also possible nothing happens: the randomizer can pick a channel that is already disabled.

// set the random variable to 16. This means

// all 16 I/O channels

RANDOM = 16

// clears  a random channel.

SETRANDOMIO

This help file was created with the free trial version of HelpScribble.


Group 09: RANDOMIO 01 ... RANDOMIO 16

command information:

Type	non-interactive

Timestep	yes

Unique	no

This command will assign a random state to one of the 16 I/O channels as you specified. The chance for the specified channel to become one, is 1 / RANDOM. This means , how higher the value of the randomvariable, how lower the chance for the channel to become one. The RANDOMIO will not affect channels which are configured as inputs in WinPLC. Timestep is supported by this command.

The example below shows an application for an anti burglary system: a subroutine will give a random state to all the lights in the house. The time intervals for this system depends on the user who is calling this subroutine from his program.

// set the random variable to 16. This means

// all 16 I/O channels

SUB RANDOMIZE

// chance for the lights to become one is 25 %

RANDOM = 4

// give random states to the lights in the house

RANDOMIO 01

RANDOMIO 04

RANDOMIO 08

RANDOMIO 12

END SUB

This help file was created with the free trial version of HelpScribble.


Group 09: RANDOMION ?

command information:

Type	non-interactive

Timestep	yes

Unique	no

This command give the selected channels a random state (on or off). The chance for a selected channel to become high is 1/RANDOM. This means, how lower the RANDOM variable, how more chance there is for the channel to become active. When RANDOM is equal to 1, the channels always become high.

This help file was created with the free trial version of HelpScribble.


Group 10: CLEAR

command information:

Type	non-interactive

Timestep	yes

Unique	no

The CLEAR command clears the memory buffer for the digital I/O channels. There are 8 memories which can be used to remember the current state of the I/O channels. This command applies to the SAVE LIGHT and LOAD LIGHT commands.

This help file was created with the free trial version of HelpScribble.


Group 10: SAVE LIGHT1 ... SAVE LIGHT8

command information:

Type	non-interactive

Timestep	yes

Unique	no

The SAVE command will write the complete state of all the I/O channels to a memory buffer. Even if the I/O channels changes afterwards, you can still recall the saved state with the LOAD LIGHT command. The command is non-interactive, and the timestep has affect on the command. WinPLC has eight memory locations available to store these commands. The command always work together with the LOAD LIGHT statements, and the CLEAR.

The example below shows an application which toggles between 2 predefined output configurations, they have a random state.

// set the random variable. It isn't set too high to prevent

// almost no leds are active. the chance for a channel to

// be one is here 25 % (1/4)

RANDOM = 4

// generates random outputs and save them to memory

RANDOMION 1111111111111111

SAVE LIGHT1

RANDOMION 1111111111111111

SAVE LIGHT2

// cycle over and over again

TIMESTEP = 500

LABEL LOOP

LOAD LIGHT1

LOAD LIGHT2

GOTO LOOP

This help file was created with the free trial version of HelpScribble.


Group 10: LOAD LIGHT1 ... LOAD LIGHT8

command information:

Type	non-interactive

Timestep	yes

Unique	no

The LOAD command will read the complete state of all the I/O channels from a memory buffer. WinPLC has eight memory locations available to store these commands. The command always work together with the SAVE LIGHT statements, and the CLEAR so you should read about those commands. An example is available for the SAVE LIGHT command.

This help file was created with the free trial version of HelpScribble.


Group 11: WAIT ?

command information:

Type	interactive

Timestep	no

Unique	no

The WAIT command halts the program execution for a certain time. In the meantime, you are still allowed to press the stop button and interrupt execution. The parameter for this command is the time, in milliseconds. This must be a number between 0 and 30000 ms. TIP: 1000 milliseconds is 1 second. The timestep doesn't apply to this command.

// wait 2 seconds

WAIT 2000

// start a buzzer on channel 14

SETIO 14

// wait 10 seconds

WAIT 10000

// set DAC channel 01 to a level of 23

DAC01 = 23

This help file was created with the free trial version of HelpScribble.


Group 11: TIMESTEP = ?

command information:

Type	interactive

Timestep	no

Unique	no

The timestep is a very interesting command, because it allows you to set the duration time for each line in your program. WinPLC will execute the lines in your program, and afterwards it wait for a certain amount of time before going over to the next line. This time can be defined as the timestep, and is a time between 0 and 10000 milliseconds. If you prefer not to use the timestep, you should turn it off by the TIMESTEP OFF command. Related to this is also the TIMESTEP ON command.

The sample application belows shows you an application that plays with the timestep value during execution time.

// timestep is initial 1000 milliseconds, or 1 second

TIMESTEP ON

TIMESTEP = 1000

// set I/O channels 1 to 4

SETIO 01

SETIO 02

SETIO 03

SETIO 04

// reset the timestep

TIMESTEP = 2000

// dim the I/O channels 2 times as slow as you have

// set them

CLEARIO 01

CLEARIO 02

CLEARIO 03

CLEARIO 04

This help file was created with the free trial version of HelpScribble.


Group 11: TIMESTEP ON

command information:

Type	non-interactive

Timestep	no

Unique	no

Enables the timestep. See this link for more information and a sample on this command.

This help file was created with the free trial version of HelpScribble.


Group 11: TIMESTEP OFF

command information:

Type	non-interactive

Timestep	no

Unique	no

Disables the timestep. See this link for more information and a sample on this command.

This help file was created with the free trial version of HelpScribble.


Group 11: TIMESTEP = TIMESTEP + ?

command information:

Type	interactive

Timestep	no

Unique	no

This command can be used to increase the TIMESTEP variable with a certain value. The maximum timestep value is 10000 milliseconds (10 seconds).

The sample application belows shows you an application that plays with the timestep value during execution time.

// timestep is initial 1000 milliseconds, or 1 second

TIMESTEP ON

TIMESTEP = 1000

// set I/O channels 1 to 4

SETIO 01

SETIO 02

SETIO 03

SETIO 04

// reset the timestep

TIMESTEP = TIMESTEP + 1000

// dim the I/O channels 2 times as slow as you have

// set them

CLEARIO 01

CLEARIO 02

CLEARIO 03

CLEARIO 04

This help file was created with the free trial version of HelpScribble.


Group 11: TIMESTEP = TIMESTEP - ?

command information:

Type	interactive

Timestep	no

Unique	no

This command can be used to decrease  the TIMESTEP variable with a certain value. The minimum TIMESTEP value = 1.

The sample application belows shows you an application that plays with the timestep value during execution time.

// timestep is initial 1000 milliseconds, or 1 second

TIMESTEP ON

TIMESTEP = 2000

// set I/O channels 1 to 4

SETIO 01

SETIO 02

SETIO 03

SETIO 04

// reset the timestep

TIMESTEP = TIMESTEP - 1000

// dim the I/O channels twice as fast as they were set

// set them

CLEARIO 01

CLEARIO 02

CLEARIO 03

CLEARIO 04

This help file was created with the free trial version of HelpScribble.


Group 12: CLEARALLDAC

command information:

Type	non-interactive

Timestep	no

Unique	no

Clears all the analog outputs, you should run this command before you STOP your WinPLC application. In the demo application a user expects a flashing light on DAC01 which increases from 0 to 30, and resets afterwards.

// intial state preparation & timestep

TIMESTEP = 100

TIMESTEP ON

// cycler

LABEL CYCLER

DAC01 = DAC01 + 1

IF DAC01 = 30 THEN CLEARALLDAC

GOTO LABEL

This help file was created with the free trial version of HelpScribble.


Group 12: DAC01 = ? ... DAC08 = ?

command information:

Type	interactive

Timestep	yes

Unique	no

This command is powerful, because it allows you to copy the values from a DAC channel to another one. Also, you are allowed to assign a fixed number to a DAC channel. The command is interactive, this means it requires a parameter. When inserting this command to your program, you will get a box like displayed below. Here you can set a fixed number for the channel, or the name of another DAC channel you want to copy your value from.

You can assign the value of one of the four WinPLC variables (VAR1 ... VAR4) to the DAC channels. Keep in mind the datarange for the DAC channels is between 0 and 63, the range for the VAR variables is between 0 and 1023. If you assign a value greater than 63 to a DAC channel, the maximum value (63) will be used instead.

setting analog output channels

This help file was created with the free trial version of HelpScribble.


Group 12: DAC01 = DAC01 + ? ... DAC08 = DAC08 + ?

command information:

Type	interactive

Timestep	yes

Unique	no

This command increases the value of a certain DAC channel with the value of an other value, or a fixed value. So the command will calculate the sum of both, when an overflow is reached, the sum will just be maximum. Overflow means the result is more than expected, in this case more than 63 ... the maximum value a DAC channel can have.

You can assign the value of one of the four WinPLC variables (VAR1 ... VAR4) to the DAC channels. Keep in mind the datarange for the DAC channels is between 0 and 63, the range for the VAR variables is between 0 and 1023. If you assign a value greater than 63 to a DAC channel, the maximum value (63) will be used instead.

setting analog output channels

This help file was created with the free trial version of HelpScribble.


Group 12: DAC01 = DAC01 - ? ... DAC09 = DAC09 - ?

command information:

Type	interactive

Timestep	yes

Unique	no

This command decreases the value of a certain DAC channel with the value of an other value, or a fixed value. When the result is less than zero, the result will be set to zero. This value will then be send to the DAC output channel.

You can assign the value of one of the four WinPLC variables (VAR1 ... VAR4) to the DAC channels. Keep in mind the datarange for the DAC channels is between 0 and 63, the range for the VAR variables is between 0 and 1023. If you assign a value greater than 63 to a DAC channel, the maximum value (63) will be used instead.

setting analog output channels

This help file was created with the free trial version of HelpScribble.


Group 12: DACN = ?

command information:

Type	non-interactive

Timestep	yes

Unique	no

This command allows you to set a value for all DAC channels at once.

This help file was created with the free trial version of HelpScribble.


Group 12: DA1 = VAR1 ... DA4 = VAR1

command information:

Type	non-interactive

Timestep	yes

Unique	no

This command allows you to set the high precision analog outputs DA1 to DA4. You cannot set directly a value to these channels. You need to put the desired output value first in variable VAR1, and then run the command DA1 = VAR1.

The example below shows an example to set the DA channels.

VAR1 = 124

AD1 = VAR1	// put 124 on output AD1

This help file was created with the free trial version of HelpScribble.


Group 13: CONNECT ?

command information:

Type	interactive

Timestep	yes

Unique	no

This highly powerful command makes a connection with another computer using the TCP/IP protocol. This can be a computer on a LAN (Local Area Network), but also one at the other side of the world. The purpose of this command is to alert other systems when a certain condition has occured, for example you can send E-mails when an alarm was triggered. To connect to another computer, WinPLC need to know its computer name or IP address (mostly this will be the IP address, or a dynamic dns name). Also a port is required, the port the remote server on the remote computer listens to. After the CONNECT command, you can send text or disconnect from the server by using the commands DISCONNECT or SEND or SENDEMPTY. WinPLC isn't able to read text from the server, so you just can send to other systems.

After entering the CONNECT WinPLC will attemp to connect to the remote server. It won't returns an error message when this connection fails, so you never are sure the commands you sent to the server arrived. See the topic about networking for more information and examples.

WinPLC connect dialog box

This help file was created with the free trial version of HelpScribble.


Group 13: DISCONNECT

command information:

Type	non-interactive

Timestep	yes

Unique	no

This command will disconnect you from a remote server, if you were connected in the first place. See the CONNECT , SEND and SENDEMPTY for more related information.

This help file was created with the free trial version of HelpScribble.


Group 13: SEND ?

command information:

Type	non-interactive

Timestep	yes

Unique	no

This command will disconnect you from a remote server, if you were connected in the first place. See the CONNECT , DISCONNECT and SENDEMPTY for more related information. You can use variables in this box.

This help file was created with the free trial version of HelpScribble.


Group 13: SENDEMPTY

command information:

Type	non-interactive

Timestep	yes

Unique	no

This command will send a message to a remote server, if you are connected. See the CONNECT , SEND and DISCONNECT for more related information.

This help file was created with the free trial version of HelpScribble.


Group 14: STOPALLMOTORS

command information:

Type	non-interactive

Timestep	yes

Unique	no

This command will send an emergency-stop command to all K8005 cards.

This help file was created with the free trial version of HelpScribble.


Group 14: SENDMOTOR ?

command information:

Type	non-interactive

Timestep	yes

Unique	no

This command can be used to give commands to the K8005 stepmotor cards. To stop the motors, use the STOPALLMOTORS command.

the interface of the stepmotor screen

The following parameters can be set:

•	motornumber: This is a motor, a number between 1 and 16. (WinPLC supports up to 16 motors)

•	command: This is a command for the motor, like rotating ClockWise (CW) or CounterClockWice (CCW)

•	speed: This is the rotation speed that must be taken. (speed is highest at value 0)

•	steps: The number of steps to rotate

This help file was created with the free trial version of HelpScribble.


Working with events

From WinPLC 6, support for working with EVENTS was added. An event is something that happens, like a button on a userdefined GUI form that is pressed. When you click this button, WinPLC will automatically call the subroutine that is assigned to this button (view the GUI editor for more information). It doesn't matter what WinPLC is currently doing, the execution will jump to this subroutine. When the subroutine is executed, WinPLC will go back to the command that was executed before the event. Note: WinPLC will NOT jump to a subroutine DURING the execution of a command, like an WAIT command.

WinPLC also support other events, mostly for the commands in group 13 (CONNECT, DISCONNECT, ...). A listing of these events:

EVENT_CONNECTION_ESTABLISHED

This event is triggered when a connection with an external server is established (using the "CONNECT ?" command)

EVENT_CONNECTION_CLOSED

This event is triggered when a connection with an external server is closed

EVENT_CONNECTION_DATAARRIVAL

This event is triggered when new data arrived on an established connection. This data can be retrieved with the IF INDATA = TEXTVAR THEN command

EVENT_CONNECTION_ERROR

This event is triggered when a connection with an external server is closed by error or if an error occured

EVENT_AD_CHANGED

This event is triggered when the value of an AD channel changes

These events are enabled by default. If you want to use them, you need to create subroutines with the same name as described above. Note you only need to add the event subroutines that you need. You can call this event subroutines like normal subroutines, but you are advised not to do so. The example below demonstrates  the principle of these events:

CONNECT TCP,WWW.MICROSOFT.COM,80

LOOP

// winplc endless loop

GOTO LOOP

SUB EVENT_CONNECTION_ESTABLISHED

// subroutine, only called when the CONNECT command succeeded

END SUB

This help file was created with the free trial version of HelpScribble.


Programming Tactics

WinPLC offers a lot of programming solutions, but sometimes you need to know certain tricks to get started for a specific application. This little chapter will show how to use variable speed for your applications, and much more.

- Variable Execution Speed

- Endless Loops

- Counters

- Networking

This help file was created with the free trial version of HelpScribble.


Programming Tactics: Variable Execution Speed

Some applications doesn't use the same execution speed all the time. Sometimes you want the maximum speed for certain commands, like a subroutine which shouldn't be delayed.

//use an execution speed of 1 second/command

TIMESTEP=1000

TIMESTEP ON

CALL SETCHAN

INVERTIO 01

CALL SETCHAN

INVERTIO 01

CALL SETCHAN

INVERTIO 01

SUB SETCHAN

// perform the commands in this SUB as quickly as possible

TIMESTEP OFF

DAC01 = DAC01 + 10

DAC02 = DAC01

DAC03 = DAC02

DAC04 = DAC03

TIMESTEP ON

END SUB

This help file was created with the free trial version of HelpScribble.


Programming Tactics: Endless Loops

Some programs should never end. To make this, you will need to create a JUMP to the beginning of the application. The application below shows the use of an endless loop, where the value of the DAC output will be increased from 30 to 60. When It's 60, it's value will fall back to 30. This will happen over and over again.

// initialization which only may be executed one time

TIMESTEP=1000

TIMESTEP ON

DAC01 = 29

// start of the LOOP

LABEL BEGIN

DAC01 = DAC01 + 1

IF DAC01 = 60 THEN DAC01 = 30

GOTO BEGIN

There is another type of endless loop, that runs all the time but exits when a certain condition became true. This application does an endless loop, but in the meantime it also check the state of channel I/O 01. When this channel becomes high, the endless loop is being exited, and the execution jumps to another part of the program.

TIMESTEP=2200

TIMESTEP ON

DAC01 = 29

// start of the LOOP

LABEL BEGIN

//wait for channel 01 to become high

IF IO01 = 1 THEN GOTO NEXT

GOTO BEGIN

LABEL NEXT

// program stops here, activate lamp on

// analog output DAC01

DAC01 = 63

This help file was created with the free trial version of HelpScribble.


Programming Tactics: Counters

It happens you have to repeat a certain task a few times. You can place all the commands for the task a few times in your program. But you could also make a counter, so you run it for a certain times. This example shows how to invert the I/O channel 01 10 times.

//set the timestep information

TIMESTEP=2200

TIMESTEP ON

// initial value for the counter

VAR1 = 0

// start the loop for the counter

LABEL LOOP

// increase the counter

VAR1 = VAR1 + 1

// invert I/O channel 01

INVERTIO 01

// stop loop if you have cycled it 10 times

IF VAR1 = 10 THEN END

GOTO LOOP

Of course, this is an easy example where you could reach the same by placing 10 INVERTIO 01 's after each other in your program. Remark this solution will go faster than the first solution. To fix this, you will have to disable the TIMESTEP in the first solution while increasing the counter in the first example.

//set the timestep information

TIMESTEP=2200

TIMESTEP ON

INVERTIO 01

INVERTIO 01

INVERTIO 01

INVERTIO 01

INVERTIO 01

INVERTIO 01

INVERTIO 01

INVERTIO 01

INVERTIO 01

INVERTIO 01

This help file was created with the free trial version of HelpScribble.


Programming Tactics: Networking

Networking allows you to contact a remote system on the Internet. But the commands in WinPLC are a little bit restricted, because the remote system cannot send text back to WinPLC.  The remote system will have to run a server, which understand the commands you give with WinPLC. A practical example is a outgoing mail server, for that you don't have to get messages back from the server (although there is a risk the server gives an error message you will not know about).

In the example below, you can see a subroutine which is able to connect to a SMTP mail server and send an E-mail message trough it. Just call the subroutine, to send the E-mail message to the E-mail address specified.

You shouldn't set your timestep too high or too low for this application. But it also depends a little bit on your Internet connection speed. A timestep of 100 milliseconds should do fine for the example (TIMESTEP = 100).

The mail will be send , following the SMTP protocol. You might change the computer name (here this is computer1), and the E-mail addresses you want to send an E-mail to.

SUB SENDMAIL

     CONNECT TCP,MAIL-OUT.PANDORA.BE,25

               SEND HELO computer1

               SEND MAIL FROM: <A@pandora.be>

               SEND RCPT TO: <B@pandora.be>

               SEND DATA

               SEND From: ""WinPLC"" <A@hotmail.com>

               SEND To: ""WinPLC owner"" <B@pandora.be>

               SEND Subject: SUB CALLED

               SEND

               SEND the sub was called, tell whatever you want here

               SEND

               SEND .

          SEND QUIT

     DISCONNECT

END SUB

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
These are the direct card access I/O check boxes. Every checkbox represents an I/O channel on your interface card, you can enable or disable.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
The direct card access reset button allows you to clear all I/O channels which are configured as outputs in WinPLC.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
The direct card access invert button allows you to invert all I/O channels which are configured as outputs in WinPLC.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
The direct card access Clear DAC button clears all the DAC output levels. This is handy to stop devices when your WinPLC program has quit.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
insert the selected command in the command box, before the selected command in the program box.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
insert the selected command in the command box, after the selected command in the program box.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
replaces the selected command in the program box, with the selected command in the command box.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
moves the selected command in your program up

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
moves the selected command in your program down.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
moves the selected command in your program left.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
moves the selected command in your program right.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
delete the selected label in your program box. There must be at least one command in your program all the time.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
modifies the selected command in the program box.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
run/stops your program in WinPLC.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
view the variables in your WinPLC program, they all apply to the analog channels.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
The command box, which contains all possible commands you can use in your program. HINT: you can click with your right mouse button on this box for more options.

This help file was created with the free trial version of HelpScribble.


what's this help - main screen
The program box with your active program, it will be executed from top to bottom. HINT: you can click right on this box, for more options like temporary disabling commands for testing purposes.

This help file was created with the free trial version of HelpScribble.


The WinPLC GUI editor

WinPLC 6 supports the use of your own user-defined GUI (Graphical User Interface). This is a custom window, WinPLC can show during execution. This window can contain a number of buttons (maximum 20).

You can specify the width and the height for the window, plus the caption. For each button you can also set the caption, the top value (horizontal position on the form), the left value (vertical position on the form), the width (button width), the height (button height), and assigning a subroutine.

If you load a GUI in WinPLC (using the LOADGUI command), this window will be showed. When you press a button, WinPLC will attemp to call the subroutine that is assigned to this button. If the subroutine is not present in your program, nothing will happen. This calling will be done, using EVENTS method: no matter what your program is currently doing, execution will jump immediately to the assigned subroutine.

The WinPLC GUI editor

The GUI editor has the following options:

Form caption: the text in the form's title bar

Form width: the width of your form (pixels)

Form height: the height of your form (pixels)

You can add 20 buttons. The settings per button are:

Caption: the text of your button

Assigned SUB: sub that must be called when the button is pressed

Top: the top position of the button (pixels)

Left: the left position of the button (pixels)

Height: the height of the button (pixels)

Width: the width of the button (pixels)

GUI coordinate system

This picture shows the principle of the GUI form coordinate system. All dimensions are specified in pixels (most computerscreens are set to resulutions of 1280x1024 pixels, 1024x768 pixels or 800x600 pixels). The left corner represents the zero-point.

Example: If you want to make a window of 300 x 150 pixels, with a button of 20 x 20 pixels, 30 pixels from the left border and 35 pixels from the top of the window, enter these parameters:

form width: 300

form height: 150

button height: 20

button width: 20

button left: 30

button top: 35

You can check out your userdefined GUI's by pressing the PREVIEW button. Here you can preview your window, to see if all buttons have the right dimensions and positions. Note that no action will occur if you press a button.

This help file was created with the free trial version of HelpScribble.


Hidden Features

Power WinPLC has a few "hidden" features that might be interesting for you:

•	Centralized filemanager: WinPLC offers you the possibility to store all files into one directory. This directory can be set using the options & setup dialogbox. If you refer to files in your WinPLC programs, and the files cannot be found on that location, WinPLC will also look for it in the store filder.

This help file was created with the free trial version of HelpScribble.


K8000 Setup Wizard

The setup wizard helps you to setup and test your K8000 card. This wizard will happen in 4 steps:

K8001

K8000 is the PLC module from Velleman. If you use WinPLC, you will probably not own this card. But if you do own it, you must place the switch on this card in the HALT mode before you can use WinPLC. If the card is in run mode, WinPLC will not be able to communicate with the K8000: K8001 interrupts the communication between PC and K8000 in RUN mode. Select "warn me for this, every time WinPLC starts" to warn you for setting this switch on the K8000 into the right position.

Test Connection

The K8000 can be connected to the computer using ports LPT1 , LPT2 or Port 0. Most likely, this will be LPT1 for your computer. You can press the AUTODETECT button to detect which port is used.

principle of auto detection

WinPLC will try all ports as communication port, starting with LPT,1 because this is the communication port on most systems. Then WinPLC sets the SDA (serial Data) in line to the K8000. If the K8000 is working correctly, this signal will be passed to the K8000 onboard SDA line. Now, WinPLC waits a little bit, and then reads the SDA out-line from the K8000. This line should have the same state (low or high) as the SDA-in line. If the state is the same, the correct communication port is found.

what can cause an error?

•	a problem with your cable between K8000 and computer

•	a problem with your K8000, check your card

tips if there are any problems:

•	click the "test LEDs" button. This button will set  the 3 communication LEDs on your K8000. If no LEDs light on, you might try another communication port or check the computer BIOS settings. If 2 LED light on, there probably is a problem with your K8000. If all LEDs light on, autodetecting should work.

Test Chip

The "test connection" tools only test if LOOP-BACK is working on your K8000 (send a signal in, and check if you get it back). Another test is, to check the communication IC's (Integrated Circuits) on the K8000. This test will scan if the four IC's are present and responding to commands: 2 IC for I/O, 1 IC for AD and DA, and 1 IC for DAC. This test assume the TEST CONNECTION succeeded.

principle of chip testing

The K8000 used the I²C communication protocol (Inter IC bus). This protocol allows multiple IC's to be connected on one electronic bus. Every IC on the bus has its own I²C address. When the computer wants to communicate with an IC, it needs to send its address to the bus first. If an IC with this address is present on the bus, it will reply with an ACK (acknowledge). So all that the chip testing does, is sending all possible addresses to the bus, and logging the addresses that were confirmed by an ACK pulse.

causes when no chips are detected

•	The busspeed is too high. Click the "I2Cbusspeed" button and set a higher value as delay factor. Then rescan the K8000.

•	One of the IC's is broken, and prevents the others from working correctly. Plug the 4 I²C communication IC's out, and plug one of them back in. If the IC is detected now, plug in another IC and scan again. Doing so, you can eliminated the damaged IC.

•	The wrong PARALLEL PORT MODE setting is set in the BIOS setup (press DEL when you start the computer to enter this setup menu).

Test IO

The TestIO is the last possible check. It sets all IO channels one by one, and tries to read their status. You can perform this test for each card.

This help file was created with the free trial version of HelpScribble.


Stacks & Pointers

Many WinPLC data is stored in registers. There are 3 types of important registers inside winplc:

1. The WinPLC main program

During execution, your WinPLC program is kept in a table (an array). This table exists in memory, and has a storage capacity for 1000 lines of code. A "pointer" points to the current command that is executed: the EPR (Execution_Progress) counter.

2. CONNECTION receiving buffer

After making a connection to an external server (using the CONNECTcommand), data might arrive from this server. All received data is placed into a FIFO register (First In, First Out). The internal DP (datapinter) variable indicates how much datalines are stored into this buffer.

An item is only removed from this register, if it is read by IF DATAIN = TEXTVAR THEN or IF DATAIN != TEXTVAR, IF DATAIN isin TEXTVAR and IF TEXTVAR isin DATAIN.

3. Subroutine Stack

When calling a subroutine, the execution jumps to a certain subroutine. When the subroutine is finished, the execution jumps back to the place where the subroutine was called. To keep all this data, a STACK register and a STACKPOINTER (SP) are used.

Every time a CALL is executed, the SP value is increased with 1. Before jumping to the subroutine, the current value of the EPR counter is placed into the STACK register. At the location with index SP. When the subroutine is stopped or exited, the EPR value in the STACK register is read. Now, WinPLC will change the value of the execution_progress counter back to this read value. In short: This stack allows you to call a subroutine from another subroutine.

It can occur you CALL too many subroutines from another subroutine. Then the STACK registry gets full, and WinPLC will stop your program with an error. You shouldn't worry about this too much, WinPLC can handle 1000 nested subroutines.

example for demonstration:

CALL DEMO

SUB DEMO

// call a sub from the same sub, what will result in a stack error

CALL DEMO

END SUB

This help file was created with the free trial version of HelpScribble.


HelpScribble
HelpScribble - The Complete Help Authoring Tool

This help file was created with the free evaluation version of HelpScribble.  This ad and the little footers below each topic will be automatically removed when the author recompiles this help file with the full version of HelpScribble. HelpScribble can be purchased securely online and is covered by a risk-free 90-day unconditional money-back guarantee.  See http://www.helpscribble.com/ for more information.

About HelpScribble

HelpScribble is a full-featured, easy-to-use help authoring tool for creating help files from start to finish.  You can create WinHelp (.hlp) files, HTML Help (.chm) files, a printed manual and online documentation (on a web site) all from the same HelpScribble project.

If you have previously used another help authoring tool, you can reuse your work by importing the HPJ+RTF files created with the other tool or by a decompiler.

You can use the help files you make with HelpScribble to provide context-sensitive help with your Window applications, no matter which development tool you use.  You can also use HelpScribble to create stand-alone portable documents.

Write Perfect Help Files for Your Software

You need HelpScribble to create a top quality help file for your software.  Windows users expect to receive detailed documentation at a quick press of the F1 button.  You will sell more copies of your software if a thoughtful help file flattens the learning curve for prospects trying the evaluation version of your product.

No matter which development tool you are using, you can always use a help file created with HelpScribble to provide context-sensitive help for your application.

If you know how to use a word processor, you can build a help file with HelpScribble.  Creating new topics and adding links to them cannot be easier.  No experience required.

Portable Documents with Hyperlinks

With HelpScribble you can easily create hyperlinked documents that can be read on any computer running Windows.

The WinHelp files that you create with HelpScribble are a collection of linked pages, just like a web site.  But unlike a web site, you only need to distribute one file.  This file can be read on any Windows computer.  No other software is needed.

You need absolutely no programming experience to use HelpScribble.  Many word processors and HTML editors are more complicated than HelpScribble.

The Complete Help Authoring Tool

HelpScribble is a full-featured stand-alone help authoring tool.  It is not an add-on for MS Word like so many other help writing products.  You can create the entire help file right within HelpScribble.

With HelpScribble you can even provide your documentation in several forms, all from the same source.  You can add context-sensitive help to your application, print a manual and provide online documentation on your web site.

WinHelp

WinHelp is the help file format supported by all versions of Windows.  It is fast, compact and supported by Windows 3.x, NT 3.x, 95, 98, ME, NT4, 2000 and XP.  All Windows users are familiar with it.  With any Windows development tool you can use WinHelp files to add context-sensitive help to your applications.

With HelpScribble you have all the functionality you need to build a complete help file, including table of contents, index, browse sequences, etc.  With HelpScribble's SHG (image map) editor, you can make your pictures (screen shots) say more than a thousand words.

Printed Manual

Reading from paper is a lot easier than reading from a screen.  A printed manual or, for downloadable software, a printable manual in PDF format, adds greatly to the value of your product.

You can use your HelpScribble project as the basis for your printed manual.  You can export your help text to one large RTF or HTML file that you or your DTP professional can turn into a finished manual using a word processor or DTP program.

HTML Help

With Windows 98, Microsoft introduced a new help file format called HTML Help.  Using HelpScribble, you can build classic WinHelp .hlp files and new HTML Help .chm files from the same source.  You decide whether you want maximum compatibility with older computers, or if you want to offer a state of the art help system.

Web Help

If you want to provide online documentation, you can create one large HTML file or a collection of HTML files from your HelpScribble project and upload those to your web site.  Your customers will have instant access to the latest documentation at any time.

Cross-Platform Help

If you are developing platforms such as Linux, where there is no standard help format, you can provide your documentation as HTML files.  The user can easily view those files in a browser.  If you use Kylix, you can even easily integrate them into your application.

Number 1 Help Tool for Delphi &amp; C++Builder

You can use HelpScribble no matter which development tool you use.  Even if you use no development tool at all.  (Stand-alone help files can be very useful.)  But if you are a Delphi or C++Builder developer, you will certainly appreciate the way HelpScribble integrates with your favorite development tool.

HelpScribble's HelpContext property editor takes most of the tedious job of assigning Topic IDs to HelpContext properties out of your hands.  Adding context-sensitive help to your application could not be easier.  Simply click on the corresponding controls and help topics to link them.

Delphi developers like HelpScribble so much that it won the Delphi Informant Readers Choice awards three years in a row.  In 1999, 2000 and 2001, HelpScribble was chosing the Best Help Authoring Package, beating well-known tools such as RoboHelp and ForeHelp.

Do Not Take My Word For It

I could rattle on all day about how great HelpScribble is.  But do not take my word for it!

Find out what the people say about HelpScribble before you decide to buy.

Chris Kryza "Just wanted to let you folks know that you have created a very, very, verynice product! The last time I had to generate a context sensitive help fileI used Doc-To-Help and I remember it took me weeks to get it right. WithHelpScribble I was able to put together a complete help system in under 2days and I then created a web-help deployment of same in seconds. I usedyour demo version to create the entire project and then purchased yourproduct online after I saw how good it all looked. Great stuff!"

Roj Ash "I just felt I had to compliment you on this product.  I have no experienceof producing Help files, and having evaluated a number of products, I wasbeginning to believe that a mere programmer had no chance whatever!

"I am not only making good progress in producing the Help for our product(which is usually used by **very** inexperienced users), but I'm actuallyenjoying it!

"Thanks for a great product."

Try the Free Evaluation Version Today

HelpScribble is an excellent help authoring tool.  But do not take my word for it!  Take a look at the self-running online demos or download the free evaluation version and see for yourself.  Convinced?  Buy HelpScribble now at http://www.helpscribble.com/