12F675 / MCLR use


Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653

    Default 12F675 / MCLR use

    Hi,

    Who could explain me that ???

    This simple program is a flip-flop with button debouncing ... simple, eh !

    ( Button1 is on the low side - LOW level if pushed )

    When using MCLR ... output ( GPIO.2) is LOW at power-up ... Ok

    When disabling MCLR ( internal reset ) ... output is HIGH at power-up ... ???
    Instead to what it should be !!!

    Did I miss something ???

    Code:
    ' Madproject
    '
    'Anti rebond pour sauter à la perche ( ??? )
    '
    ' 16F629 mode INTOSC @ 4 Mhz
    '
    ' le 03/09/2009 139 Lignes
    '******************************************************************************
    '******************************************************************************
    
    '******************************************************************************
    ' CONFIG
    '******************************************************************************
    
     @    __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _BODEN_ON
     
    DEFINE OSC 4
    DEFINE OSCCAL_1K 1
    DEFINE BUTTON_PAUSE 100
    
    ADCON0		= 0
    ANSEL		= 0
    CMCON		= 7
    VRCON 		= 0
    OPTION_REG.5 = 0
    OPTION_REG.7 = 1   	'Disable Pull-Ups
    
    
    
                                                  
    Bouton1     VAR GPIO.0
    Bouton2     VAR GPIO.1
    Sortie      VAR GPIO.2
    'LedVisu     VAR GPIO.3			' Attention : Sortie PIC en C/O !!!
    LedVisu		 VAR GPIO.4
    'set         VAR GPIO.5
    
    x           VAR byte
    Delay		VAR byte
    
    GPIO 		= %00000011			'All pins LOW IF outputted - no startup bug.
    TRISIO 		= %00000011         'set GPIO.0 & GPIO.1 as inputs Others Output
    
    '******************************************************************************
    Attente: ' On attend !!!
    '******************************************************************************
    
        Delay = 0
       	BUTTON Bouton1,0,255,0,Delay,1,Action		' Poussoir à la masse enfoncé
    
    	PAUSE 10									' 10 ms entre scans
    	GOTO Attente   								' Non? : retour départ 
     
    '******************************************************************************   
    Action:	' On a enfoncé le bouton plus de 100 ms
    '******************************************************************************
    
       TOGGLE Sortie								' On inverse la sortie
       TOGGLE LedVisu
       
    '******************************************************************************   
    Attente2: ' On attend que le bouton soit relâché ...
    '******************************************************************************
    
       Delay = 0
       BUTTON Bouton1,1,255,0,Delay,1,Attente		' Le bouton est il relaché ???
       												'
       GOTO Attente2									'  NON On boucle
    
    '******************************************************************************   
       END
    Alain
    Last edited by Acetronics2; - 3rd September 2009 at 20:00.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. How to MCLR by code for 16F877
    By fbestepe in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 26th November 2014, 00:51
  2. MCLR as PIN on 12F675
    By rgregor in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th October 2009, 09:46
  3. 12F675 MCLR directive MPASM
    By OLDSCHOOL in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th May 2008, 01:29
  4. 12F675 won't reprogram or erase
    By modifyit in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 19th May 2006, 05:07
  5. I/O pin and MCLR
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 1
    Last Post: - 15th July 2004, 10:52

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