12f675_fuse_about_to_blow!


Results 1 to 40 of 929

Threaded View

  1. #22
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: 12f675_fuse_about_to_blow!

    I started by looking at your first code:

    Code:
    'Then check the buttons again
     IF (GPIO.3=1) AND (GPIO.4=1) THEN
    'Look for ENDIF near the end.  
    'If button are still pressed then it goes to ENCODE
    'If not, go back to MAIN and the INTERRUPT ON CHANGE will be reset
    Encode: 
    E_OUT=1          ' Enable transmitter (+ lights RFEN LED on demo board)
    PAUSEUS 25       ' Allow RF stage to stabilize 
        ' Only DAT_OUT bits 1 and 2 are used. We add a few 1's in bit
        ' positions 0,3,5,7 to balance out the data packet being sent.
        DAT_OUT = %10101001
        ' Get data on button inputs & invert 0's to 1's
        DAT_OUT.0[1]=~GPIO.3
        DAT_OUT.0[2]=~GPIO.4
        INTCON.0 = 0  ' Clear int on change flag
     
        ' Build checksum of 2 data bytes
        CHK_SUM = (DAT_OUT * 2)
     
    Transmit:
        SEROUT2 D_OUT,BAUD,[PreAmble,Synch,DAT_OUT,DAT_OUT,CHK_SUM]
        PAUSE GUARD ' 5mS guard time gives decoder time to respond,calculate,change,etc.
        ENDIF
        GOTO Main
    If GPIO.3 and GPIO.4 are both 1, then neither are being pressed when pull-up resistors are used.


    Code:
    'If button are still pressed then it goes to ENCODE
    'If not, go back to MAIN and the INTERRUPT ON CHANGE will be reset
    I read these comments backwards to what the code does.


    Personally, the technique of using 1 for OFF and 0 for ON is extremely confusing; it makes trying to follow your code extremely difficult. I always use pull-down resistors and 0=OFF / 1=ON 'cause that's how binary works as well as power switches.

    EDIT: Unless it's a requirement for Sleep mode to have current ON, and the interruption signals Wake.

    Otherwise, if power consumption is an issue, I'd keep the line OFF, saving power, and only applying a bit of current to Wake.
    Last edited by Demon; - 15th May 2011 at 22:08.

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