Input problems with 12F629?


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    May 2009
    Posts
    40


    Did you find this post helpful? Yes | No

    Default Re: Input problems with 12F629?

    ANSEL and CMCON are only required for a 12f675 that has analog input capability. A12f629 does not have analog inputs so these commands are not required for the 12f629.
    The clear command is not required and the variable "I" is also not needed as there are no for/ next loops in the program. A While 1 / wend forms a continuous forever loop so the goto command after the wend is not required. The pause 19 is in the loop so that the pulses are send every 19 milliseconds which is the repeat rate required by the servo decoder.

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


    Did you find this post helpful? Yes | No

    Default Re: Input problems with 12F629?

    Hi, Graham

    Good !

    1) I wanted to wipe line about " I var " ... but timeout for editing post caught me !!! - seriously - that doesn't change anything to the produced Hex , as it's just a compiler directive ...

    2) I also wanted to add
    Code:
    LOW Servo
    just before each PULSOUT Command ... BTW ... could you tell us why ?
    to understand the "why" ... just plug and unplug the servo plug for 5 or 6 times in a row ... with power ON

    and 3) ... CLEAR might much better be after declaring the variables ... no ???

    and ... 4) BINARY numbers must be written %01010101 ... for
    Code:
    TRISIO =
    Everything told now !

    Alain
    ************************************************** ***********************
    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 " !!!
    *****************************************

  3. #3
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Input problems with 12F629?

    Thanks for straightening me out. You learn something new every day.

  4. #4
    Join Date
    Mar 2008
    Posts
    59


    Did you find this post helpful? Yes | No

    Default Re: Input problems with 12F629?

    I have read this thread several times and looked at the datasheet several time as well. I am having problems with code that has worked fine in the past and suddenly I can not make GPIO.0 and GPIO.3 function as inputs. This is the code I have used in the past. I have added a TRISIO statement and this does not seem to help either. “TRISIO = %11001011”
    This code works on GPIO.1 but not on GPIO.0 and GPIO.3. I have used three ICs and continue to have no luck?

    #IF __PROCESSOR__ = "12F629"
    #DEFINE MCU_FOUND 1
    #CONFIG
    cfg = _INTRC_OSC_NOCLKOUT ; INTOSC oscillator: I/O function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN
    cfg&= _WDT_ON ; WDT enabled
    cfg&= _PWRTE_OFF ; PWRT disabled
    cfg&= _MCLRE_OFF ; GP3/MCLR pin function is digital I/O, MCLR internally tied to VDD
    cfg&= _BODEN_ON ; BOD enabled
    cfg&= _CP_ON ; Program Memory code protection is enabled
    cfg&= _CPD_OFF ; Data memory code protection is disabled
    __CONFIG cfg
    #ENDCONFIG
    #ENDIF
    #IFNDEF MCU_FOUND
    #ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]"
    #ENDIF

    CMCON = 7
    SYMBOL LTIN = GPIO.0 'input
    SYMBOL RTIN = GPIO.1 'input
    SYMBOL LTOUT = GPIO.2 'output
    SYMBOL FOURIN = GPIO.3 'input
    SYMBOL RTOUT = GPIO.4 'output
    SYMBOL PEIZO = GPIO.5 'output

    Over:
    IF LTIN = 1 THEN HIGH PEIZO
    IF LTIN = 0 THEN LOW PEIZO
    IF RTIN = 1 THEN HIGH PEIZO
    IF RTIN = 0 THEN LOW PEIZO
    IF FOURIN = 1 THEN HIGH PEIZO
    IF FOURIN = 0 THEN LOW PEIZO

    GOTO OVER

  5. #5
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Input problems with 12F629?

    See this post : http://www.picbasic.co.uk/forum/show...=7072#post7072
    Maybe is useful !

  6. #6
    Join Date
    Mar 2008
    Posts
    59


    Did you find this post helpful? Yes | No

    Default Re: Input problems with 12F629?

    I just found my problem. It was these two lines

    SYMBOL RTOUT = GPIO.4

    SYMBOL PEIZO = GPIO.5

    I had changed my board on the last run and forgot to change the pin numbers in the code. The input was working fine it was the output the whole time.My silly mistake

    SYMBOL RTOUT = GPIO.5

    SYMBOL PEIZO = GPIO.4

    I am back up and running thank You for your reply!

Similar Threads

  1. Timing input pulses and re-outputting them
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2007, 02:50
  2. Input problems
    By ALFRED in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 23rd July 2006, 22:02
  3. Using GPIO.3 as input on 12F629
    By Sharky in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th May 2006, 20:41
  4. Input on 12F629
    By BGreen in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th March 2005, 12:14
  5. 12F629 I2C problems
    By AIW128ProGuy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th November 2004, 00:41

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