reading the value of a pot


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2009
    Posts
    14

    Default reading the value of a pot

    Hi -

    I am still plugging away trying to learn more PICBasic Pro. Figure I have couple of the Parallax Basic Stamp books. So I am trying to do those same labs but using the PIC16F84A instead of the BS2 and PICBasic Pro as the language instead of the Parallax Basic language.

    One of the labs from "What's a Microcontroller?" is to read the value of a potentiomemter. So I made the exact same schematic from the Basic Stamp book but using my PIC16F84A. (Attached is an image showing my electronics.)

    Than I used the following source code. Problem is the only value that ever gets stored in the variable "time" is the state I specify on the command line. Could anyone point me in the correct direction to properly reading the value of a pot with PICBasic Pro?

    Thanks -

    Code:
    include "MODEDEFS.BAS"
    
    lcd1 var porta.0
    potport var portb.0
    time var word
    
    main
    
    HIGH potport
    pause 10
    rctime potport, 1, time
    serout lcd1, t9600, [$fe,1," time = ", #time]
    
    goto main
    Attached Images Attached Images  

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Code:
    include "MODEDEFS.BAS"
    
    lcd1 var porta.0
    potport var portb.0
    time var word
    
    main
    
    LOW potport
    pause 10
    rctime potport, 0, time
    serout lcd1, t9600, [$fe,1," time = ", #time]
    
    goto main
    Port should be low not high.

    Al.
    Last edited by aratti; - 1st February 2009 at 10:09.
    All progress began with an idea

Similar Threads

  1. Using the Pot command.
    By timseven in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 17th August 2009, 20:23
  2. A/D, Pot, Input, A,B So lost now....
    By Helmutt in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th March 2008, 22:23
  3. Replies: 4
    Last Post: - 24th January 2007, 22:20
  4. Pot reading jumping like crazy!!!
    By champion in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 20th November 2006, 21:24
  5. pot controlled pwm -- help
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 29th January 2006, 12:29

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