PIC EEPROM programmer - almost working, not quite

Thread Starter

Tekk

Joined Apr 18, 2009
16
I've been working on a homemade Z80 computer, and it's time to load some sort of program into it to see if it's working.

Since I don't have an EEPROM programmer, I decided to make a simple PIC program to load a program onto the EEPROM I'm going to be using with the Z80.

I don't think it's working.
If I hook up leds to the address output, I can see the address incrementing. I can also see the write enable going low and high for each byte as I should. But when I hook up leds to the data output, they are always off.

Here's my source code, can you guys spot anything wrong with it?
Also, I suspect it might be a hardware fail (do I need pull up/down resistors of any kind when connecting the PIC to the EEPROM?)

Sorry if the indentation looks weird, Notepad adjusts tab widths to make it look nice but I don't think it's going to do that here.

Thanks a lot.

Rich (BB code):
    LIST P=16F628A, R=DEC

    #include "P16F628A.INC"

    __config  _INTRC_OSC_NOCLKOUT & _LVP_OFF & _WDT_OFF & _PWRTE_ON & _BODEN_ON 

        CBLOCK 0x20
        d1
        d2
        eep_byte
        address
        read_back
    ENDC

     ORG    0x000

    movlw 7
    movwf CMCON        ; CMCON=7 set comperators off         

    ; initialize ports      __     __
    movlw b'10010000'    ; OE and WE high (disabled)
    movwf PORTA
        
    clrf address
    clrf eep_byte
    clrf PORTB

    bsf STATUS,RP0          ; bank 1
    bsf OPTION,7        ; disable PORTB pull ups
    clrf TRISA
    clrf TRISB
    bcf STATUS,RP0          ; bank 0

loop    call read_ee            ; read byte from pic eeprom
    movwf eep_byte
    movf address,W        ; give address to eprom
    movwf PORTA
    movf eep_byte,W        ; give data to eprom
    movwf PORTB
    bcf PORTA,4        ; eeprom write enable
    call delay        ; wait a little
    bsf PORTA,4        ; eeprom write disable
    call delay        ; generous delays
    
    bsf STATUS,RP0        ; bank1
    movlw b'11111111'
    movwf TRISB        ; set portB to inputs
    bcf STATUS,RP0        ; bank0

    bcf PORTA,7        ; eeprom output enable
    call delay
    movf PORTB,W
    movwf read_back        ; read back data from eprom
    call delay
    bsf PORTA,7        ; eeprom output disable
    
    incf address,F        ; increase address in eprom    

    goto loop

read_ee bsf STATUS,RP0        ; Read byte from eeprom
    movf address,W
    movwf EEADR
    bsf EECON1,RD
    movf EEDATA,W        ; Store result in w
    bcf STATUS,RP0
    return

delay   movlw    0x1E
    movwf    d1
    movlw    0x4F
    movwf    d2
delay_0 decfsz    d1, f
    goto    $+2
    decfsz    d2, f
    goto    delay_0
    goto    $+1
    nop
    return

    org 2100h
    de "Hello"

    END
 

THE_RB

Joined Feb 11, 2008
5,438
I'd like to build a PIC based eprom programmer one of these days, I've got a lot of old window eproms.

Can you please post your schematic?
 
Top