Input problems with 12F629?


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: Input problems with 12F629?

    hi there

    can you tell me from where you got the syntax " PAUSE ..." in your pgm !

    I am using C language and dont know such a syntax

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


    Did you find this post helpful? Yes | No

    Default Re: Input problems with 12F629?

    Loop is one of those reserved words in PBP3 and I'm pretty sure in earlier versions. It really fouls things up.

    If your inputs and outputs are either high or low you want to set all your pins to digital with analog select register. i.e ansel=0. Otherwise the pins get sensed in the middle and often never toggle.

    if you want gpio.0 to be low then I think you need low gpio.0 not just low 0.

    I've never used PULSOUT before but I'm certain you need to spell out gpio.0 and not just 0

    Most people recommend a CLEAR at beginning and a END at end.

    I'd also recommend you turn on capitalization of commands in PBP. It helps me recognize some of the reserved words and commands.

    If you'll post schematic I'll run it on simulator if you like.

    Code:
    clear 
    Define OSCCAL_1K 1 
    CMCON=7 ' disable analog comparator
    ansel=0
    TRISIO=111110 ' set GPIO as output
                     ' others as input
    i VAR BYTE
    
    ' commented out low 0
    low gpio.0
    
    pause 100
    
    ' commented outloop:
    main:
        if GPIO.1=1 then turn1
        if GPIO.2=1 then turn2
    '  commented out   goto loop
    goto main
    
    turn1:
        for i=0 to 5
    ' comment out        pulsout 0, 147
    pulsout gpio.0, 147
            pause 20
            next i
    ' commented out    goto loop
    goto main
    
    turn2:
        for i=0 to 5
    ' comment out        pulsout 0, 152
    pulsout gpio.0, 152       
            pause 20
            next i
    'commented out    goto loop
    goto main
    
    end

  3. #3
    Join Date
    Feb 2013
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re:syntax for loop delay with 12F629?

    thanks avionics master.

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


    Did you find this post helpful? Yes | No

    Default Re: syntax for loop delay with 12F629?

    This one should work ... ( ISIS tells so ... )

    Code:
    '****************************************************************
    '*  Name    : SERVOTEST0                                        *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2013 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 10/02/2013                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : 12F629 @4 Mhz internal                            *
    '*          :                                                   *
    '****************************************************************
    
    #CONFIG
       __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _CP_OFF & _MCLRE_OFF
    #ENDCONFIG
    
    Servo   var GPIO.0
    Right   var GPIO.1
    Left    var GPIO.2
    
    Define OSCCAL_1K 1 
    CMCON   =7 ' disable analog comparator
    ' ansel=0  NO ANSEL with the '629 !!!...
    TRISIO  = %11111110 ' set GPIO as output
                     ' others as input
    i VAR BYTE
    clear 
    
    low Servo
    pause 100
    
    ' commented outloop:
    main:
    
    while 1
        IF Right THEN
            pulsout Servo, 147
        ELSEIF Left THEN
            PULSOUT Servo, 152
        ELSE
            PULSOUT Servo, 150  ' Center/stop ( ? ) if no button pushed ...   
        ENDIF
        
        Pause 19
        
    WEND
           
    end
    Alain
    Last edited by Acetronics2; - 10th February 2013 at 15:12.
    ************************************************** ***********************
    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. Timing input pulses and re-outputting them
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2007, 01:50
  2. Input problems
    By ALFRED in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 23rd July 2006, 21:02
  3. Using GPIO.3 as input on 12F629
    By Sharky in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th May 2006, 19:41
  4. Input on 12F629
    By BGreen in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th March 2005, 11:14
  5. 12F629 I2C problems
    By AIW128ProGuy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th November 2004, 23: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