4 use meaningful variable names, 5 declare all variables in one location, Use meaningful variable names – High Country Tek emc-3L User Manual

Page 6: Declare all variables in one location

Advertising
background image

Wherever Possible Do the Following

• Keep High Voltage AC cables separate from Low Voltage DC signal and power supply cables.

• Use the largest practical wire size (gage) with the biggest cross sectional area (mm^2) possible

to minimize losses over cable length.

• Use a ‘Switch-Mode Power supply, their wide input voltage range and built in filters on input and

outputs make them ideal for today’s systems.

• Mount the modules separately to motor starters, contactors and relay switches to minimize

electrical noise pickup and other noise (RF) related problems.

4.2

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
functionality. This step will help to minimize changes to the program at a later date. This step could take
considerable time, but will make the program much simpler to write. Refer to chapter 5 for an example.

4.3 Separate

different

functions into different logic bubbles.

It is not incorrect to place all of the program logic in the always code, but it can slow down the program and
make it more difficult to troubleshoot. Time critical logic should be contained in the ‘always’ code. Different
functions should be contained in individual bubbles. For example, a pump control’s logic can be contained in a
bubble by itself. The logic to control the track drive of a bulldozer can be contained in a bubble by itself. These
functions may not be as critical as something such as looking for a high pressure situation.

4.4

Use meaningful variable names.

The limit on variable size is 32 characters. A variable that isn’t an input or output device is called an internal
variable. An internal variable that is for Valve1 minimum current setting for the program loader monitor could be
labeled Valve1MinCurA_PLM_IV. This naming convention could be used throughout the program. An EEmem
variable for a valve’s minimum current setting could be named Valve1MinCurB_eem. Below are some other
examples.

Valve1ctl_AI2 – analog input#2. Variable names in capitol letters designate an abbreviation.
Cross_valve_UI2 – universal input #2.
Output_shaft_RPM_PI1 – rpm pulse input#1.
Pump#2_milling_pwm_OG1 – output group #1, pwm controlled motor.
OK_to_begin_led_OG3 – output group #3, discrete(bang bang) output to control LED.

Engine_rpm_lo_J1939 – The low byte of the engine rpm from the j1939 network.
Engine_temp_J1939 – The engine temperature from the j1939 network.
Network_status_eem - EEmem variable.
Mast_into_position1_IV – internal variable.
EEmem_spare_128 – eemem variable that doesn’t have a specific name because unused. Makes programmer
aware of spare EEmem addresses.

4.5

Declare all variables in one location

Have one area of one bubble that is executed once to declare all variable names. This area would include
unsigned integers (Uint), EEmemory variables (EEmem), Timers (timer), constants (const) and others. Declare

PN 021-00154-QSG, Rev A.2

Quick Start Guide

Page | 6

Advertising
This manual is related to the following products: