Reading if Pin is High or Low?


Closed Thread
Results 1 to 30 of 30

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Each side of the switch goes to the Port pin. There is a Resistor, one end on the Port pin, the other is nailed to +5v. That's why they are called Pull-UP - they pull UP to +5v when the pin is unused. When you close the switch, it drops the pin voltage to 0v.

  2. #2
    Spindle's Avatar
    Spindle Guest


    Did you find this post helpful? Yes | No

    Default

    Melanie,

    I am sorry for my newby-ness (new word). I am not an Electrical Engineer just a highschool student working on a summer project.

    Right now i have the center of the switch going to ground. Then the sides of the switch going through a 10k ohm resistor, then to PORTB.5 and PORTB.7 respectively. I also have a 5 volt bus. Does anything have to be connected to it? Like a jumper from PORTB.5|7 to 5 volt as well?

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    A image is always welcome i guess
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=388&stc=1">

    OR, as Melanie suggested, remove those pull-up resistor, and add
    Code:
    OPTION_REG.7=0
    at the top of your code. This will enable the internal pull-up.
    about VB code, tags and blah blah click here
    Attached Images Attached Images  
    Last edited by mister_e; - 31st July 2005 at 20:51.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Spindle's Avatar
    Spindle Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks you two! It works now. I cound't have done it with out yah!

  5. #5
    Spindle's Avatar
    Spindle Guest


    Did you find this post helpful? Yes | No

    Question

    Ok the only problem is now if I switch it one way and then switch it to the middle the motor still goes because I guess the command is still being sent to the motor driving circuit. There is however a _break pin you can control. See attached image. Other than how its wired from the diagram mister_e posted the ground that comes off my chip goes to the switch and then to PIN 12. This drives it low and disables the H-Bridge on circuit. The problem when the switch is turned left or right for forward and reverse movement nothing happens because _break is still being driven low. I can't think how I can make it high when the switch is left or right. Maybe instead of connecting the pin to the ground, connect it to another portb pin and when its switch left make that pin high but i don't think to 5 volt supplies will work on a switch :P again I am no electrical engineer but am trying my hardest. Any help is apreciated. Please check out the picture I basically want to do that with the break switch but only when the SPDT switch is in the middle. When its to the left and right have _break go back high.
    Attached Images Attached Images  

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    can you provide the whole datasheet or a link of this specific motor controller???
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Spindle's Avatar
    Spindle Guest


    Did you find this post helpful? Yes | No

Similar Threads

  1. SERIN MIDI out of Synch?
    By jncortes in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th June 2009, 20:08
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. Pic16f84 and RC5 kode
    By terminator in forum Bluetooth
    Replies: 5
    Last Post: - 18th June 2007, 21:40
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. sample code for M25P32
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th January 2007, 02:37

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