A84

D.Dorling Jan'2001

What is A84? Error Handling Free-Form format Local Labels
Arithmetic Operations Defining Data Default Destinations Hex and Binary notations
RADIX Instruction Set Special Mnemonics Unique Mnemonics
Comments Batch File Support Converting Source Code Default base 10 RADIX
Ignored mnemonics The /ADD_COLONS switch. The LST file Error Messages
Other Messages Fatal Errors Sample Programs Download A84.zip

 

What is A84?

 

Error Handling

 

Free-Form format

 

Local Labels

 

Arithmetic Operations

 

Defining Data

 

Default Destinations

 

Hex and Binary notations

 

PIC16C84/16F84 Instruction Set

(As per Microchip publication DS35007A)


                                  Byte-Oriented File Register Operations

                  Mnemonic Ops    Description         Cycles  MSB (opcode)  LSB Status  Notes
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  ADDWF   f, d    Add W and f             1   00 0111 dfff ffff C,DC,Z  1,2
                  ANDWF   f, d    AND W with f            1   00 0101 dfff ffff    Z    1,2
                  CLRF    f       Clear f                 1   00 0001 lfff ffff    Z    2
                  CLRW            Clear W                 1   00 0001 0xxx xxxx    Z
                  COMF    f,d     Complement f            1   00 1001 dfff ffff    Z    1,2
                  DECF    f, d    Decrement f             1   00 0011 dfff ffff    Z    1,2
                  DECFSZ  f, d    Decrement f,Skip if 0  1(2) 00 1011 dfff ffff         1,2,3
                  INCF    f, d    Increment f             1   00 1010 dfff ffff    Z    1,2
                  INCFSZ  f, d    Increment f,Skip if 0  1(2) 00 1111 dfff ffff         1,2,3
                  IORWF   f, d    Inclusive OR W with f   1   00 0100 dfff ffff    Z    1,2
                  MOVF    f, d    Move f to d (w or f)    1   00 1000 dfff ffff    Z    1,2
                  MOVWF   f       Move W to f             1   00 0000 lfff ffff
                  NOP             No Operation            1   00 0000 0xx0 0000
                  RLF     f, d    Rotate Left f through C 1   00 1101 dfff ffff    C    1,2
                  RRF     f, d    Rotate Rght f through C 1   00 1100 dfff ffff    C    1,2
                  SUBWF   f, d    Subtract W from f       1   00 0010 dfff ffff C,DC,Z  1,2
                  SWAPF   f, d    Swap nibbles in f       1   00 1110 dfff ffff         1,2
                  XORWF   f, d    Exclusive OR W with f   1   00 0110 dfff ffff    Z    1,2

                  Bit-Oriented File Register Operations

                  BCF     f, b    Bit Clear f             1   01 00bb bfff ffff         1,2
                  BSF     f, b    Bit Set f               1   01 01bb bfff ffff         1,2
                  BTFSC   f, b    Bit Test f Skip if 0  1(2)  01 10bb bfff ffff         3
                  BTFSS   f, b    Bit Test f Skip if 1  1(2)  01 11bb bfff ffff         3

                  Literal and Control Operations

                  ADDLW   k       Add literal and W       1   11 111x kkkk kkkk C,DC,Z
                  ANDLW   k       AND literal with W      1   11 1001 kkkk kkkk    Z
                  CALL    k       Call subroutine         2   10 0kkk kkkk kkkk  __ __
                  CLRWDT          Clear Watchdog Timer    1   00 0000 0110 0100  TO,PD
                  GOTO    k       Go to address           2   10 1kkk kkkk kkkk
                  IORLW   k       Incl OR literal with W  1   11 1000 kkkk kkkk    Z
                  MOVLW   k       Move literal to W       1   11 00xx kkkk kkkk
                  RETFIE          Ret from interrupt      2   00 0000 0000 1001
                  RETLW   k       Ret with literal in W   2   11 01xx kkkk kkkk
                  RETURN          Return from Subroutine  2   00 0000 0000 1000  __ __
                  SLEEP           Go into standby mode    1   00 0000 0110 0011  TO,PD
                  SUBLW   k       Subtract W from literal 1   11 110x kkkk kkkk C,DC,Z
                  XORLW   k       Excl OR literal with W  1   11 1010 kkkk kkkk    Z

                    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'.
                    Note 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.
                    Note 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.

 

