What's the total number of "s"s in:
Unfortunately, the FTDI cable has a downside. Even though it’s
cheaper than the AXE027, it’s still
relatively expensive — especially if
you want to work on more than one
project at the same time.
I originally chose to use the FTDI
cable because it was the only cable
that I could find that included the
capability of inverting the polarity of
the TxD and RxD signals in software,
which is necessary for the PICAXE
programming interface. As far as I
know, that’s still the case.
However, this month, we’re
going to explore a hardware solution
to inverting the TxD and RxD signals
so that a wide variety of relatively
inexpensive USB-to-serial adapter
cables can be used for our PICAXE
breadboard projects.
In the process of writing this
month’s column, I experimented with
a couple of different logic gates
(inverters and NAND gates). A logic
gate can certainly be used to invert a
data signal, but it turns out that the
most space-efficient solution (at least
for non-SMD parts) is to simply use
an NPN bipolar transistor for this
purpose. I chose the 2N3904 NPN,
but any general-purpose NPN
transistor should do.
Experiment 1: Using
an NPN Transistor as a
Data Inverter
Figure 1 shows the schematic of
a simple NPN data inverter. The
schematic doesn’t show the standard
PICAXE programming circuit, but, of
course, you need to include one —
just use whatever programming
connection you prefer.
The circuit in Figure 1 may look
familiar. That’s because we’ve already
used an NPN transistor as a switch
back in our first LED-multiplexing
project way back in the December
2009 Nuts & Volts. Since that’s quite
some time ago, let’s quickly review
the basics of transistor switches.
First, as you may remember, the
three junctions of a bipolar transistor
are referred to as the base, the
collector, and the emitter. (In Figure
1, they are labeled “B,” “C,” and “E,”
respectively.) Second, the standard
symbol for an NPN transistor
includes a small triangle pointing
away from the base at the emitter
connection.
Third, when using an NPN (or
PNP) transistor as a switch, the
general rule is that the switch will
turn on (i.e., current will flow from
the collector to the emitter)
whenever the base is “taken toward”
the collector, i.e., whenever the base
is connected to the same voltage
level as the collector.
Finally, the transistor is not a
“perfect” switch. In other words,
there’s a small internal voltage drop
between the collector and the
emitter whenever the transistor
switch is “on.” For my setup, I
measured the drop to be about 0.3V.
In order to understand how the
transistor switch in Figure 1 functions
USB-to-Serial Adapters Revisited
Back in the June 2010
installment of the Primer,
we discussed the FTDI
USB-to-TTL serial cable,
and how a single cable
can be used to both power
and program a PICAXE
breadboard circuit. The
FTDI cable is simple to
use, plus it consumes
much less breadboard
space than the standard
AXE027 programming
cable and a separate
power supply. As a result, I
almost always choose the
FTDI cable whenever I'm
setting up a new PICAXE
breadboard project.
■ BY RON HACKETT PICAXE PRIMER
10 March 2015
■ FIGURE 1.
Inverter
schematic.
Click to subscribe to this magazine
user
The text includes one hundred and seventy-eight "s"s in total.
assistant