Instruction Manual

AN88
6 AN88Rev2
APPENDIX
PIC16F84 Microcode to Interface to the CS5525/6/9
;*************************************************************************************
;* File: 55261684.asm
;* Date: November 15, 1996
;* Programmer:Keith Coffey
;* Revision: 0
;* Processor: PIC16F84
;* Program entry point at routine "main". The entry point is address 0x05.
;*************************************************************************************
;* Program is designed as an example to interface a PIC16F84 to a CS5525/6/9
;* ADC. The program interfaces via a software SPI which controls the
;* serial communications, calibration, and conversion signals. Other ADC’s
;* (16-bit and 20-bit) in the product family can be used.
;*************************************************************************************
;******** Memory Map Equates
INDF equ 0x00 ; Indirect Address Register
STATUS equ 0x03 ; STATUS register equate
FSR equ 0x04 ; File Select Register
PORTA equ 0x05 ; General Purpose I/O Port
TRISA equ 0x85 ; Data Direction Control For Port A
RP0 equ 0x05 ; Register Bank Select Bit
CS equ 0x00 ; Port A bit 0
SDI equ 0x01 ; Port A bit 1
SDO equ 0x02 ; Port A bit 2
SCLK equ 0x03 ; Port A bit 3
LED equ 0x04 ; Port A bit 4
TRUE equ 0x01 ; Represents logic 1
HIGHBYTE equ 0x0C ; Upper 8 bits of Conversion Register
MIDBYTE equ 0x0D ; Middle 8 bits of Conversion Register
LOWBYTE equ 0x0E ; Lowest 8 Bits of Conversion Register
COMMANDBYTE equ 0x0F ; One byte RAM storage location
TEMP equ 0x10 ; A Temporary Data Storage Register
COUNT equ 0x11 ; Used to store count for delay routine
SPDR equ 0x12 ; Reserved for Serial Peripheral Data Reg.
CARRY_BIT equ 0x00 ; Represents the Carry Bit in Status Reg.