12f675_fuse_about_to_blow!


Closed Thread
Results 1 to 40 of 929

Hybrid View

  1. #1
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Yup, family comes first. In the end that is all we got.
    Never a truer word....

    Hope things turn out well.
    Thank you and they have I'm very relieved to say.

    Back on the case tomorrow after a good nights sleep.

    Dave

  2. #2
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    Things pretty much back to normal here (panic over)

    So here's the first part of the brief, I think it covers these components:

    Power UP: Read EEPROM: Transfer value from EPROM to VAR: Press Button:
    VAR adds one to it's self: Display VAR on LCD
    I didn't want to try and do any more just in case I'm wildly off track on this, what do you think? I've left out all the DEFINES for clarity.

    Code:
    Total var word        ' Data variable
    B1      VAR     BYTE  'Stored DATA address
    clear                 'Re_set volatile memory to zero (Not EEPROM?)
    
    MAIN:
    gosub Power_up        'On Power_up GOTO READ EEPROM subroutine
    Start:
    if PORTA.5 = 0  then  count_up: 'If button pressed start counting
    IF PORTA.5 = 1  THEN     Start: 'If button not pressed loop until it is
        
    Count_up:                 'Button has been pressed
    let Total = Total + 1     'Add one to value of Total taken from EEPROM   
    LCDOUT $FE,1              'Clear LCD
    LCDOUT $FE,$C0,DEC Total  'Display Total on LCD
    PAUSE 500
    GOTO Start: 
    
    Power_up:                 'Power_up subroutine
    Read B1, Total.HIGHBYTE	  ' Read high byte
    Read B1+1, Total.LOWBYTe  ' Read low byte  
    LET Total = Total         'Set Total to value set in EEPROM Memory
    return
    Dave
    Last edited by LEDave; - 4th May 2010 at 17:42.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Glad to hear things are back to normal.

    A quick look and it looks OK, might want to add a WRITE to EEPROM routine though...
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Glad to hear things are back to normal.
    Cheers mackrackit, it was a real worry there for a while.....

    might want to add a WRITE to EEPROM routine though...
    I'm be on it tonight.

    Dave

  5. #5
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    I've added the WRITE to EEPROM routine. Also @power_up the LCD was blank, so I
    added an LCDOUT statement to the Power_up Subroutine which now displays the last stored
    EEPROM value.

    The whole thing works a treat I can see the merits of being able to write data to a non volatile memory, really,really useful. Thanks for stearing me through this one (as ever) very clever.


    Code:
    Total var word        ' Data variable
    B1      VAR     BYTE  'Stored DATA address
    clear                 'Re_set volatile memory to zero (Not EEPROM?)
    
    MAIN:
    gosub Power_up        'On Power_up GOTO READ EEPROM subroutine
    
    Start:
    if PORTA.5 = 0  then  count_up: 'If button pressed start counting
    IF PORTA.5 = 1  THEN     Start: 'If button not pressed loop until it is
        
    Count_up:                 'Button has been pressed
    let Total = Total + 1     'Add one to value of Total taken from EEPROM
       
    LCDOUT $FE,1              'Clear LCD
    pause 150
    LCDOUT $FE,$C0,DEC Total  'Display Total on LCD
    Write B1, Total.HIGHBYTE  ' Write high byte of Total word to EEPROM
    Write B1+1, Total.LOWBYTE ' Write low byte of Total word to next address
    goto start:
     
    Power_up:                 'Power_up subroutine
    Read B1, Total.HIGHBYTE	  ' Read high byte
    Read B1+1, Total.LOWBYTe  ' Read low byte  
    LET Total = Total         'Set Total to value set in EEPROM Memory
    LCDOUT $FE,1              'Clear LCD
    pause 150                 'Give LCD a chance to Power_up
    LCDOUT $FE,$C0,DEC Total  'At Power_up display Total on LCD from EEPROM
                              'Memory which has been stored since Power_down
    return
    Just going to pop around my bench to turn the power back on........Yep still working

    Dave

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    COOL!!!!

    Do you want another mission?
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Do you want another mission?
    You bet, I wanted you to sign me off on the last Mission first though

    It's one thing me thinking I've done something right, it's another being told I have.

    Dave
    Last edited by LEDave; - 4th May 2010 at 21:48.

Members who have read this thread : 0

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