Power WinPLC Version 8 - Preview

I am pleased to announce a new Version of Power WinPLC! The new version will be called WinPLC 8 and will become available by the end of this month (July). I decided to add some very interesting new features.

Edit: The new release isn't ready yet. I hope to get it ready before Jan/2009

INTRODUCTION OF SOME NEW COMMANDS:

RUN_FOREVER
This command will cause WinPLC to keep running the program (it acts as an endless loop. The command can be usefull in programs that use Event subroutines.



SETCAPTION ?
This command will change the title bar of Power WinPLC to any textstring you like. You can use WinPLC variable names within this string.



STATUSBAR ?
WinPLC now has a statusbar. You can set messages in the statusbar during execution time. Here you can also use variables.



DIRECTCARDACCESS.SHOW and DIRECTCARDACCESS.HIDE
The direct card access is the area above your program, where you can control the K8000 by clicking 1 - 16 checkboxes. Now you can hide this tool if desired.



SELECT CASE/END SELECT
A SELECT CASE is a powerful instruction to compare a variable with several possibilities. You can make your programs much easier by using this command. Example:

// $command is a text variable. It contains a command that was given to
// WinPLC. We want to perform an action, depening on the value of this
// variable.
SELECT CASE $command
    CASE "STOP"
      // PROGRAM STOP REQUESTED
      STOP
			
    CASE "SETALLCHANNELS"
      // ALL CHANNELS MUST BE MADE ACTIVE
      SETALLIO
			
    CASE ELSE
      // $COMMAND DID NOT MATCH ANY OF THE PREVIOUS STRINGS
      // CLEAR ALL I/O CHANNELS AND STOP THE PROGRAM
      CLEARALLIO
      STOP
 END SELECT


EXECUTE_TEXTVAR
The Execute_Textvar command will cause WinPLC to execute the command that is stored inside the $textvar variable. This can come in handy for several applications.

// Sample: we will execute the command that is inside the TextVar
TEXTVAR = "SETALLIO"

// Now the Execute_Textvar command will cause WinPLC to execute the command inside
// the textvar variable: SETALLIO. This means WinPLC will now set all I/O channels.
EXECUTE_TEXTVAR

But more complicated applications will also be possible. You could use this command to make an efficient lightcomputer with very few commands:

// Sample: Dynamically change the command to execute
// (By using variables in the textvar variable)
VAR1 = 0

LOOP:
VAR1 = VAR1 + 1
TEXTVAR = "SETIO $VAR1"
EXECUTE_TEXTVAR
WAIT 1000
GOTO LOOP


DDE COMMANDS (Dynamic Data Exchange)

WinPLC now allows you to send messages to other software through DDE. DDE stands for Dynamic Data Exchange. It is a method to exchange between different software processes. For example: WinPLC can use DDE to send a request to Microsoft Internet explorer to open a certain webpage. 2 new WinPLC commands are introduced to do so:

DDE.SETUP ?

DDE.SENDSTRING ?

The Setup command will initialize the DDE data transfer, while the Sendstring command will send the desired data to the receiving DDE application (like Internet Explorer). The example below illustrates how you can force Internet Explorer to open a website:

// Example to open a DDE transfer between WinPLC and Internet explorer.
// WinPLC will tell Internet Explorer to open the following website:
// http://winplc.bvsystems.be

// Step 1: setup the connection.
DDE.SETUP "iexplore|WWW_OpenURL"

// Step 2: send the actual data
DDE.SENDSTRING "http://winplc.bvsystems.be"


THE TEXTSCREEN OBJECT

The new version of WinPLC has a exiting new feature, calling "The TextScreen". During execution time of your program, you can enter the TextScreen mode. In this mode, WinPLC will change its outlook completely to a Text-Based system. You must control the TextScreen by typing your own commands (You can program your own commands completely).

The TextScreen looks a lot like a Chat-Window. It has an input Window (where you can enter commands), and an output Window (where any output will be appended to). When you enter a new command, a certain EVENT will be triggered (SUB TEXTSCREEN_COMMAND_ENTERED). When this subroutine is called, you will be able to retrieve the given command by evaluating the $command variable (for example with the new SELECT CASE/END SELECT structure). Doing so you can program several text commands.

In the image below you can see an example of the TextScreen system in action. First I gave an invalid command. My .PLC program answerred the command is invalid. Then I gave the "COUNT CHANNELS" command. A function in my .PLC file then did a count of all active I/O channels.

What does the code for this program look like?

#DIRECTIVE RUN_MAX_SPEED
SETCAPTION "Home Interface"
TEXTSCREEN.SHOW
TEXTSCREEN.CLEAR
TEXTSCREEN.ADDLINE "Welcome to the Home Interface"
TEXTSCREEN.ADDLINE "Enter some commands."
TEXTSCREEN.ADDLINE "Type EXIT to stop execution"
RUN_FOREVER
 
 
SUB TEXTSCREEN_COMMAND_ENTERED
     TEXTSCREEN.ADDLINE " "
     TEXTSCREEN.ADDLINE "> $command"
      
     SELECT CASE $command
     CASE "EXIT"
          STOP
     CASE "COUNT CHANNELS"
          CALL COUNT_PROCEDURE
     CASE ELSE
          TEXTSCREEN.ADDLINE "Unknown command!"					
     END SELECT
END SUB
 
 
SUB COUNT_PROCEDURE
     TEXTSCREEN.ADDLINE "Running counting procedures..."
     WAIT 1000
     VAR1 = 0
     IF IO01 = 1 Then VAR1 = VAR1 + 1
     IF IO02 = 1 Then VAR1 = VAR1 + 1
     IF IO03 = 1 Then VAR1 = VAR1 + 1
     IF IO04 = 1 Then VAR1 = VAR1 + 1
     IF IO05 = 1 Then VAR1 = VAR1 + 1
     IF IO06 = 1 Then VAR1 = VAR1 + 1
     IF IO07 = 1 Then VAR1 = VAR1 + 1
     IF IO08 = 1 Then VAR1 = VAR1 + 1
     IF IO09 = 1 Then VAR1 = VAR1 + 1
     IF IO10 = 1 Then VAR1 = VAR1 + 1
     IF IO11 = 1 Then VAR1 = VAR1 + 1
     IF IO12 = 1 Then VAR1 = VAR1 + 1
     IF IO13 = 1 Then VAR1 = VAR1 + 1
     IF IO14 = 1 Then VAR1 = VAR1 + 1
     IF IO15 = 1 Then VAR1 = VAR1 + 1
     IF IO16 = 1 Then VAR1 = VAR1 + 1
     TEXTSCREEN.ADDLINE "Analyzing completed..."
     TEXTSCREEN.ADDLINE "The number of active channels is: $VAR1"
END SUB



BUILD-IN TELNET SERVER

WinPLC 8 will contain a build-in Telnet Server. With this functionality, you can use a Telnet Client program (like hyperterminal which is included to Windows) to connect with WinPLC over the network/Internet.

Once connected with WinPLC you will be able to view the contents of the TextScreen control. You can also send commands through the Telnet client as you were working on the original computer with WinPLC.

This feature is extremely powerful and allows you to remote monitor and control the K8000 card. Possible safety issues are minimized: the Telnet Server must be activated and it is password protected. Below you can see a screenshot of the Telnet Server in action.



ORGANIZE YOUR FAVORITE WINPLC COMMANDS

WinPLC almost has 200 commands you can use in your programs. It became hard to find the command that you needed. I now found a solution for this problem: FAVORITE COMMANDS and FILTER COMMANDS.

Favorite commands: All WinPLC commands are sorted in groups. Every group contains commands with simular behavor (starting channels, stopping channels, ...). Now there is a new group, called "favorite commands". You can add your most used commands to this group. You will find your commands much faster this way.

Filter Commands: With this function you can filter out the command box. For example: You can set the filter "time". WinPLC will now show only commands containing the word "time".



PROCESSOR PRIORITY MANAGEMENT

The new version of WinPLC supports priority management. WinPLC normally runs under "NORMAL" priority. In the new version you can choose between "LOW PRIORITY", "NORMAL PRIORITY", "HIGH PRIORITY", "VERY HIGH PRIORITY". By changing the priority level, WinPLC can get a higher priority level than the other software on your computer. It will make WinPLC perform better for critical applications.



MAKE WINPLC OPEN FILES THROUGH DDE

You can open .PLC files by double clicking them in Windows Explorer. If you do so WinPLC opens and loads the selected .PLC file. Until now you couldn't open a second .PLC file while WinPLC was active (only one open instance of WinPLC was allowed). Now I have improved this: you can open a new .PLC file from Windows Explorer even when WinPLC is already active. The new file will be opened in the running instance of WinPLC.

This also opens a door for a new cool feature: During the execution of a .PLC program you can jump to another .PLC program. Below an example with 2 .PLC files: SampleA.plc and SampleB.plc. When each file is executed, WinPLC will open the next file and continue. The statusbar will indicate the number of cycles (this is possible because the WinPLC variables doesn't reset when running the new .PLC file).

The contents of SampleA.PLC:

//SampleA.PLC
// THIS PLC FILE SETS ALL IO CHANNELS
// IT WAITS FOR ONE SECOND, AND THEN IT MAKES WINPLC OPEN SampleB.PLC
SETALLIO
WAIT 1000

VAR1 = VAR1 + 1
STATUSBAR "Number of cycles: $VAR1"
OPENFILE SampleB.PLC

The contents of SampleB.PLC:

//SampleB.PLC
// THIS PLC FILE CLEARS ALL IO CHANNELS
// IT WAITS FOR ONE SECOND, AND THEN IT MAKES WINPLC OPEN SampleA.PLC
CLEARALLIO
WAIT 1000
OPENFILE SampleA.PLC