Need Help On Ac Voltmeter !!


Results 1 to 22 of 22

Threaded View

  1. #12
    Join Date
    Apr 2005
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    thx you very much rob !!

    I wrote this code. for AC measurment . But i didn't check on real device!
    does it work ? It worked with DC :-)
    If you can send any cirtuit and detail , it will be help to us !

    best regards


    Define LOADER_USED 1
    ;Define OSC 20
    'Test Kart LCD
    Define LCD_DREG PORTD
    Define LCD_DBIT 4
    Define LCD_RSREG PORTE
    Define LCD_RSBIT 0
    Define LCD_EREG PORTE
    Define LCD_EBIT 1


    ' Define ADCIN parameters
    Define ADC_BITS 10 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS

    adval var word ' Create adval to store result
    AcVolt var word
    Acvolt2 var word
    volt1 var word
    volt2 var word
    Cnt var byte
    Cnt =1

    ADCON1 = 7 ' Set PORTA and PORTE to digital
    Low PORTE.2 ' LCD R/W line low (W)
    Pause 100 ' Wait for LCD to start up


    TRISA = %11111111 ' Set PORTA to all input
    ADCON1 = %10000010 ' Set PORTA analog and right justify result

    loop:
    For cnt = 1 to 400
    ADCIN 0, adval ' Read channel 0 to adval
    adval= (adval*10)/204 ' 0 -5 V
    volt1 = adval/10
    Volt2= (adval - volt1*10)

    'LCDout$fe, 1 ,"Value: ",dec(volt1) ,".",dec (volt2), " Say:" ,dec say

    ACVolt = Acvolt + (volt1)*(volt1)
    AcVolt2= AcVolt2+ volt2*volt2

    'LCDout$fe, $c0 ,"Value: ",DEC (acvolt )
    'pause 250
    pauseus 50
    next cnt

    acvolt = sqr(acvolt/400)
    AcVolt2= sqr(Acvolt2/400)


    LCDout$fe, 1 ,"RMS AC V: ",DEC (acvolt),".", dec acvolt2' Display value


    ' Pause 1000 ' Wait .1 second
    adval=0

    Goto loop ' Do it forever
    End
    Last edited by uludere72; - 26th January 2006 at 13:09.

Similar Threads

  1. Circuit Diagram for interfacing AC to PIC IC?
    By wellyboot in forum Schematics
    Replies: 3
    Last Post: - 8th March 2008, 19:40
  2. How to read AC mains with an inductance coil
    By KB3BYT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 20th February 2008, 12:02
  3. Ac voltmeter Ampermeter
    By onur in forum General
    Replies: 4
    Last Post: - 27th March 2007, 21:13
  4. Special Offer AC -AC adapter
    By lester in forum Adverts
    Replies: 0
    Last Post: - 9th September 2005, 07:52
  5. Detecting AC current
    By rhino in forum Off Topic
    Replies: 8
    Last Post: - 8th July 2005, 21:31

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