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

    Hi mackrackit,

    Question: How long does it take LEDave to wire a push_button_switch to a PIC16F684?

    Answer: About 48hrs

    I think the program below should work ok:

    Code:
    Total var word
    clear
    
    MAIN:
    if PORTA.5 = 0  then  count_up:
    IF PORTA.5 = 1  THEN      MAIN: 
        
    Count_up:
    let Total = Total + 1 
    pauseus 25   
    LCDOUT $FE,1
    LCDOUT $FE,$C0,DEC Total
    PAUSE 500    
    GOTO MAIN:
    LEDave current status: Eyes going, mind boarderline!

    Dvae

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by LEDave View Post

    I think the program below should work ok:

    Code:
    Total var word
    clear
    
    MAIN:
    if PORTA.5 = 0  then  count_up:
    IF PORTA.5 = 1  THEN      MAIN: 
        
    Count_up:
    let Total = Total + 1 
    pauseus 25   
    LCDOUT $FE,1
    LCDOUT $FE,$C0,DEC Total
    PAUSE 500    
    GOTO MAIN:
    It looks good.
    LEDave current status: Eyes going, mind boarderline!

    Dvae
    Hey, that means you have passed the initiation and are a full codder now.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    So the next thing it to WRITE 'Total' to EEPROM address, then READ that value and put it back into 'Total'.

    The theory is that when the PIC power supply is turned off then restarted last 'Total' reappears on the LCD.

    Dave

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


    Did you find this post helpful? Yes | No

    Default

    Yup, that is the mission
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    From the manual:

    Code:
     WRITE Address,Value
    So looking at the 16F684.PDF it says:

    The PIC16F684 has 256 bytes of data EEPROM
    with an address range from 0h to FFh.
    So would:
    Code:
    WRITE 0h,Total
    work? Not quite as simple as that he says! For one thing these are EEPROM BYTES and 'Total' is a WORD two BYTES for a starter.

    Dvae

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


    Did you find this post helpful? Yes | No

    Default

    You do not need to use HEX numbers for the address, PBP takes care of that.

    http://www.melabs.com/resources/samples.htm
    Might find the above .... interesting
    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

    Mmm. Well I kind of think I know what I have to do, it's break the VAR WORD Total up into two BYTES, allocate them each a memory space B1 & B1+1 (from the prog below) WRITE the BYTES to the memory locations then READ them back.

    Code:
            INCLUDE "modedefs.bas"          ' Include serial modes
    
    SO      VAR		PORTC.6					' Define serial output pin
    
    B1      VAR     BYTE					' Address variable
    W2      VAR     WORD					' Data variable
    
    
    mainloop:   
    
    		For B1 = 0 To 12 step 2			' Step 2 because each word requires 2 bytes of memory
            	W2 = B1 + 1000          	' Add 1000 to address
            	Write B1, W2.HIGHBYTE		' Write high byte of word
            	Write B1+1, W2.LOWBYTE		' Write low byte of word to next address
    		Next B1
    
    		For B1 = 0 To 12 step 2			' Step 2 to get word size data
            	Read B1, W2.HIGHBYTE		' Read high byte
            	Read B1+1, W2.LOWBYTE		' Read low byte
            	SerOut SO,T2400,[#W2," ",10,13]	' Display the word data
    		Next B1
    		
            SerOut SO,T2400,[10,13,10,13] 	' Skip 2 Lines
    
            GoTo mainloop                       ' Forever
    My reading of the program above is that B1 = 's ( 0,2,4,6,8,10,12) + 1000 this is then written and read from memory location B1 & B1+1 into WORD W2 am I close?

    Dave

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by LEDave View Post
    My reading of the program above is that B1 = 's ( 0,2,4,6,8,10,12) + 1000 this is then written and read from memory location B1 & B1+1 into WORD W2 am I close?
    Sounds like you understand it. Have you tried it yet?
    Dave
    Always wear safety glasses while programming.

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