Modern roboteers
have unlimited
access to innovative
mechanical tools and
development devices.
However, many of you
scientifically-inclined
mechanics don’t
realize that you also
have a similarly
powerful tool chain
on the software side.
By Fred Eady
Getting
Down to
Some
Basics of
Using C
In today’s electromechanical environment, it is becoming commonplace to see a person lay down a mechanically sound weld joint and then turn to his or her laptop and write some code with the same dexterity. In the past, writing embedded
electromechanical programs in a microcontroller’s native
assembler was normally beyond the average robotic
machinist. In the infant days of microcontrollers and
microprocessors, writing pure assembler applications with
the development tools of the day was just as heavy a task
for those who proclaimed to know what they were doing.
Assembler programming is still as important today
because there are times when a tight group of hand-picked
assembler mnemonics is the best way to generate or
capture a high speed signal or event. However, in the early
days of melding microcontrollers with machined parts,
machinists that could also wear the embedded programmer
hat began to jump ship on assembler programming only to
be rescued by the BASIC programming language. These
electromechanical engineers needed to switch power, spin
motors, and sense limits. BASIC was a very easy way to
meet these requirements and was just as easy to learn.
Today’s mechatronic engineers share their task lists
with those that came before them. As a person that is
capable of creating useful metallic objects, you also need to
switch power sources, spin and control the rotational
direction of AC or DC motors, and sense the position of
“things.” Those “things” are usually the rotational position
of a motor shaft or the extent of the linear extension of a
mechanical device. A major advantage the modern roboteer
has over his forefathers is the luxury of choosing from a
pool of embedded programming languages like BASIC,
Pascal, Forth, and C.
BASIC is a Great Language
This month’s discussion will not be a BASIC language
bash session. In fact, in a future SERVO discussion we’ll give
BASIC the same treatment as we’re about to give to the C
language. We’re simply going to concentrate on C this time
around.
SERVO 08.2010 67