the extra pins may be handled differently.
The next section in the header has to do with
connecting to a host controller — in our case, the BS2p.
The connection between the host and the FlexiPanel
module is via I2C at the address specified by the I2C
parameter. The default (read) address for the FlexiPanel
module is 0x68, but we can specify any even address
between 0x68 and 0xFC.
The final parameter is called I2CADDRESSING. This
specifies how we will address the various controls in the
VCP. I think for most applications that 1BYTE_INDEX is
going to be the easiest to deal with — as long as we plan
our project and then work the plan. Using this method,
each control in the VCP is accessed by its position in the
definitions discussed shortly and using one byte gives us
the ability to deal with up to 256 controls. This method is
also the cleanest to implement using I2CIN and I2COUT.
Give Me Some Control
Okay, now we can get into the fun stuff — the VCP
controls. If you look at the screen shots included in the
documentation, you’ll notice that the controls are always
stacked vertically in the VCP window. This strategy keeps
the controls’ scripting very simple; controls will appear on
the form in the order defined.
Going back to our requirements, the first thing to
display is the current temperature. We have a few choices
here, but, this being a temperature controller, using a
numeric output in the form of a progress bar (which
suggests a mercury thermometer) seemed the logical
choice. Here’s the script for this control:
TITLE “ System Status”
Figure 3. AC controller schematic.
NUTS & VOLTS
The type of control we’ll use for the
current temperature is the NUMBER type.
There are options to display numbers, but, as
we just discussed, we’re going to use the
PROGRESS type. This STYLE is also set to
FIXED, which means it cannot be changed by
the user running the VCP, though it can be
changed by the host. The UNITS parameter
allows us to display a string after the value and
CTL_MIN and CTL_MAX allow us to specify
the control’s value range.
All controls must have a unique, four-byte
ID. I chose to use a four-byte string to serve as
a reminder (that matched with constants in
the PBASIC host program), but any unique
four-byte value will work. The FIXEDSTORE
and VARSTORE parameters specify the
location of fixed (like the control’s title) and
variable (like the value) data that are stored in
the module. The parameters we used are
typical, though there are other options.
All VCP controls are surrounded by a
grouping box, even when there is just one
control. This box has a title string that is
specified by the TITLE parameter. We can
group controls into the same box and we’ll
demonstrate that in just a moment.
Our next control is a TEXT type to display
system status. The status text will tell us
what’s actually going on inside our AC
controller (OFF, Idle, Cooling, Heating, etc.).
We give it a maximum length with the
MAXCHARS parameter and, in this case, we
are grouping it into the “System Status” box