Trouble pulling pin Low


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005
    Posts
    6

    Default Trouble pulling pin Low

    I have portb.4 going out to a camera controller. The pin is held high with a 10k resistor. In order to turn the camera on, I have to take the pin to ground for about 200ms. It seems to work a couple of times and then stops working. I've tried to monitor the pin with an O-scope, and it doesn't appear to be going low. I wrote a real simple program to test.

    loop:
    if portb.1 = 1 then
    low portb.4
    pause 200
    high portb.4
    goto loop
    endif

    I'm using a 16F628. I've tried another pic to make sure I haven't damaged the original. It seems strange though that it will work once or twice and then stop. I also removed the camera from the equation and just put my scope on the pin. Same thing...goes low once or twice and then stays high. Maybe there is an electrical issue here I'm missing.

  2. #2
    Join Date
    Jan 2005
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    take a look where the goto command is... so it jumps only to the loop marker if your condition is true!

    if portb.1 = 0 then the programms doesn't execute the lines between if and endif and jumps to the next command after endif. probaply there is nothing or only an end command. which finish the programm.

    take this structure :

    loop:
    if portb.1 = 1 then ' only when condition is true
    low portb.4
    pause 200
    high portb.4
    endif

    goto loop ' infinity

    end

  3. #3
    Join Date
    Jul 2005
    Posts
    65


    Did you find this post helpful? Yes | No

    Lightbulb

    Hello

    You may want to try this too:

    DEFINE OSC 4 ' 4 MHz Crystal

    TRISB.4 = 0
    PORTB.4 = 1

    WHILE 1
    IF PORTB.1 == 1 THEN
    PULSOUT PORTB.4, 20000 ' Generates accurate 200 ms High-Low-High pulse
    ENDIF

    WEND ' Infinitly repeat this loop

    END

Similar Threads

  1. Is this a K Type sensor?
    By jessey in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 21st November 2009, 13:55
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 17:07
  5. 4-line LCD Help - using PortA instead of B
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 31st March 2005, 03:14

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