Special Mnemonics

These special mnemonics are as defined for MPASM and published by Microchip in their publication DS33014F:-


                         Mnemonic     Substituted           Mnemonic     Substituted
                         ~~~~~~~~     ~~~~~~~~~~~           ~~~~~~~~     ~~~~~~~~~~~
                         NEGF f,d     Comf f,f              BNDC k       Btfss 3,1
                                      Incf f,d                           Goto k

                         ADDDCF f,d   Btfsc 3,1             BNZ k        Btfss 3,2
                                      Incf f,d                           Goto k

                         ADDCF f,d    Btfsc 3,0             BZ k         Btfsc 3,2
                                      Incf f,d                           Goto k

                         SUBCF f,d    Btfsc 3,0             B k          Goto k
                                      Decf f,d              CLRC         Bcf 3,0
                                                            CLRDC        Bcf 3,1
                         SUBDCF f,d   Btfsc 3,1             CLRZ         Bcf 3,2
                                      Decf f,d              SETC         Bsf 3,0
                                                            SETDC        Bsf 3,1
                         BC k         Btfsc 3,0             SETZ         Bsf 3,2
                                      Goto k                SKPC         Btfss 3,0
                                                            SKPDC        Btfss 3,1
                         BDC k        Btfsc 3,1             SKPNC        Btfsc 3,0
                                      Goto k                SKPNDC       Btfsc 3,1
                                                            SKPNZ        Btfsc 3,2
                         BNC k        Btfss 3,0             MOVFW f      Movf f,w
                                      Goto k                TSTF f       Movf f,f

 

Unique Mnemonics

 

Comments

 

Batch File Support

 

Converting Source Code

 

Default base 10 RADIX

 

Ignored Mnemonics

 

Adding Colons - The /ADD_COLONS switch.

 

The LST File

 

Error Messages

 

Other Messages

 

Fatal Errors

Sample Programs

Download A84.zip

PICOUT.A84 - source code in A84 format for the PIC
PICIN.A86 - source code in A86format for the PC

The file PICOUT.A84 is a simple A84 program that sends a string via the parallel port to a PC.

To assemble it enter:-

A84 PICOUT.A84

.

This will transfer data using a single bit at a faster rate than can be obtained via RS232 using a 4Mhz crystal. As well, the PIC will wait indefinatly for the PC, and the PC for up to 10 seconds if either computer is interupted.

Connections to the PC parallel port:-

       PIC A3 (pin 2)  --> PRN S4 + (pin 13)
       PIC A2 (pin 1)  --> PRN S5 + (pin 12)
       PIC B6 (pin 12) <-- PRN C0 - (pin 1)
       PIC ground     <--> PRN ground (pin 25)

    Use 1K resistors in series with each data line.
    Also wire a Button switch or jumper from PIC B2 (pin 8) to ground.
  
To use it, run PICIN.COM on the PC. Be sure to check your port address. As it is, PICIN.COM is set to use port 0378. If you have A86 you can change this in the source code supplied (PICIN.A86) and re-assemble. If you don't have A86 you can download the shareware version from www.eji.com. A84 was written using A86.

Run PICIN and press button to send the string.

PICIN.COM times out after 10 seconds and returns to DOS when waiting for button press or char from PIC.

David Dorling

Email

Download A84.zip

Electronics Stuff

 

 

 

 

 

 

 

 


 

   * A86 is an assembler for the Intel 8086++ processors by Eric Isaacson,
     416 E. University Ave., Bloomington, IN 47401-4739  www.eji.com