beautypg.com

Event driven programming, Program design – Industrial Data Systems IDS Scale Basic User Manual

Page 8

background image

Scale Basic 4.2E

Tutorial

Event Driven Programming

This section provides an introduction to event driven, computer program design.

Program Design

The first step in computer programming is to create a ‘program design’. The first mistake that a
programmer can make is to give insufficient attention to designing a program. Give extra
attention to this phase of programming; you will be well rewarded for your effort. Programming
will be easier and it will be less likely that you will have to start over again because the program
doesn’t do what the customer wants.

There are many books written on program design. This manual uses the following program
design process:

1. describe the application. Many times this will be provided by your customer.

2. list the results (outputs) are to be accomplished.

3. list the inputs are needed to get the results.

4. describe the program functions that are needed.

The above process should be done with close consultation with the user of the program (your
customer). Usually, the customer describes the problem and the programmer takes notes and
asks questions. Then the programmer writes a draft of the program design asking the customer
questions as they occur. Then the customer is given a copy of the program design for approval.
At this time, the programmer should go over the design with the customer to make sure that
everything is covered.

Example: a customer presents the following application:

Application

Description

The operator places containers on the scale and fills them with resin. An ‘Under-weight’ light
turns on while the container weight is below the target weight. There are 3 sizes of container,
each is filled with a different amount of resin. If the container is filled with too much resin, turn
on an ‘Overweight’ light until enough resin is removed for the container to be within
specifications.

Results / Outputs

Container filled with the proper amount of resin (3 sizes of container).
An ‘Under-weight’ light.
An ‘Over-weight’ light.
Inputs

Target weights (3).
Target weight select.
Start operation.