14 programming example, 15 hints & tips for code writing, Programming example – High Country Tek emc-3L User Manual

Page 15: Hints & tips for code writing

Advertising
background image

messages to the DVC710 containing the values to be stored in their memory area on a periodic basis. This
area is where values such as the input voltage, the percent of the range and error flags such as an open or
short circuit has been detected are recorded. The memory is allocated regardless of whether or not a specific
I/O is used in the system or referenced in the application code. The memory area for each I/O is continually
updated by the BIOS and can be written to by the application code itself in some cases. Particular sections
(typically a 2 byte word or a single bit) of an I/Os memory area are identified by a variable name such as Dig_1
or Ana_1. For instance to check if a switch has been closed you would write “If (Dig_1 = True)”. To check to
see if an output has noted an error you could write “if ((HS1.open = True) or (HS1.short = True)) “. Each
memory area has a predefined set of variable names that are associated with specific sections (values) in the
memory area.

Intella Programming Tool Main Screen, Logic Sequence and Bubble Logic

1.14

Programming Example

The following example illustrates the general constructs used and the screen displays for configuring Inputs and
Outputs. The example is a relatively simple Valve Driver application that has been implemented using a
DVC710 control module. The code consists of 6 parts namely:
Open loop test code for each I/O
A displayed elapsed time clock
The virtual display code for monitoring program execution and variables
Error checking for the status of the wiring connections in the Always code
The unit LED updates
J1939 Bus Monitoring

1.15

Hints & Tips for code writing

The Intella programming environment allows the programmer to be creative in their programming style. Here
are some suggestions as how a program may be structured.


Create machine function flowchart (a.k.a. Sequence of Operations)
This idea forces the development team to understand what the function of the machine will be before the
program is written. Using flowchart notation, the development team documents each function of the machine.
In the case of a hydraulic log splitter, maybe the first function would be to assure the engine is running,
providing pressure for the pump. It is advised that the first flowchart of a project contain very simple steps in the
functionality. Later revisions can combine simple functions into more complex functions. Insert as much
information in this flowchart as possible. For instance, if there is a pressure relief valve in the machine, set at
1500psi, list that in the flowchart. Once the flowchart is finished, everyone should agree on the machine

P/N: 021-00163, Rev. A.0 - for V5.2 Tools

Page | 15

Advertising
This manual is related to the following products: