>sorry to ask you this ... i am trying to program the data eprom area
>with the code below should this work ?? if not could yo point me in the
>right direction as i am new to pics and programing in assembler
>many thanks..
>
>Dion Heskett
>
>email
spam_OUTdionhTakeThisOuT
fastnet.co.uk
>
>ps.. sorry to be a pain !!!
>
>
> list p=16c84, r=dec
>;
>; PIC register and I/O definitions
>;
>IND0 equ 0 ; Indirect access register
>RTCC equ 1
>PC equ 2 ; Low order bits of PC
>status equ 3 ; Status Register
>; Status register bits
>cy equ 0 ; Carry flag
>dcarry equ 1 ; Digit carry
>zero equ 2 ; Zero
>pdown equ 3 ; Power down bit
>tout equ 4 ; Timeout
>RP0 equ 5 ; RAM page 0
>RP1 equ 6 ; RAM page 1
>irp equ 7 ; ROM page
>; End of bits
>FSR equ 4 ; File select register
>Port_a equ 5
>; Port A bits
>; End of bits
>Port_b equ 6
>; Port B bits
>; End of bits
>; Port 8 is the EEPROM data register
>EEDATA equ 8 ; EEPROM data
>EECON1 equ 088h ; EEPROM control register
>; Bits for EECON1
>EE_RD equ 0 ; Read control
>EE_WR equ 1 ; Write control
>EE_WREN equ 2 ; Write enable
>WW_WRERR equ 3 ; Write error
>WW_EEIF equ 4 ; Write complete
>; End of bits
>EEADR equ 9 ; EEPROM address
>EECON2 equ 89h ; EEprom control reg 2
>PClatH equ 0ah ; High order bits of PC
>intcon equ 0bh ; Interrupt control
>;
>; Destination definitions for xxxwf instructions
>;
>W equ 0 ; Target is W register
>SAME equ 1 ; Traget is file
>;
> org 0
>;
>; Copy a data block to the EEPROM
>;
>start clrf EEADR ; Start from address 0
>loop movf EEADR,W ; Get the address
> call getbyte ; Read in the byte
> movwf EEDATA ; Store the data
>
>; Write the byte in the EEPROM
>
> bsf status,RP0 ; Point to register bank 1
> bsf (EECON1 & 7fh),EE_WREN ; Write enable on
> movlw 0x55 ; Magic number #1
> movwf (EECON2 & 7fh)
> movlw 0xAA ; Magic number #2
> movwf (EECON2 & 7fh)
> bsf (EECON1 & 7fh),EE_WR ; Set the write flag
>Wwait1 btfsc (EECON1 & 7fh),EE_WR ; Wait for write flag to drop
> goto Wwait1
> bcf status,RP0 ; Back to bank 0
>
>; Go to the next address, and continue
>
> incf EEADR,SAME ; Point to the next address
> btfss EEADR,6 ; Gone over 63?
> goto loop ; No, continue
>
>;
>; Just spin until power off
>;
>
>spin goto spin
>
>;
>; Get a byte of data from the table
>;
>getbyte addwf PC,SAME ; Get the data
>
>; This is the data table for the MASTER PIC 16C84
>
> retlw 0xE9
> retlw 0xC7
> retlw 0x8A
> retlw 0x06
> retlw 0x3C
> retlw 0x58
> retlw 0xBE
> retlw 0x2D
> retlw 0xE9
> retlw 0xB4
> retlw 0xC7
> retlw 0xA5
> retlw 0xFC
> retlw 0xA7
> retlw 0xD0
> retlw 0x0E
> retlw 0xDE
> retlw 0xAD
> retlw 0xBE
> retlw 0xEF
> retlw 0xDE
> retlw 0xAD
> retlw 0xBE
> retlw 0xEF
> retlw 0xDE
> retlw 0xAD
> retlw 0xBE
> retlw 0xEF
> retlw 0xDE
> retlw 0xAD
> retlw 0xBE
> retlw 0xEF
> retlw 0xE9
> retlw 0xAD
> retlw 0x54
> retlw 0x09
> retlw 0x4A
> retlw 0x81
> retlw 0x3A
> retlw 0xA1
> retlw 0xE9
> retlw 0xA3
> retlw 0xA6
> retlw 0xE6
> retlw 0x7F
> retlw 0x0B
> retlw 0x44
> retlw 0x40
> retlw 0xC1
> retlw 0x6B
> retlw 0x14
> retlw 0x00
> retlw 0xD6
> retlw 0x4A
> retlw 0x52
> retlw 0x43
> retlw 0x59
> retlw 0x44
> retlw 0xA3
> retlw 0xB4
> retlw 0xCE
> retlw 0x84
> retlw 0xB6
> retlw 0x33
>
> end
>
>
>