Automatic Toilet Flusher


Closed Thread
Results 1 to 40 of 99

Hybrid View

  1. #1
    Join Date
    May 2008
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    I'm using a 16F627A

    and yes, I've tried changing those numbers and I've tried using the numbers that Bruce posted, but I still get the same result regardless. I've also tried using a different servo (another parallax one)

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JohnnyV View Post
    I'm using a 16F627A
    and yes, I've tried changing those numbers and I've tried using the numbers that Bruce posted, but I still get the same result regardless. I've also tried using a different servo (another parallax one)
    So, you're running at 4Mhz (INTOSC). The PBP manual tells us that at 4Mhz, pulsout has a granularity of 10us. Your loop runs from 200 to 1200, meaning 2000us (2ms) to 1200 (12ms). A bit out of the range of a normal servo ya think? Unless you've got one of the oddball ones...

    Also, try turning off the WDT and Brown-Out reset for grins... You might be killing the battery voltage when the servo tries to move and causing a reset.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Use GOSUB VS GOTO if the routine you're going to uses RETURN to get back.

    Disable onboard comparators with CMCON=7 before trying to use a pin that
    has the comparator feature.

    Give this a shot;
    Code:
    @ __config _INTOSC_OSC_NOCLKOUT &_WDT_ON &_PWRTE_ON &_MCLRE_OFF &_BODEN_ON &_CP_OFF &_DATA_CP_OFF &_MCLRE_OFF
    
    
    servo1 var Porta.0
    x var byte
    CMCON=7 ' <-- disable analog comparators
    
        low servo1
        HIGH PORTB.3
    	
    loop:	
        pause 500
        low portb.3
        pause 500
        high portb.3
        GOSUB move   ' <-- use GOSUB VS GOTO
        pause 2000
        low portb.3
        GOTO loop
    
    move:
        for x = 200 to 100 STEP -1 ' 2mS to 1mS pulse
          pulsout servo1,x
          pause 18
        next x
        pause 2000
      		
        for x = 100 to 200 ' 1mS to 2mS pulse
          pulsout servo1,x
          pause 18
        next x
        pause 2000
        return
      		
       END
    This should cycle your servo from one side to the other. Tested with a
    Parallax servo.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    Join Date
    May 2008
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Bruce, works beautifully, thank you!

Similar Threads

  1. Automatic 240V / 110V selector
    By The Master in forum Off Topic
    Replies: 5
    Last Post: - 13th October 2008, 00:33
  2. LCD automatic management?
    By ruijc in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th September 2008, 11:24
  3. Automatic VB6 to pic serial connection
    By arniepj in forum Code Examples
    Replies: 13
    Last Post: - 10th January 2008, 07:57
  4. Automatic turn off
    By AMay in forum Schematics
    Replies: 22
    Last Post: - 6th February 2006, 12:31

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