PIC16f876 writing recieved serial data to eeprom


Closed Thread
Results 1 to 2 of 2
  1. #1
    Woobie's Avatar
    Woobie Guest

    Question PIC16f876 writing recieved serial data to eeprom

    Howdy all,

    Pretty new at this stuff but having fun. This one has got me.
    I have a little code that basically echos what I type on my terminal, works great . Now I want to save what I type to my EEPROM (in future need to save gps data that I specify) however the eeadr incr to the next addr, the code recieved from the terminal is saved to RxHold, when I write RxHold to EEDATA as below, it writes the same incorrect data to every inc position no matter what I type. if I MOVF RxHold,w and write it to my LCD the data is correct, somewhere in the write cycle it is getting all messed up.

    below is my write cycle (as per the datasheet)

    sorry not in C or Basic (still to new for that and have no compiler) use MPASM


    Thanks all



    write
    MOVLW EEWRITE ;INC EEWRITE ADDR
    MOVWF FSR
    BSF STATUS,RP1 ;
    BSF STATUS,RP0 ;BANK 3
    BTFSC EECON1,WR ;WAIT FOR WRITE TO FINNISH
    GOTO $-1 ;GO BACK ONE IF NOT
    BCF STATUS,RP0 ;BANK 2
    MOVF INDF,w ;MOVE NEXT ADDR TO W
    MOVWF EEADR ;WRITE TO EEADR
    MOVF RxHold,w
    MOVWF EEDATA ;WRITE TO EEDATA
    BSF STATUS,RP0 ;BANK 3
    BCF EECON1,EEPGD ;POINT TO DATA MEMORY
    BSF EECON1,WREN ;WRITE ENABLE
    ; ********* NEXT ONLY IF USING INTERUPTS ******
    ; BCF INTCON,GIE ;DISABLE INTERUPTS
    MOVLW 0x55 ;REQUIRED
    MOVWF EECON2 ;EECON2
    MOVLW 0xAA ;REQUIRED
    MOVWF EECON2 ;EECON2
    BSF EECON1,WR ;START WRITE OPERATION
    ; ********* NEXT ONLY IF USING INTERUPTS ******
    ; BSF INTCON,GIE ;ENABLE INTERUPTS
    BCF EECON1,WREN ;WRITE DISABLE

    BCF STATUS,RP1 ;
    BCF STATUS,RP0 ;BANK 0
    INCF EEWRITE,f

    return

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    I hate to say that but i must...

    Assembler, MBasic, MikroBasic, PROTON, Microchip C, HI-Tech C,Pascal, Fortran, Cobol, Qbasic,VisualBasic, Foxpro, C++, Visual C, Java and i forget some to save space, must be asked on their specific forum...

    Microchip have their own forum and a great tech support.

    I'm sorry for those who know the solution for the above but, rules are rules...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Data EEPROM gets clobbered during programming
    By BrianT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th July 2008, 02:46
  2. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  3. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  4. Internal EEPROM Read/write Addressing Errors with 18F PIC's
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 18
    Last Post: - 12th July 2005, 19:42
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts