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

    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

  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
    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.

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


    Did you find this post helpful? Yes | No

    Default

    Sounds like you understand it. Have you tried it yet?
    I'm on it.......

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


    Did you find this post helpful? Yes | No

    Default

    I modified it to run on my LCD and it counts from 1000 to 1012 by adding two, then does it all over again.

    So the first loop is WRITING the count to memory and the second is READING and displaying from memory to the LCD. B1 being the high BITS of the BYTE that make up W2 and B1+1 the low bits of W2, is that right?

    So to complete our 'mission' should I try and do the same and use a loop or assign BYTES to a WORD (if that makes sense).

    Dave

  5. #5
    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 modified it to run on my LCD and it counts from 1000 to 1012 by adding two, then does it all over again.

    So the first loop is WRITING the count to memory and the second is READING and displaying from memory to the LCD. B1 being the high BITS of the BYTE that make up W2 and B1+1 the low bits of W2, is that right?
    Yup!
    So to complete our 'mission' should I try and do the same and use a loop or assign BYTES to a WORD (if that makes sense).

    Dave
    ????

    You have the WORD size var holding the value of how many times the switch was pressed. Use the high byte low byte thing from above for writing every time the switch is pressed. Only need to read the EEPROM when the chip starts.

    Something like that
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Something like that
    I'll give it a go, not a 100% sure on this one but I'll give it go.

    This is brilliant stuff though, cheers mackrackit.

    Dave

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


    Did you find this post helpful? Yes | No

    Default

    Mission clarification

    Power UP
    Read EEPROM
    Transfer value from EPROM to VAR

    Press Button
    VAR adds one to it's self
    Display VAR on LCD
    Write VAR to EEPROM
    Wait for another Button press

    This message will self destruct in.....
    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