A/D, Pot, Input, A,B So lost now....


Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    Mar 2008
    Posts
    6

    Default A/D, Pot, Input, A,B So lost now....

    1st off I would like to say thank you to all for these forums, It has helped me solve many many issues so far.

    I am new to the PIC world but have made leaps and bounds so far.

    Ok. What I am trying to do is control the limits of a servo based on the position of two pots. To give a whole over view of the application I am trying to make a replacement power valve controller for a 2 stroke motorcycle. This being my 1st real Pic project, Im having more than my fare share of issues, but working through them, so any help is greatly appreciated.

    Im trying to use 16f690 chip because I think I need the AD converter to handle the pot command.

    But so the simplified version of the code I am going with is. I am still struggling with the RPM pick up, but one problem at a time. I am replacing the RPM input with a simple low high switch to help simplify testing. I know this isn't the fastest code method due to the pulse pause, but... It should be well quick enough.

    Servo VAR Portc.5 'The servo being used is a Futaba Digital RC Servo.
    Scale VAR Byte
    Pulse VAR Byte
    RinTot VAR Porta.2
    Potin VAR Porta.4
    potvar VAR Byte
    RPMin VAR portc.4
    RPM VAR Word


    POT RinTOT, 255, Scale 'According to docs. By setting the scale to 255, then useing the max resistance of the pot it will give a correct scale? Store this on start up to use later.


    Loop:
    POT Potin, Scale, potvar
    IF RPMin=1 THEN
    PULSOUT Servo, potvar 'I should only get a useable value between 100-200, so effectively limiting my pot, through, I droped the scaling until I could get this fixed.
    PAUSE 18 'The pause for the servo input.
    ELSE
    PULSOUT Servo, 100 'Go back to the lowest pulse position.
    PAUSE 18
    ENDIF
    GOTO Loop
    END

    Ok so I get servo active and locked, if I change it to go to a fixed pulse time on RPM press it works. But once the pot is added in I get nothing. I am probably making a really dumb mistake. So if you do help, Thank you.

    I have read so many different ways of doing this I am very very lost now. I tried some functions with the A/D converters but didn't get very far. Then I read many different approaches to converting the Pot to something useable. Tried some plug and drop in methods, with other code.. So maybe its my way of wiring. Both of my reference books I use have two totally different ways of doing it. So I'm very very confused now. SO again Thank you.

    I drew how I was wiring the pot in if I am screwing that up as well , But I am horrible at drawing on a computer so its pretty rough, but gives the idea.

    Thank you all so very much for even taking the time to look at this.
    Attached Images Attached Images  

Similar Threads

  1. floating A/D input
    By muddy0409 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th April 2009, 13:21
  2. 12F675 A/D and GPIO sleep interrupt
    By macinug in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th September 2008, 14:39
  3. Advice on Input circuitry for 0-10v or Pot
    By bcd in forum Schematics
    Replies: 18
    Last Post: - 12th April 2008, 10:47
  4. Question from New member A/D input 16f876
    By mbruno in forum General
    Replies: 2
    Last Post: - 26th January 2008, 14:52
  5. Replies: 4
    Last Post: - 24th January 2007, 22:20

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