Copy Link
Add to Bookmark
Report

NuKE Issue 08-011

  

-----BEGIN PGP SIGNED MESSAGE-----

NuKE_NuKE_NuKe_NuKE_NuKE_NuKE_NuKE_NuKE_NuKE_NuKE_N
uK Nu
KE "Introduction to RISC Assemble Language" uK
E_ "for the PIC16C5x Microcontrollers" KE
_N by E_
Nu Rock Steady _N
uK Nu
KE_NuKE_NuKE_NuKE_NuKE_NuKE_NuKE_NuKE_NuKE_NuKE_NuK

NuKE Info-Journal #8
April 1994

What's a PIC?
~~~~~~~~~~~~~

The PIC16C5x series of 8-bit microcontrollers are low-cost, low-power, high-
speed, CMOS devices that contain EPROM, RAM I/O, and a CPU in an 18 or 28
pin DIP package. The PIC16C5x microcontrollers clock from DC to 20 Mhz, have
8 to 20 I/O lines, and incorporate sleep, timer, and watchdog functions.

PIC OTP (One-Time Programmable) devices are also available. They are not
erasable either electrically or with ultraviolet light. PIC OTP parts are
typicaly plastic-cased and less expensive parts than their corresponding
devices that contain EPROM.

The PIC EPROM-bases devices are normally cased in ceramic packages with a
transparent window that allows the memory to be erased and reused just as in
the popular 27xxx series of EPROMs. These devices are ideal for the testing
and prototype phase design because they can be reused. However, they are much
more expensive that OTP devices.


The PIC16C5x Family
~~~~~~~~~~~~~~~~~~~
This family consists of four PICs at the moment, they are PIC16C54, PIC16C55,
PIC16C56, and PIC16C57. All are available in plastic OTP and ceramic EPROM
packages. For security-sensitive applications, each PIC device includes a
security EPROM fuse that can be programmed to prevent others from reading the
EPROM code. The differences in the four PIC16C5x parts are the oscillator
type, the number of I/O pins, and the size of the internal EPROM and RAM.

OVERVIEW OF UV-ERASABLE DEVICES
Part # | EPROM | RAM |I/O | Voltage | Osc. Freq| Pins #
---------+----------+--------+----+------------+----------+---------
PIC16C54 | 512 x 12 | 32 x 8 | 13 | 4.0 - 5.5V | DC-20Mhz | 18 pins
PIC16C55 | 512 x 12 | 32 x 8 | 21 | 4.0 - 5.5V | DC-20Mhz | 28 pins
PIC16C56 | 1K x 12 | 32 x 8 | 13 | 4.0 - 5.5V | DC-20Mhz | 18 pins
PIC16C57 | 2K x 12 | 80 x 8 | 21 | 4.0 - 5.5V | DC-20Mhz | 28 pins


RISC Assembler Instructions Set
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Not only is the PIC physically compact, its built-in high-efficiency
microcode allows compact programming. A 33-element, single-cycle, single-word
instruction set permits the creation of programs that would normally require
microcontrollers that use 100-element (or greater) multi-cycle, multi-byte
instruction sets. In comparisons, the 8749H has almost 50 MOV-oriented
instructions which actually make up only a small part of the complete
8749H instruction set. Each PIC16C5x instruction word is 12-bits in length
with the mnemonic (the opcode) and operand (the registor, memory location
or direct data to be manupulated) fully defined within the 12-bit word.


ALL 33 PIC16C5x INSTRUCTION SET
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Byte-Oriented File Register Operations

