Help for my project(16f877,2x16LCD,)


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Mar 2008
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Hmm , thank you .
    Let's think , if i want to make it with 5V not 15V .
    I just want to learn the main idea.
    I think , if i learn the main idea , maybe i can go on with 15V.
    In fact , i can change the output voltage from 1.67 V to 15V .
    In this project we wanted to have good resolution , and we decided to get 15V from output.
    As i said , let's think , the input changes 0-5V.
    Thank you
    By the way , my main project was to build an cell phone detector and i did it with a small circuit. In this circuit there are 2 same RF subcircuits ; one for the left side detection and the other side is for the right side detection.
    We amplified the signals with LM358 and we may get output from 1.67 to 15V . ( with gain changing)
    Finally we want to show the voltage change with the LCD bar graphs.
    The first line of the LCD will be left channel and the second line will be the right channel .

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Do small steps.
    You have the LCD working.
    Now make the ADC work with 8 bit resolution.
    Then do two ADC channels.
    Then work on 10 bit for more accuracy.
    Then work on the bar graph.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Mar 2008
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Okay ,
    for ADC :

    PORTA = %00000001
    RAW var word ' the input voltage
    volt var word
    Mvolt var byte

    START:

    ADCIN 0,RAW ' Analog read from #ch0 and move it to RAW
    LOOK : IF ADCON0.2=1 THEN LOOK ' when ADC finished ADCON0.2=0
    ' for 0-5V , 0-1024 - > 5/1024 = 0.0048828 = very small number
    '0.0048828*1000 = 4.8828 ( raw/V)
    '4.8828 * 256 = 1250 ( 1250 = 5/1024 * 256*1000 ) we made 32bits calculation
    Volt=(Raw*/1250)/100
    MVolt=Volt//10 ' Mvolt = Volt mod 10
    Volt=Volt/10
    LCDOUT $FE,2,"VOLT=",#VOLT,",",#Mvolt
    PAUSE 500
    GOTO START
    I tried to read the voltage from LM358 and to write the LCD as Volt.Mvolt
    I'm waiting for help.
    Thanks.
    Last edited by karamastik; - 20th March 2008 at 00:03.

  4. #4
    Join Date
    Mar 2008
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Sorry for the flood , but i must ;
    i changed the ADC codes , but volt variable does not accept floating numbers :

    START:

    ADCIN 0,RAW
    LOOK : IF ADCON0.2=1 THEN LOOK
    Volt=(0,0048828125*RAW)*1000
    MVolt=Volt//10 ' Mvolt = Volt mod 10
    LCDOUT $FE,2,"VOLT=",#VOLT,",",#Mvolt
    PAUSE 500
    GOTO START
    Last edited by karamastik; - 20th March 2008 at 01:54.

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by karamastik View Post
    i changed the ADC codes , but volt variable does not accept floating numbers :
    Neither does anything else in PBP...

    PORTA=1 : RAW var word : volt var long
    START: ADCIN 0,RAW : IF ADCON0.2=1 THEN START
    Volt = Raw * 4882813 'round up
    LCDOUT $FE , 2 , "V=" , DEC ( volt dig 9 ) , "." , DEC ( volt dig 8 ) , DEC ( volt dig 7 )
    LCDOUT DEC ( volt dig 6 ) , DEC ( volt dig 5 ) , DEC ( volt dig 4 ) , DEC ( volt dig 3 )
    LCDOUT DEC ( volt dig 2 ) , DEC ( volt dig 1 ) , DEC ( volt dig 0 ) 'get all them digits in there
    PAUSE 500
    GOTO START

  6. #6
    Join Date
    Mar 2008
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    I was at school ,sorry for the delay.
    Thanks for the help but in pbp , i saw that there is no " long " .
    It gives error.

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by karamastik View Post
    I was at school ,sorry for the delay.
    Thanks for the help but in pbp , i saw that there is no " long " .
    It gives error.
    There is if you upgrade to PBP 2.50a.

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