Numeric value for Photoresistor/LDR value


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Hi Tech. I've used the LDR's in the past but read them with the ADCIN command. I've found ADCIN is easier & more accurate to work with. Also, your "if V1" statements have a slight glitch. If the value is exactly 100, the PIC will do nothing.

    v1 var byte
    portb = 0 'all off

    main:
    adcin 0,v1
    if v1 < 100 then lmp1
    if v1 >= 100 then lmp2 'added if equal to
    goto main

    lmp1:
    high portb.6
    pause 500
    low portb.6
    pause 500
    goto main 'return is for GOSUB's
    lmp2:
    high portb.7
    pause 500
    low portb.7
    pause 500
    goto main

  2. #2
    Join Date
    Apr 2007
    Posts
    18


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by peterdeco1 View Post
    Hi Tech. I've used the LDR's in the past but read them with the ADCIN command. I've found ADCIN is easier & more accurate to work with. Also, your "if V1" statements have a slight glitch. If the value is exactly 100, the PIC will do nothing.

    v1 var byte
    portb = 0 'all off

    main:
    adcin 0,v1
    if v1 < 100 then lmp1
    if v1 >= 100 then lmp2 'added if equal to
    goto main

    lmp1:
    high portb.6
    pause 500
    low portb.6
    pause 500
    goto main 'return is for GOSUB's
    lmp2:
    high portb.7
    pause 500
    low portb.7
    pause 500
    goto main
    im using picf16f84a..
    Found out ADCIN did not work for pic16f84..

Similar Threads

  1. DT's instant interupts compile problem
    By comwarrior in forum General
    Replies: 4
    Last Post: - 18th October 2009, 19:30
  2. Formating numeric values to text
    By Andre_Pretorius in forum General
    Replies: 2
    Last Post: - 1st August 2009, 08:39
  3. EDTP Ethernet MINI PICBASIC PRO DRIVER
    By edtp in forum mel PIC BASIC Pro
    Replies: 34
    Last Post: - 1st May 2008, 22:00
  4. Saving numeric data to eeprom from array
    By joseph Degorio in forum Serial
    Replies: 5
    Last Post: - 14th December 2007, 05:18
  5. Numeric Values
    By Armando Herjim in forum General
    Replies: 8
    Last Post: - 28th June 2006, 01:54

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