bit# 11-6 : OPCODE
5 : d (d=0 for destination W; d=1 for destination f)
4-0 : f(FILE #)

Instruction Name Mnemonic
Binary
--------------------------------------------------------------------
0001 11df ffff Add W and f ADDWF W + f -> d
0001 01df ffff AND W and f ANDWF W & f -> d
0000 011f ffff Clear f CLRF 0 -> f
0000 0100 0000 Clear W CLRW 0 -> W
0010 01df ffff Complement f COMF f -> d
0000 11df ffff Decrement f DECF f -1 -> d
0010 11df ffff Decrement f,skip if zero DECFSZ f -1 -> d, skip if zero
0010 10df ffff Increment f INCF f +1 -> d
0011 11df ffff Increment f,skip if zero INCFSZ f +1 -> d, skip if zero
0001 00df ffff Inclusive OR W and f IORWF W IOR f -> d
0010 00df ffff Move f MOVF f -> d
0000 001f ffff Move W to f MOVWF W -> f
0000 0000 0000 No Operation NOP
0011 01df ffff Rotate left f RLF f(n) -> d(n+1),
C -> d(0),f(7) -> C
0011 00df ffff Rotate right f RRF f(n) -> d(n-1), C -> d(7)
f(0) -> C
0000 10df ffff Subtract W from f SUBWF f - W -> d[f+W+1->d]
0011 10df ffff Swap halves f SWAPF f(0-3) <-> f(4-7) -> d
0001 10df ffff Exclusive OR W and f XORWF W XOR f -> d
-----------------------------------------------------------------------

Bit-Oriented File Register Operations

bit# 11-8 : OPCODE
7-5 : b(BIT #)
4-0 : f(FILE #)

Instruction Name Mnemonic Operation
Binary
-----------------------------------------------------------------------
0100 bbbf ffff Bit Clear f BCF 0 -> f(b)
0101 bbbf ffff Bit Set f BSF 1 -> f(b)
0110 bbbf ffff Bit Test f,skip if clear BTFSC test bit (b) in file (f)
0111 bbbf ffff Bit Test f,skip if set BTFSS test bit (b) in file (f)
------------------------------------------------------------------------

Literal and Control Operations

bit# 11-8 : OPCODE
7-0 : k(LITERAL)

Instruction Name Mnemonic Operation
Binary
------------------------------------------------------------------------
1110 kkkk kkkk AND Literal and W ANDLW k & W -> W
1001 kkkk kkkk Call subroutine CALL PC +1 -> Stack, k -> PC
0000 0000 0100 Clear Watchdog timer CLRWDT 0 -> WDT
101k kkkk kkkk Goto address (k is 9bit) GOTO k -> PC (9 bits)
1101 kkkk kkkk Incl. OR Literal and W IORLW k IOR W -> W
1100 kkkk kkkk Move Literal to W MOVLW k -> W
0000 0000 0010 Load Option register OPTION W -> OPTION register
1000 kkkk kkkk Return,place Literal in W RETLW k -> W, Stack -> PC
0000 0000 0011 Go into standby mode SLEEP 0 -> WDT, stop oscillator
0000 0000 0fff Tristate port f TRIS W -> I/O control register f
1111 kkkk kkkk XOR Literal and W XORLW k XOR W -> W
-----------------------------------------------------------------------

I can continue and give you the complete documentation on the PIC micro-
controllers, but that would be somewhat meaningless, as I don't wish to made
you (or myself) a master of PIC mirco's, but simply a simple understanding
of what this IC is. So you can understand how to modify it, or use it for
your own projects.

If more infomation is required, by yourself, you can email Rock Steady on
NuKENeT, and I will try to refer you to some good books you can pick up for
a better understanding.

But as a small tip, many of the 'Popular' electronic hobbist magazines, have
one time or another covered the issue of PICs. Mail them, or look them up, and
I'm sure you will find detailed articles on this, and many other micro's
available today.

-----BEGIN PGP SIGNATURE-----
Version: 2.2

iQCVAgUBLfmm2E0EOTLgG0HDAQEErQQAoNfAea1zFIDpc+b9+l9wGC63myycgUEY
6zHuR8oTTwnvVIqhK4ISVuedSvk94mkAQD8VlnQ2bKPFWdluyXMR1v4GSSrbraRK
kDdhcudo74+i7z9emh7Qyu5YhuzsPjW1C0UNr6ORdBKouuYgTbcJPAMAJBWMnoza
p/U+5iEwck8=
=9dJm
-----END PGP SIGNATURE-----

← previous
next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT