12f675_fuse_about_to_blow!


Closed Thread
Results 1 to 40 of 929

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Tin hat on
    I wear one made of aluminum foil...

    Code:
    IF (GPIO.3=1) AND (GPIO.4=1) THEN
    Because of this both bits in question are "1" when not pressed. So they will invert to "0".
    If the thing was not sleeping that is.

    But wait...
    Code:
    DAT_OUT = %10101001
    They are "0"...

    What if one of the buttons are pressed?

    In the end, all eight bits of DAT_OUT are sent.

    Yes, I am being a cryptic smart _ _ _.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    I wear one made of aluminum foil...
    Spoken like a true engineer, even uses a ground plane as a hat

    Yes, I am being a cryptic smart _ _ _
    Well I know what I'll be doing tonight.... uncryptifying!

    Dave

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


    Did you find this post helpful? Yes | No

    Default

    It's looking like I'm going to need someone to hold my hand and gently walk me through this one as I'm confusing myself: Here's my latest piece of reasoning / thinking.....

    Right then:

    This is the data BYTE to be sent.

    Code:
     DAT_OUT = %10101001
    Bruce says:

    Only DAT_OUT bits 1 and 2 are used.
    So at the moment they're 0 - 0.

    So I'm going to leap in here and say that from the code below DAT_OUT.0[1] (bit one of the BYTE) will be equal to the inverted state of GPIO.3 (the program only gets to this piece of code after a button press though).

    Code:
    DAT_OUT.0[1]=~GPIO.3
    And DAT_OUT.0[2] (bit two of the BYTE) will be equal to the inverted state of GPIO.4

    Code:
    DAT_OUT.0[2]=~GPIO.4
    So taking SW1 as the button being pressed: GPIO.3 which was '1' when not pressed goes to '0' when pressed then gets inverted ~ to a '1' which becomes bit one of the BYTE.

    How does that sound? North of the North pole? South of the South South pole? Or under the ice at either pole?

    Dave
    Last edited by LEDave; - 17th November 2010 at 18:22.

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


    Did you find this post helpful? Yes | No

    Default

    I'm going to need someone to hold my hand


    So taking SW1 as the button being pressed: GPIO.3 which was '1' when not pressed goes to '0' when pressed then gets inverted ~ to a '1' which becomes bit one of the BYTE.
    Yup, you got it!
    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

    I'm going to need someone to hold my hand
    Well metaphorically speaking, I was beginning to panic figuring the code out.

    So am I right in thinking that the DAT_OUT byte:

    Code:
     DAT_OUT = %10101001
    Becomes:

    Code:
     DAT_OUT = %10101011
    When SW1 is pressed.

    And

    Code:
     DAT_OUT = %10101101
    When SW2 is pressed.

    The checksum:

    Code:
    ' Build checksum of 2 data bytes
        CHK_SUM = (DAT_OUT * 2)
    Will that always be the calculated value of BYTE:

    Code:
    DAT_OUT.0[2]=~GPIO.4
    Because this is the last BYTE to be read / run in the program sequence.

    Dave
    Last edited by LEDave; - 17th November 2010 at 22:43.

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


    Did you find this post helpful? Yes | No

    Default

    So am I right in thinking that the DAT_OUT byte:
    Yes, you have all of that correct.

    CHECKSUM..
    Because this is the last BYTE to be read / run in the program sequence.
    We are dealing with BITs here.
    Code:
        DAT_OUT.0[1]=~GPIO.3  'BIT #1 of DAT_OUT
        DAT_OUT.0[2]=~GPIO.4  'BIT #2 of DAT_OUT
    Back to what you have above that either BIT#1 or BIT#2 will be changed when a switch is pressed, DAT_OUT will be either
    %10101011
    or
    %10101101
    So...
    CHK_SUM = (DAT_OUT * 2)
    Will be
    CHK_SUM = (%10101011 * 2)
    or
    CHK_SUM = (%10101101 * 2)
    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

    We are dealing with BITs here.


    The penny has finally dropped

    So the checksum is made up of:

    Code:
    DAT_OUT = %10101001 Plus the BIT that has changed *2
    Cheers mackrackit, I need a lie down, I expect you do too:

    I don't know how you put up with me sometimes.

    Dave

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