REQUIREMENTS OF WORKING WITH LHFSD ED5RV07EN-15
The recommendation is, you should read this book in a relaxed manner,
before anything else. There are no requirements to understand it, except
for a little bit of logic, naturally. If you are an advanced HFS
[Hardware Firmware Software] designer, you do not need to work with the
accompanying Source Code: just use this book as a reference in your
future designs. However, if it is your intention to learn from the
ground up, and to experiment with all schematics and programs presented
here, then you do need to prepare your HFS development workbench. Please
be aware that the HFS activity could be fairly expensive to deal with, and
you should plan to invest something into acquiring the knowledge.
LHFSD is not just another technical book: it presents in details
a set of up-to-date working hardware, firmware, and software
projects. However, in order to do that, LHFSD makes references to
complex datasheets, to professional compilers, and to a few specific HFS tools.
This book deals with Microchip controllers [of Microchip Technology™
Inc.] because they are still the cheapest and simplest technology
available to start professional hardware and firmware design. For
software design, Visual Basic® 6 compiler is also one of the cheapest
and most efficient software tool available. Of course, we are limited to
the Windows® OS [Operating System] environment, but that is about
all the existing PCs in the World today! Any commercial program is written
for Windows OS first, and before anything else. On the other hand,
particular OS limitations refer only to the tools and technologies we
use, because designing skills you will acquire from this book work on
all Operating Systems, and on any other microcontroller brand as well!
Now, after reading this book in a relaxed manner, it should be perfectly
clear to you what to do next. If you decide to build yourself
[LHFSD Hardware Companion Kit], to test and learn the “how-tos” of
the trade, then you need to procure some electronic components, plus the
necessary PCB compiler. Let’s see what it takes to bring into factual
reality all designs in this book.
For Hardware Design, you need, first of all, a CAD [Computer Aided
Design] “Schematic and PCB Editor” software program, and there are many
interesting options for that. If you already have one, then use the one
you are familiar with; if you do not have any, then you should go on the
Internet and start with a search for “free PCB CAD software”. Have no
fears, my friend, you are going to find your tool. The good thing is,
PCB-CAD design tools are greatly needed these days, and there are many
companies striving to offer their products. Note this please: while some
Schematic and PCB Editor software tools are priced in the range of 100
to 10000 USD, others are totally free! I dare say, in the near future
the price of the PCB-CAD tools is going to drop dramatically. Even more,
if any of the readers should feel “the call” for Visual Basic software
development, I do encourage them to try developing a Schematic and
PCB-CAD Editor—it is not very difficult.
As a recent novelty, Autodesk™ Inc. has issued a Schematic &
PCB-CAD software tool named “123D®”. Note that Autodesk is a heavy
name of excellent reputation in the IT World, due to their
world-famous AutoCad® software program. This move could change the
PCB-CAD software market dramatically!
Now, one way or the other you should get your software tools for
hardware design, but the tragedy comes when building LHFSD-HCK PCB.
Although your board will work perfectly fine, it is going to be rather
expensive for a learning aid. We are going to calculate its estimated
costs when we study BOM [the “Bill of Materials”]. Fact is, LHFSD-HCK is
mandatory to implement all firmware and software programs presented in
this book. Sure, as mentioned, if you do have some experience, or a
particularly sharp logic, you do not necessarily need to experiment with
the firmware and software programs presented—in that case you could
understand them logically, just by studying the accompanying Source-Code
files. However, little hands-on experience is crucial when working with
microcontrollers so . . .
The problem is, microcontroller technology is somehow “custom”, specific
to each microcontroller brand, and even to each microcontroller family.
Each hardware/firmware development environment has particularities, and
there are specific “tricks of the trade” you need to know, in order to
do the job properly. Now, if you learn to control a particular family of
microcontrollers, and if that particular family is a powerful one—as is
Microchip’s Digital Signal Controllers—then you have an enormous range
of benefic applications ahead of you!
In order to reduce HFS development costs, and to improve your design
productivity, it is highly advisable to team up in two or three
developers. In addition, note that the LHFSD book and the LHFSD-HCK PCB
are both particularly suited for class teaching—this activity could be
profitable enough to cover all costs required to setup the
firmware/software development workbench, and to manufacture a teaching
set of LHFSD-HCK kits. Anyway, if you build your LHFSD-HCK or
not, you still need to study this book, at least to find out of what is
all the fuss about—right?
In the fifth edition of LHFSD is suggested that
readers could use a prototyping breadboard for hardware design,
instead of building a LHFSD-HCK PCB. This option reduces hardware
design expenses, and it also simplifies things a lot. However,
working with a prototyping breadboard requires increased attention
to small details (as are the wire traces). Regardless, it can be
On the other hand, the hardware design work presented in this book
is meant to teach you how things are done in the real world.
building the LHFSD-HCK PCB is a mandatory practice in learning
Hardware Design professionaly.
In terms of the hardware needed for firmware
development, Firmware Design requires that you
work with MPLAB®
ICD3 programming tool, produced by Microchip Technology
Inc. Naturally, you could use any other programming tool (ICD2,
PICkit2/3); however, ICD3 is a very good investment because you have a
Debugger and a Programmer in a single tool for a wide range of Microchip
Up to edition 5 of LHFSD, it was suggested to work with MPLAB®
ICD2 tool. We switched to ICD3 for the current edition, and our
final conclusion is that ICD3 is way better than ICD2.
Again, it is your choice which programming tool you intend to use.
The minimum requirement in Firmware Design is just to program the
controller—one way or another.
Considering the software tools involved in Firmware Design, Microchip
offers their “MPLAB®
X IDE VX.XX” [Integrated Development Editor]
software for free download, which is quite a treat. Please be aware that MPLAB X IDE is a complex editor, therefore you need to study it a little
before experimenting with the Source-Code in this book. My advice is,
before doing anything, just go to Microchip website and download MPLAB X
IDE—it is free, and you can download it as many times as you want.
The next step is, study MPLAB “Help” accompanying documentation for a
few days. However, please do not get scared by MPLAB complexity, because
that tool is designed to work with all Microchip tools/products—this is the
reason why it is that complex. When working with ICD3 as it is explained
in LHFSD5, you should use only a fraction of MPLAB IDE functions.
It happened we had a few clients asking for Customer Support on
using MPLAB IDE. We are sorry, but we cannot help you with that one.
First of all, MPLAB IDE comes with very good Help documentation and,
secondly, it is a Microchip product.
In addition, in order to write and compile the FDx [Firmware
Development] source-code programs, you need Microchip’s “MPLAB® XC16”
compiler which is not cheap; you have to decide yourself if you buy MPLAB XC16 or not. The good news is,
Microchip allows for a 60 days free
trial period of a fully functional MPLAB XC16 once in your lifetime—a
student version, though it is perfectly sufficient to work with all FDx
programs. You should download your MPLAB XC16 copy only when you feel
you are ready, and you do have the necessary time to work with it.
In fact, all FDx firmware programs in ED5RV07EN_15 may also be
compiled using Microchip’s C30® compiler, plus MPLAB IDE
V8.XX—details are presented further in this book. Please rest
assured that there are many excellent alternatives in setting up
your firmware development workbench.
Software Design is implemented using
Visual Basic 6 compiler, and you
do need to get this excellent software tool. Although modestly
expensive, Visual Basic 6 is one of the cheapest compilers available of
the professional type. Used efficiently, it can help you write
beneficial commercial products for many years to come. For example, the
first four SDx [Software Development; “x” is the number assigned]
applications in Part 3, Software Design, are everything you need in
order to start developing a commercial product similar to the
HyperTerminal™ one—and even way better!
It is your decision whether you want to work in Part 3 of this
book with Visual Basic 5/6, or with .Net/2003/2005/2007/2012/2014.
The best alternative of all is Visual Basic 6 since it is supported
on Windows XP, Vista, 7, and 8.1. Further, a (technical) program
developed with Visual Basic 6 is perfectly portable to Visual Basic
.Net/2003/2005/2007/2012/2014 with only minor modifications.
Over the years, the final “LHFSD.exe” program developed in Software
Design, using Visual Basic 6, has been tested on Windows
95/98/2000/ME/XP/Vista/7/8.1: it works perfectly well on any of them!
Again, the most important is to understand the design method presented,
because practical implementations could be easily tailored to work on
any Windows platform, and even on any other Operating System.
The SDx programs presented in edition 5 of LHFSD, compiled in Visual
Basic 6, may be (or they should be) studied as “similar”. This
means, you could work all SDx programs using any other compiler; for
example Visual Basic 2014, Java, or Delphi. This topic is detailed
in Software Design part.
In edition 5 of LHFSD we recommend that the SDx programs
developed in Software Design are studied only as “programming
techniques/methods”. This means, some readers may use VB6 to build
the SDx programs, naturally, and each program is guaranteed to work
without problems. However, other readers may use
COMPILER THEY WANT in order to build programs that are similar to
the SDx ones. It is perfectly possible, and everything should work
Please be aware that, lately (well, after 2007), Laptop PCs do not
have DB9 connectors anymore: they work only with USB ports. If that is
your case, you need to buy an “USB-to-Serial”
cable adapter. Commonly,
there are two types of USB/RS232 adaptors:
1. built with Prolific® chipsets (used in ed. 1/2/3/4
of LHFSD book);
2. built with FTD® chipsets (used in ed. 5 of LHFSD
Attention: it is possible there are (or they are going to be)
more chipsets on the market, than the two ones listed above.
Regardless, you should implement similar adjustments as they are
presented in details here. The main aspect to note is, the buffers
of the USB driver need to be set to as small as possible.
Now, the thorny aspect is that each USB/RS232 chipset behaves
A Delock® USB/RS232 cable adapter employing a FTD chipset.
Each adaptor costs around 10–15 EURO. However, each has some
restrictions/limitations, therefore the readers need to be aware about
Fig R2 A Sabrent® USB/RS232 cable adapter using a Prolific chipset.
Naturally, there are way more types of USB/RS232 adaptors on the market.
However, I want to present the problems I had with my adaptors, so that
you know to troubleshoot them.
First of all, Prolific chipsets do not have drivers for Windows 8 at
this time (October 2014); however, the FTD ones do work well an all
Windows versions (XP/Vista/7/8). On the other hand, once you install the
FTD driver (on any Windows version) you need to navigate to “Control
Panel>Device Manager>Ports (COM & LPT)>USB Serial Port (COMx)”:
highlight, right-click, and then select “Properties>Port
Settings>Advanced . . .”
Fig R3 Driver settings of Delock® (FTD chipset) USB/RS232 cable adapter.
If you work with a FTD chipset cable adaptor, your settings need to be
as they are presented in the picture above; otherwise the adapter is not
going to perform very well. In general,
you need to reduce the size of the
receive and transmit buffers to the minimum possible. In the picture above,
the minimum buffer size is set to 64—which is too big, but that IS the
minimum possible—1 byte sized buffers would have been far better.
Prolific chipsets have smaller buffers, though it is a very good idea to
reduce them as well. The procedure to follow is identical. Navigate to
“Control Panel>Device Manager>Ports (COM & LPT)>USB Serial Port (COMx)”:
highlight, right-click and select “Properties>Port Settings>Advanced . .
.” You should see something similar to picture R4.
Anyway, failing to customize you USB/RS232 adaptor appropriately may result in
occasional erratic behavior—therefore your FDx/SDx applications may not
perform to standards. Again, all FDx/SDx programs will function somehow, though not
correctly, as they should.
Fig R4 Driver settings of a Sabrent (Prolific chipset) USB/RS232 cable
If the readers work with Tower/Laptop PCs that do have DB9 connectors,
all they need is a RS232 cable to connect their PC to LHFSD-HCK. The
COMx port in this instance is physical, not virtual, and it may be easily discovered/identified in “Control Panel>Device Manager”.
Now, it is possible some readers may shy away thinking this RS232 serial
communications interface is outdated, and they do not need to learn it
anymore. Not so, dear readers. The RS232 application presented in this
book is an excellent learning lesson, if you want to understand the
basics of serial communications. In addition,
all industrial controller
applications (this is, mostly, the PLC systems) use RS232 working over
USB, exactly as it is presented in our book.
On the other hand, there are still millions of serial applications
developed for RS422, RS485, RS488, CAN, OBD, etc., and they all work
similar to the RS232 examples presented in the following pages. All
industrial and professional grade PCs use the RS232 interface, and they
should continue using it for a long time to come—it is a priceless
instrument for firmware and software developers! No matter how we take
it, the RS232 interface is a mandatory lesson for future HFS designers.
Now, particularly important is the fact that each design part in this
book starts from a blank page, and it builds up in complexity
step-by-step. You do not have to worry you are going to get lost,
because E-VERY-THING in our FDx/SDx programs is explained in minute
details. [It is not that you may land up at some place in our FDx/SDx
programs, and you have no idea of how we got there.]
Note that the easiest part to complete is Hardware Design. However, this
part is also mandatory to accomplish successfully, in order to switch to
Firmware Design, and then to Software Design. Again, working with HFS is
somewhat expensive and difficult, therefore
you should consider the option
of teaming up with other developers. That should lower the development
costs substantially, and it may speed up the HFS learning curve of all
technologies presented in this book. On the other hand,
you could use
this book only as a general reference to enhance your designing skills
theoretically, to be prepared for a possible career shift.
Lastly, regarding your personal skills, you should know something about
the basic notions of electronics, and it is preferable that you do have
some idea about C and Visual Basic programming. Therefore, it is
recommended to keep a few good C and Visual Basic programming books
close to your hand, if necessary, while working with this book.
(. . .)
Learn Hardware Firmware and Software Design the easy way!