help!!!!


Closed Thread
Results 1 to 11 of 11

Thread: help!!!!

  1. #1
    lokanand's Avatar
    lokanand Guest

    Default help!!!!

    hi,
    i am a newcomer to PIC basic pro.i would like to know what scale values {while using pot command } are appropriate for a 200k pot, and 0.1microF.
    bye

  2. #2
    Join Date
    May 2004
    Location
    New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    Hi lokanand,
    I don't think there are any specific values for SCALE - it's sort of a try it and see kind of thing. There is a bit of code in the PBP manual for calibrating the SCALE value - give it a try.

    Arch

  3. #3
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Smile

    Also, 200k pot with 100n is not a good combination.

    As Archilochus said, check the manual.

    Play with 50k, 5k and 10n, 100n.


    -----------------------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

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


    Did you find this post helpful? Yes | No

    Default

    I favour 100n for the POT Capacitor (same one's I use for decoupling sprinkled around the PCB - saves loading another component reel onto the board stuffing machine). With a 10K variable, the scale value is about 95.

  5. #5
    Join Date
    Nov 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    does this mean a 100nanoFarad???

  6. #6
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    yes
    100 nF = 0.1 uF
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  7. #7
    Join Date
    Nov 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    Thanks!!! BTW, I am trying to execute the code supplied in the PICBasic manual, but it doesn't seem to work.

    This is the code in the manual.

    B0 Var Byte
    scale Var Byte

    For scale = 1 To 255
    POT 0, scale, B0
    If (B0 > 253) Then calibrated
    Next scale

    Serout 2,0,[" Increase R or C.", 10,13]
    Stop

    calibrated:
    Serout 2,0,[" Scale= ",# scale, 10,13]

    This is my modified code:

    B0 var byte
    scale var byte
    LED var PORTB.1
    Potpin var PORTB.2

    for scale = 1 to 255

    LCDout $FE, 1, "calibrating", $FE, $C0, "Scale=", DEC scale, "B0=", DEC B0
    pot Potpin, scale, B0
    If (B0 > 253) then calibrated
    next scale

    Lcdout $FE, 1, "Increase R or C"
    stop
    calibrated:
    lcdout $FE, 1, "Scale=", scale

    As you can see, I have the pot connected to PORTB2.

    When I run the code, I can see the scale and B0 incrementing on the LCD, however, before B0 or scale reaches 255 it starts over from scale=0 & B0=0.

    Anyone have experience with this???

    I know it's possible to do this manually but I would like to do it with automation because I will need to calibrate the scale for several different pots in the future. Thanks!!!

  8. #8
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    At first glance, before other possibilities, "then calibrated" will work like GOTO; not like GOSUB.

    I would suggest that you use "calibrated" as a subroutine with a "return" and change all "then calibrated" to "then GOSUB calibrated".

    Then we can talk about the rest of the code.

    ------------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  9. #9
    Join Date
    Nov 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    Thanks sayzer...I changed it to a gosub, and it freaked out because when it returns to the loop in still increments scale. So I tried goto calibrated and the LCD at least shows scale=, but it says "scale=r" WTF?

    Here's what I've got. BTW, thanks again for all of your help. I'm already miles ahead just from reading your posts.

    B0 var byte
    scale var byte
    LED var PORTB.1
    Potpin var PORTB.2

    for scale = 1 to 255

    LCDout $FE, 1, "calibrating", $FE, $C0, "Scale=", DEC scale, "B0=", DEC B0
    pot Potpin, scale, B0
    If (B0 > 253) then
    goto calibrated
    endif
    Pause 1000
    next scale

    Lcdout $FE, 1, "Increase R or C"
    stop
    calibrated:
    lcdout $FE, 1, "Scale=", scale

    end

  10. #10
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Possibly you want

    lcdout $FE, 1, "Scale=", DEC scale

    when you jump out, otherwise you get the ASCII equivalent of scale?
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  11. #11
    Join Date
    Nov 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Talking

    doh! Thanks. Works great! Here's my final code for others to use as reference.

    B0 var byte
    scale var byte
    LED var PORTB.1
    Potpin var PORTB.2

    for scale = 1 to 255

    LCDout $FE, 1, "Wait for Calibration", $FE, $C0, "Current Scale=", DEC scale
    pot Potpin, scale, B0
    If (B0 > 253) then
    goto calibrated
    endif
    next scale

    Lcdout $FE, 1, "Increase R or C"
    stop
    calibrated:
    lcdout $FE, 1, "Use Scale=", DEC scale, $FE, $C0, "Have a nice day"
    high led
    end
    Last edited by champion; - 9th November 2006 at 20:49.

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