This is only a preview of the March 1999 issue of Silicon Chip. You can view 34 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "Simple DIY PIC Programmer":
Articles in this series:
Items relevant to "Easy-To-Build Audio Compressor":
Items relevant to "Low Distortion Audio Signal Generator; Pt.2":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
AT LAST: A
SIMPLE, CHEAP,
EFFECTIVE, D-I-Y,
PIC PROGRAMMER
With few exceptions, designs published in SILICON CHIP
have steered clear of PIC microcontrollers because of the
difficulty home constructors have had in programming
them. All that is about to change
...
change...
DESIGN BY MICHAEL A. COVINGTON*
ARTICLE BY ROSS TESTER
34 Silicon Chip
F
IRST OF ALL, we should deBoth the flash program memory
most popular PIC, the 16F84 (and
scribe the PIC microcontroller and the EPROM inside the PIC can be with very minor program mods, the
because many readers might erased and re-programmed so, within
16F83 and 16C84). When we say simthink they haven’t come across them reason, you can keep on using the
ple, we mean just that. It contains no
before. That is almost certainly not same chip over and over. In fact, the specialised components, it connects
true, because these days there is flash program memory is only guaran- to the printer port of any PC running
hardly an electronic device which
teed for 1000 erase/write cycles while
freely downloadable software, and it’s
doesn’t have a microcontroller buried
the EPROM is guaranteed for just a inexpensive: the whole kit including
somewhere in it. And a huge number few more cycles – ten million, in fact! a PIC 16F84 sells for less than $30.
of those would be PICs.
Of course, there are many other
This project first appeared in the
But using and/or programming
microcontrollers but it is the PIC
September 1998 edition of the US
the PIC as a device in its own right?
which has captured most attention
magazine, “Electronics Now”. The auWe agree, that’s an entirely different
in the d-i-y market because of its thor, Michael A Covington, described
matter. Again, though, just what is
price and ease of use. It is made by his project as a “no parts” PIC proa PIC? Come to think of it what is a Microchip Inc in the USA and a lot
grammer because of the very few extra
micro-controller?
more information about PICs can be bits needed. Much of the text in this
obtained from their website, www.mi- article is adapted from the original.
It is a tiny computer, complete with
crochip.com – it’s well worth a visit. Michael also acknowledged the work
CPU, ROM, RAM and I/O circuits all
A word to the wise: be careful about of David Tait in England in producing
on the one chip. There are various
downloading if you’re on a time- or a PIC programming package called
versions of the PIC microcontroller,
megabyte-based ISP. The PIC16F8X “TOPIC”, of which this programmer is
the most common (for our purposes)
a direct descendant.
being the 16 series: 16F84
(the most popular, with
Also described
68 bytes of RAM and 1024
in the article was a
words of program memory
companion “demo”
in “flash” EEPROM which
circuit of an 8-LED
can be rewritten at least a
chaser (partly as a
million times); the 16C84
learning aid but also
(similar but with an older
handy for checking
type of EEPROM); and
that the main prothe 16F83 which has only
ject worked). Branhalf the memory of its big
co Justic, of Oatley
brothers.
Electronics, saw the
project and liked
We will concentrate on
the idea – and its
the 16F84 (even though this
simplicity. He also
project will also program
knew it would be
the 16C84 and 16F83). It
much more popular
operates from a supply
if based on a PC
anywhere from 4V to 6V
board rather, than
(some versions work down
Pin connections for the 16F84 PIC from Microchip, Inc. Pins 1-3,
the Veroboard used
to 2V!) and there are 13 pins 6-13 and 17-18 are all input or output ports, depending on what
by the original.
which can be either inputs the program tells them to be.
or outputs.
So he designed a
board for not only the
These PICs are extremely
programmer but also the chaser. While
versatile little chips, capable of being data sheet pdf file alone is 124 pages
long (1.35MB) – and the MPLAB pro- both the programmer and chaser are
programmed (in assembly language,
on the one board, they are easily sepbut don’t let that scare you!) to do an gram is over 8MB.)
(For more background on PICs, arated. Therefore the programmer and
enormous range of tasks. What’s more,
refer to the article in the August 1994
chaser can be operated independently,
the program will stay in memory for a
issue. Though now rather dated as far if you want.
guaranteed 40 years. As an old friend
as devices are concerned, the basic
of SILICON CHIP often says, “It’ll see
All of that resulted in the project
information is still current).
me out . . .”
presented here: a simple, cheap but
A PIC microcontroller also formed
effective PIC programmer. If you’ve
What sort of tasks? Virtually anything capable of being switched, the “heart” of the BASIC Stamp pro- ever thought about getting into PICs,
controlled, measured, actuated, com- ject (January 1999) – the big advantage this is the way to do it!
of using a PIC alone, of course, is the
pared. . . You’ll find PICs in everything
Getting the data in
difference in cost. The downside (at
from the mouse attached to your
least until now) has been the difficulty
computer to the car you’re driving,
We keep talking about ease of use.
from microwave ovens to washing in programming the PIC.
So how do you use a PIC? How do you
machines, from digital clocks to inget your program into it?
The PIC programmer
ter-stellar rockets. Well, maybe not
It’s quite simple: with power apinterstellar rockets . . . but you get
And that brings us to this project. plied to the PIC, the voltage on pin 4
the picture.
It’s a very simple programmer for the
is raised to between +12V and +14V.
MARCH 1999 35
taking D2’s anode low.
This turns off D2, blocking
current flow. The PIC chip
is then free to receive data
from pin 14 of the printer
port, with the programming voltage switched by
transistor Q1.
The connection that D1
creates between printer
port pins 11 and 17 lets
the programming software
detect if the programmer is
connected to the port.
There are also two
LM317 regulators – one
of which is a fixed 13V
supply while the other
is a variable 4-6V supply
which covers the 5V rail.
Both of these are powered
from a nominal 13.8VDC
plugpack which actually
supplies around 17-18V.
Fig.1: the PIC Programmer, which plugs into your PC via its parallel
You might be wondering
port (printer) socket. IC1 is the PIC actually being programmed.
why the second supply is
variable, not fixed at 5V
Data is then clocked in one bit at a PC can read data from pin 13 of the which, of course, would be easier. It’s
time into pin 13. As each bit goes in, PIC through pin 11 of the printer port. variable to allow reliability checking
the voltage on pin 12 is raised to +5V
OK, we’ve got that far. But where of the data – but more of this anon.
for at least 0.1µs (yes, microsecond!) does that data going into the PIC
If plugging the DB25 connector
before being sent low (0V) again.
come from?
directly into your computer’s paralThe data stream going into pin 13
That’s the job of this little program- lel port is inconvenient or difficult,
contains both the commands that
mer. In conjunction with virtually any you can use a suitable DB25-male to
specify the various steps in the pro- PC with a parallel port and suitable DB25-female parallel printer extengramming process, as well as the data
(free!) programs, the programming sion cable. But make sure that it is
itself that will be stored in the chip.
data and clock signals are applied to not a serial cable – some of these are
The PIC can also send its contents
the appropriate PIC pins at the right not wired “straight through” but have
back out through pin 13 to verify that
time. We’ll get to the programs in a
crossovers built in.
it has stored the correct data. When moment.
Before moving away from the cirpin 17 of the printer port is high, the
cuit diagrams, Fig. 2 shows the PIC
The circuit
demonstration circuit. This simply
Refer now to Fig.
has eight LEDs with current-limiting
1 – the PIC program- resistors connected to eight of the 13
mer circuit diagram. I/O ports. The “demo.asm” file proAs you can see, when
grams the PIC to make the LEDs chase
we claimed it was
each other, wait a short time, then start
simple we weren’t
again, ad infinitum.
kidding: just two
Such a chaser could be made with
s t e e r i n g d i o d e s , an oscillator/pulse generator and a
a transistor and a
counter, probably at a much lower
sprinkling of pas- cost than this demonstration circuit.
sive components and But look at the component count on
that’s about it.
the demo board: just the PIC, a supThe diodes are
ply bypass capacitor, an R/C circuit
used to sense when
which generates the pulses (using the
data is going from PIC itself) and nothing else except the
the PIC back to the LEDs and their series resistors! All the
PC. R1 & D2 provide work is done by the PIC.
pull-up for the data
What’s more, if you want to change
signal.
When
pin
17
the
chase pattern, the timing or any
The completed PIC Programmer, shown separated from
of the printer port is
other factor in this version, it’s just
the demo PC board. As you can see, the number of
low, D1 conducts,
a matter of re-programming. With
components is small.
36 Silicon Chip
Fig.2 (left): the circuit of
the add-on PIC
demonstration board
which is an 8-LED chaser.
The separated chaser PC
board is shown at right.
As supplied, the chaser
board will be attached to
the PIC programmer PC
board (as shown on the
opening page and in the
component overlay
below). There is no
reason to separate these
boards unless you have
a reason to do so. The
chaser will confirm your
PIC Programmer is
working properly and
you can always re-use the
PIC.
conventional chaser circuits, you’re
up for a new PC board and probably
additional components.
Both the programmer and chaser
have been combined on one PC board,
the component overlay of which is
shown in Fig.3.
Construction
Because of the few components,
construction is relatively straightforward. Just keep in mind that many
of the components are polarised,
including the LEDs. These all mount
the same way down the edge of the
PC board – so if one looks different to
the others, it’s probably back to front.
Speaking of different, the prototype
chaser had four different LED colours
– red, yellow, green and orange. While
this looks pretty, we reckon it tends
to spoil the “chase” effect. Hopefully
kits will have all the one colour LED.
The DB25 socket is soldered directly to the PC board, not forgetting the
shell earthing pins at each end. Like
the IC sockets, spacing of the DB25
pads is pretty close so you’ll need a
fine iron and a good light. Check and
double check that you haven’t bridged
any pads together.
The PIC chip(s) should be left until
last and inserted into their sockets
only after you have thoroughly check
ed your component placement and
soldering. In fact, it’s probably a good
idea to do a voltage check prior to
inserting the PIC: the two wire links
make excellent test points. There
should be about 13V between the link
alongside C5 and the shell of the DB25
socket and there should be somewhere
Fig.3: the component overlay for both the PIC programmer and demonstration
chaser, in this case together on one PC board. If you do decide to separate them,
it’s best to do it before assembly and soldering!
between 4V and 6V (depending on the
setting of VR1) between the link below
R8 and the DB25 shell.
If you get these figures (or close to
them) turn off the power, ready for
insertion of the PIC. If not, send out
the search party for your mistake or
poor solder joint!
It’s important to have all the pins of
the PIC straight and lined up with the
holes in the socket before insertion.
Many a time we’ve seen projects not
working because one pin is folded
up under the IC, or missed the socket
entirely and gone down the side! The
notch (or dot) on the PIC goes towards
the top of the PC board when held
with the DB25 socket on the left (ie,
so the printing on the PC board reads
correctly).
The software you need
Now we come to the good bits (sorry
about the pun!) – actually writing a
PIC program, compiling it and “burning” the program into the PIC’s memory. The easiest way to learn to use
the programmer is to write a simple
program, in this case, the LED Chaser.
That’s why space for the chaser is
included on the PC board.
The program is first written in
assembly language. Unfortunately,
a primer on assembly is outside the
scope of this article but for those who
don’t know anything about assembly
language, we’ve listed the code for
the chaser (demo.asm) in Listing 1.
You can either type in the code in
any text editor or word processor or
MARCH 1999 37
; File DEMO.ASM
; Assembly code for PIC16F84 microcontroller
; Blinks LEDs on outputs in a rotating pattern.
; With 75-kHz osc, each LED stays on 1/2 second.
; CPU configuration
;
(It’s a 16F84, RC oscillator,
;
watchdog timer off, power-up timer on)
processor 16f84
include <p16f84.inc>
__config _RC_OSC & _WDT_OFF & _PWRTE_ON
; Declare variables at 2 memory locations
J
equ
H’1F’
; J = address hex 1F
K
equ
H’1E’
; K = address hex 1E
; Program
org
0
; start at address 0
; Set port B as output and initialize it
movlw B’00000000' ; w := 00000000 binary
tris
PORTB
; port B ctrl register := w
movlw B’00000001' ; w := 00000001 binary
movwf PORTB
; port B itself := w
; Rotate the bits of port B leftward
mloop: rlf
PORTB,f
; Waste some time by executing nested loops
movlw D’50' ; w := 50 decimal
movwf J
; J := w
jloop: movwf K
; K := w
kloop: decfsz K,f
; K = K-1, skip next if zero
goto kloop
decfsz J,f
; J = J-1, skip next if zero
goto jloop
; Do it all again
goto mloop
end
Listing 1: the listing of demo.asm, ready for compiling.
It can also be downloaded – see panel at the end of
this feature.
you can download the listing (see
panel). We've also printed the PIC
16XFX instruction set and opcode
field descriptions to give you a better
understanding.
Incidentally, while on the subject of
downloading, two items of software
are needed to use the PIC programmer.
That’s the bad news. The good news
is that both are free!
The first of these is a program
called “MPLAB” and is just one of
the goodies available from the Microchip website (www.microchip.com).
Designed to operate under Microsoft
Windows, it’s a full-featured development program for compiling and
testing PIC programs.
MPLAB is called an assembler:
it lets you edit assembly-language
programs (also called source code),
assemble them into object code, then
step through the resulting binary code
to see if it will actually work in the
microcontroller. This is before you’ve
committed any code to the PIC chip
38 Silicon Chip
– you can spot any
logical errors in your
program first.
The second program
is noppp.zip which,
(when unzipped)
contains the software
which controls your
computer’s parallel
port and sends the
programming data to
the PIC.
It’s available from
the Oatley Electronics website, or from
Michael Covington's
website, www.mindspring.com/~coving-ton.noppp (links
also available from
www.siliconchip.com.
au).
Demo.asm
Let’s look briefly at
that chaser program
assembly language
code. Note the notes:
throughout the listing there are notes,
or comments, (each
line or part of a line
commencing with a
semicolon [;]). These
have no effect on the
program (the assembler will ignore them)
but remind the programmer later on
what, or why, parts of the program
achieved. They’re like a “rem” statement in BASIC and other programs.
The first few lines are such comments. The first “real” instructions
are the lines which begin:
processor 16f84 (tells the assembler to
use the instruction set for the 16F84
PIC);
include <p16f84.inc> (says to include
a set of predefined constants in a file
called P16F84.INC; and
_config RC _OSC & _WDT_OFF &
PWRTE_ON (sets various configuration bits in the PIC to turn some
hardware features on and off – the RC
oscillator on, the “watchdog” timer
off and the automatic power-up reset
timer on.
It is important to use the _config
instruction in any programs used with
this PIC Programmer. The assembler
program will not be doing the actual
programming, only creating a file with
the numbers that will be transferred to
the PIC chip as a second step.
The two equ instructions reserve
memory space in the PIC’s RAM for
two variables called J and K at hex 1E
and 1F. Counters are stored here to
keep track of how many times a loop
has been repeated. This is similar
to declaring variables in BASIC but
we need to tell the PIC which RAM
locations will be used.
The org instruction tells the assem-
Fig.4: MPLAB, a free (but lengthy) download from www.microchip.com, allows
you to assemble and test PIC programs before committing them to the chip. Not
only does that save you time, it also saves you wearing out the PIC chip (you
only have 1000 or so erase/program cycles to play with!)
Parts List
1 PC board, 107 x 60mm
1 DB25 male socket, PCB
mounting
1 18-pin IC socket
1 plugpack supply, 13.8VDC
(nominal) <at> 1A (around 1718VDC no load)
Semiconductors
1 PIC16F84, PIC16C84 or
PIC16F83 microcontroller
(unprogrammed)
1 BC548 NPN transistor
2 1N914 signal diodes
2 LM317 adjustable positive
regulators
Fig.5: one of the screens from Michael Covington's “NOPPP” PIC programming
software. The first screens allow you set your printer port and the type of PIC.
After inserting the PIC and turning power on, you are presented with the
programming options (shown) from which you can load the HEX file compiled
by MPLAB, change the type of PIC, program a PIC, erase a previously
programmed PIC and verify that the PIC has been programmed correctly.
bler that the program starts at location
0 in program memory and that the
actual program is next.
The follows a comment (;Program)
and the first of the real PIC instructions:
movlw B’00000000' clears a working
register called W. That number is
coped into the TRIS control register for port B (tris PORTB), setting
pins 6-13 to output pins instead of
input pins. Next, the program puts
a binary 1 into the W register (movlw
B’00000001') and copies it to port B,
(movwf PORTB) which lights the LED
connected to pin 6.
Almost immediately, though, the
program executes a RIF command
which rotates the contents of port
B to the left, changing the data to
00000010.
Because the processor works so fast,
you wouldn’t actually see the “chase”,
so a delay loop is built in before the
data shifts and the next LED lights.
This stores the decimal number 50 in
locations J & K then uses the decfsz
instruction to count down from 50
to 0. This gives a delay of about half
a second, after which time the goto
mloop instruction repeats the process.
The next LED (on pin 7) is lit and
the LED on pin 6 is extinguished. The
data then changes to 00000100, then
00001000, and so on, lighting each
LED in turn after the delay loop.
The end control is not a CPU instruction; rather it tells the assembler
that the program is over.
Compiling the program
Having typed, or downloaded the
assembly language program, now we
come to compile it using the Microchip MPLAB program.
MPLAB comes with ample instructions so we won’t go into it in depth
here. As downloaded, MPLAB is
zipped so must be unzipped and installed. Then it is opened in Windows.
Just one point, though: when compiling demo.asm, MPLAB will give
you an error message because the TRIS
instruction previously mentioned has
been discontinued by Microchip. As
we have used it, though, it still works
fine on the PIC chips described. TRIS
should not be used on “real” applications, as distinct from this demo program. (There are other ways to do the
same task but they are not as simple).
PIC “Burning”
This is where the second program,
noppp.zip, comes in. Again, as downloaded, it is zipped. This program,
though, operates under DOS or Windows 95/98/3.11. If you’re still using
Windows 3.11 (unlikely, if you’re
into programming PICs!), it’s better
to use full screen mode rather than
a window.
Capacitors
2 10µF 25VW PC electrolytics
2 1µF 25VW PC electrolytics
3 0.1µF monolithic bypass
capacitors
Resistors
1 4.7kΩ
1 2.2kΩ 1 1.2kΩ
3 1kΩ
1 270Ω 2 120Ω
1 200Ω horizontal trimmer
Extra components required for
demonstration “Chaser”
1 programmed PIC16F84
8 LEDs, same colour
8 390Ω resistors
1 10kΩ resistor
1 0.1µF polyester or monolithic
capacitor
1 .01µF monolithic capacitor
1 18-pin IC socket
It was written to run under DOS to
provide the clock pulses necessary for
programming. You will recall these
pulses need to be at least 0.1µs long.
In practice, they are made longer to
avoid any signal “bounce” in the cables. But they cannot be too long, or
programming will be slowed down
too much. Because of the huge range
of computer speeds now available,
it was also important that the timing
pulses not depend on the CPU speed.
This has been done using one of the
timers built into the PC motherboard.
One of these timers, the one normally
used to produce tones from the internal speaker, can be set to provide a
delay of 25µs. So even on the fastest
Pentiums the programming pulses are
not too short. By the way, the software
will even work on a 4.77MHz XT!
A screen grab of the NOPPP program
is shown in Fig.5. As you can see, it is
MARCH 1999 39
a simple menu-driven program which
gives you a number of self-explanatory options. Before you get this far,
however, you should have connected
the programmer to the parallel port
without power connected to the programmer. In fact, you should NEVER
connect the programmer with power
on, nor should you insert or remove
a PIC chip from the programmer with
power on. The PIC chip should be in
place before plugging the programmer
into the parallel port.
In general, you would load an object-code file (with .hex extension)
into memory, select the type of PIC
to be programmed, apply power to
the programming board and program
the PIC. You should always verify
that the program has transferred to
the PIC before exiting the program,
turning power off to the programmer
and removing the PIC chip.
Obviously, the same menu is used
to erase an existing program in a PIC.
Variable 5V supply
Earlier, we mentioned that the 5V
supply can be varied between +4V and
+6V. This is used in the verify process
to ensure that the PIC has indeed been
programmed correctly and guarantees
reliability.
By far the greatest unreliability in
EPROMs is caused by some cells not
being completely erased before being
re-used, or not being completely programmed.
If a particular location is only partly
programmed it might read correctly
for a while but then shift to a wrong
value with age or changes to the sup-
info.com
ply voltage. By programming the PIC
with a 5V supply, then verifying it at
4V, 5V and 6V, you change the threshold voltages that define the 0s and 1s
and so any marginally programmed
bits will change with the changed
supply voltage.
It’s a double check that even many
high-priced commercial programmers
don’t have available. But with this
cheap and easy to use programmer,
once you have fully verified your PIC
is programmed, you know it really is!
Exact voltages aren't important –
simply program with the trimmer at
its centre position (5V), then verify
with the trimmer at its centre, minimum (4V) and maximum (6V).
Each instruction is a 14-bit word
divided into an OPCODE which
specifies the instruction type and
one or more operands which further
specify the operation of the instruction. The instruction set summary
lists byte-oriented, bit-oriented,
and literal and control operations.
Opcode field descriptions are shown
below.
For byte-oriented instructions, ‘f’
represents a file register designator
and ‘d’ represents a destination
Where do you get it?
The complete kit of parts – PC
board, components to build both the
PIC Programmer and the demo chaser
– is available by mail order from Oatley Electronics for $29.00 plus $6.00
pack & post. (PO Box 89, Oatley NSW
2223, phone (02) 9584 3563, fax (02)
9584 3561, email oatley<at>world.net or
via website www.oatleyelectronics.
com.au).
A 13.8V/1A (nominal) plugpack
power supply (which actually puts
out about 17V or so) is available for
$12.00, while additional PIC16F84
chips are also available for $12.00.
*Michael Covington's own website (see
below) is regularly updated with latest
versions of software, etc and is a good
site to visit for a mine of information if
you're at all interested in PICs or PIC
SC
programming.
Here's where to find the file downloads or links to
downloads mentioned in this article.
* In general, ftp sites are better for larger files
Filename/Size Details
Downloadable from
NOPPP(1).ZIP Zipped file containing
169KB
noppp.exe, noppp.c
nopppf4s.tif, demo.asm,
demo.hex, readme.txt &
topic02.zip
www.mindspring.com/~covington/noppp
www.siliconchip.com.au
www.oatleyelectronics.com.au
MPL40(1).ZIP Zipped file containing
8.32MB
MPLAB software
http://www.microchip.com
ftp://ftp.microchip.com *
51025b.pdf
3.12MB
Adobe PDF file containing full MPLAB manual
http://www.microchip.com
ftp://ftp.microchip.com *
30430c.pdf
1.35MB
Adobe PDF file containing full PIC 16F8X
application notes
http://www.microchip.com
ftp://ftp.microchip.com *
40 Silicon Chip
PIC 16XFX INST
OPCODE FIELD DESCRIPTIONS
f
W
b
Register file address (0x00 to 0x7F)
Working register (accumulator)
Bit address within an 8-bit file
register
k
Literal field, constant data or label
x
Don’t care location (= 0 or 1) The
assembler will generate code with
x = 0. It is the recommended form of
use for compatibility with all
Microchip software tools.
d
Destination select; d = 0: store
result in W, d = 1: store result in
file register f. Default is d = 1
label Label name
TOS
Top of Stack
PC
Program Counter
PCLATH Program Counter High Latch
GIE
Global Interrupt Enable bit
WDT
Watchdog Timer/Counter
TO
Time-out bit
PD
Power-down bit
dest
Destination either the W register or
the specified register file location
[]
Options
()
Contents
→
Assigned to
<>
Register bit field
∈
In the set of italics User defined
term (font is courier)
Note 1: When an I/O register is modified as
a function of itself ( e.g., MOVF PORTB, 1),
the value used will be that value present on
the pins themselves. For example, if the data
latch is ‘1’ for a pin configured as input and
is driven low by an external device, the data
will be written back with a ‘0’.
2: If this instruction is executed on the TMR0
register (and, where applicable, d = 1), the
prescaler will be cleared if assigned to the
Timer0 Module.
3: If Program Counter (PC) is modified or
a conditional test is true, the instruction
requires two cycles. The second cycle is
executed as a NOP.
TRUCTION SET
designator. The file register designator
specifies which file register is to be
used by the instruction.
The destination designator specifies
where the result of the operation is to
be placed. If ‘d’ is zero, the result is
placed in the W register. If ‘d’ is one,
the result is placed in the file register
specified in the instruction.
For bit-oriented instructions, ‘b’
represents a bit field designator which
selects the number of the bit affected
by the operation, while ‘f’ represents
the number of the file in which the bit is
located.
For literal and control operations, ‘k’
represents an eight or eleven bit constant or literal value.
The instruction set is highly orthogonal
and is grouped into three basic categories: Byte-oriented operations
Bit-oriented operations
Literal and control operations
All instructions are executed within
one single instruction cycle, unless a
conditional test is true or the program
counter is changed as a result of an
instruction.
In this case, the execution takes two
instruction cycles with the second
cycle executed as a NOP. One instruction cycle consists of four oscillator
periods. Thus, for an oscillator
frequency of 4MHz, the normal
instruction execution time is 1µs. If a
conditional test is true or the program
counter is changed as a result of an
instruction, the instruction execution
time is 2µs.
MARCH 1999 41
|