12F508 strange timing


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2007
    Posts
    2

    Default 12F508 strange timing

    My circuit uses GP3 as an input (I modified 12F508.inc) and INTRC_OSC

    The second block of this code (starting with the lable ccw loops at about 1/6th of the speed of the bit below the if statement???

    Anyone seen anything like this?

    Many thanks in advance

    PK


    OPTION_REG.5=0 'need to set this to use pin2 as an output
    OPTION_REG.6=0 'this turns on the internal pull up resistors


    stepDelay con 20 'delay in mS for each step

    TRISIO=%01000 'set GPIO.3 as an input, all othe pins as outputs

    loop: if GPIO.3=1 then ccw
    GPIO=%00110
    pause stepDelay
    GPIO=%00101
    pause stepDelay
    GPIO=%10001
    pause stepDelay
    GPIO=%10010
    pause stepDelay
    goto loop

    ccw: GPIO=%10010
    pause stepDelay
    GPIO=%10001
    pause stepDelay
    GPIO=%00101
    pause stepDelay
    GPIO=%00110
    pause stepDelay
    goto loop

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by pk7639 View Post
    OPTION_REG.6=0 'this turns on the internal pull up resistors
    You know this doesn't affect all GPIO pins...right?

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


    Did you find this post helpful? Yes | No

    Talking

    Quote Originally Posted by pk7639 View Post
    My circuit uses GP3 as an input (I modified 12F508.inc) and INTRC_OSC

    The second block of this code (starting with the lable ccw loops at about 1/6th of the speed of the bit below the if statement???

    Anyone seen anything like this?

    Many thanks in advance

    PK


    OPTION_REG.5=0 'need to set this to use pin2 as an output
    OPTION_REG.6=0 'this turns on the internal pull up resistors


    stepDelay con 20 'delay in mS for each step

    TRISIO=%01000 'set GPIO.3 as an input, all othe pins as outputs

    loop: if GPIO.3=1 then ccw
    GPIO=%00110
    pause stepDelay
    GPIO=%00101
    pause stepDelay
    GPIO=%10001
    pause stepDelay
    GPIO=%10010
    pause stepDelay
    goto loop

    ccw: GPIO=%10010
    pause stepDelay
    GPIO=%10001
    pause stepDelay
    GPIO=%00101
    pause stepDelay
    GPIO=%00110
    pause stepDelay
    goto loop

    Hi,

    May be I've missed something ...

    but I see here you write the state of an input pin ... Try to write each pin one after each other instead of the whole port at once !!!

    or better ... During the PAUSE, place the whole port as input, write your OUTPUT pins pattern ( 1 per 1 ), and AFTER, change for needed outputs with TRISIO ...

    that is what we do for having directly output pins in a certain config, at power up ...

    Alain



    Alain
    Last edited by Acetronics2; - 21st April 2007 at 17:17.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  4. #4
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    GP3 is always an input pin no matter what you do.

    Also, when you set a pin as an output pin, like you frequently do in your code, the weak pull-up register won't work the next time the same pin is set to be an input pin.

    If you assign a pin as an input pin AFTER you set it to an output pin previously, then you need to register to weak pull-up register again.



    ----------------------------
    Last edited by sayzer; - 22nd April 2007 at 10:45.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default

    Ah, ...

    Last but not least ...

    is MCLR configured as "internal MCLR" ... ???

    didn't see anything about ...

    Alain

    PS: May be THIS .asm listing could help ... same function, but rotation selected by TWO pins ( stop allowed ...) !!!
    Attached Files Attached Files
    Last edited by Acetronics2; - 22nd April 2007 at 09:58.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  6. #6
    Join Date
    Apr 2007
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    [QUOTE=Acetronics;36807]Ah, ...

    Last but not least ...

    is MCLR configured as "internal MCLR" ... ???

    Thanks for the reply Alain,
    I modified the inc file and set MCLR_OFF.

    I've since refined it, it has nothing to do with the blocks of code. Pulling GPIO low slows the chip down. It has this effect on the simplest of code (flashing led). Tonight I'll write something in C to see if it's a language thing.
    The circuit is a friends, I'll draw a schematic from the board layout and see if he's done anything hinkey..

    PK

Similar Threads

  1. 12F683 serout timing
    By Hobie Cat in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 21st December 2009, 16:57
  2. Convert code 12C508 to 12F508
    By Olivier in forum General
    Replies: 2
    Last Post: - 25th October 2009, 16:19
  3. 18F2550 timing
    By sstt1976 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 22nd August 2008, 00:30
  4. HSEROUT buffering and timing - 16F88
    By picster in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 5th March 2006, 17:52
  5. Strange ASM file
    By barkerben in forum General
    Replies: 2
    Last Post: - 29th November 2004, 18:54

Members who have read this thread : 1

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