Reading if Pin is High or Low?


Closed Thread
Results 1 to 30 of 30

Hybrid View

  1. #1
    Spindle's Avatar
    Spindle Guest


    Did you find this post helpful? Yes | No

    Default

    thanks mister_e I am gonna try your first thing, this is for a motorized shade application so the next step is to have the position constantly store the absolute position in the PICs eeprom incase the main power is cut it won't be confused when power is applied again. Thats aways off, first thing is first, I shall try your solution!

  2. #2
    Spindle's Avatar
    Spindle Guest


    Did you find this post helpful? Yes | No

    Default

    I tried your first solution and no go. When you flip the switch one way it still goes forward and when you flip the switch the other way it still goes reverse. But if you were to flip it from left to center it would still spin and NOT shut off. Same if you were to flip it from right to center. It would still move (the motor) until it gets to that absolute position. Some how I have to ustilize that _break pin because brining it low disables the H-Bridge. I have to do that somehow where if the switch is to the left or right its not pulled low. Mister E. It is wired up like your diagram in your previous posts.

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


    Did you find this post helpful? Yes | No

    Default

    now it's me that need to sleep

    what about the second option now???
    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

    Second Solution doesn't work eaither.

    The problem is i think the code is right (your first solution) its just mechanically/electrically/wirely I need your help on how I can wire up the SPDT switch to go low when its in the center disableing the H-Bridge. the _brake line would be low. But when the switch is thrown left or right the _break line can not be low so the H-Bridge is reenable. Right now it is wired up like your schematic.
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    Well i this could be as easy as..
    Code:
    MAIN:
        IF (UP = 0) AND (DOWN=1) THEN
           serout FM, T9600 ,["W01 01 200", CR, LF] 'Write velocity limit value 
           serout FM,T9600,["P01 270000", CR, LF] 'Send MOVETO_ABSOLUTE command
           ENDIF
    
        IF (DOWN = 0) AND (UP = 1) THEN
           serout FM, T9600 ,["W01 01 200", CR, LF] 'Write velocity limit value 
           serout FM,T9600,["P01 0", CR, LF] 'Send MOVETO_ABSOLUTE command
           ENDIF
    
        if (DOWN = 1) AND (UP = 1) then ' <=== Switch is in central POS
           LOW Break_Pin
           endif
        
        goto MAIN
        End
    Just connect a PIC i/o directly to the controller BREAK pin... this have to work... i guess.

    or if you feel to add extra parts...
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=392&stc=1">
    Both should work now!
    Attached Images Attached Images  
    Last edited by mister_e; - 1st August 2005 at 15:15.
    Steve

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

  6. #6
    Spindle's Avatar
    Spindle Guest


    Did you find this post helpful? Yes | No

    Default

    mister_e. You Sir are brilliant! I went with your first method the only dif is to make it work i brought break_pin HIGH for the first two IF statements!

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


    Did you find this post helpful? Yes | No

    Default

    yeah of course OR
    Code:
        if (DOWN = 1) AND (UP = 1) then ' <=== Switch is in central POS
           LOW Break_Pin
           else
                 HIGH Break_pin
           endif
    BTW great to know it's working now
    Steve

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

Similar Threads

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