donatelo
- 20th September 2008, 16:09
hello...
i'm using pic16f877a and current sensor (acs754-050) is my analog input...
i do get the Vout value but the value is varied(display on LCD) because i monitored 415VAC...
how can i get the Vmax of sine wave???
any ideas???
my coding:
- - - - - - - - - - -- - - - - --
define osc 4
Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 1
Define LCD_EREG PORTE
Define LCD_EBIT 2
define LCD_BITS 4
define LCD_lines 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
' Define ADCIN parameters
Define ADC_BITS 8 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
adcon1 = %00000100
ADCON0 = %11011001
trisd = 0
trisb = %01111100
trise = 0
res var word
volts1 var word
volts2 var word
conv1 con 19
conv2 con 60
Pause 500
main:
adcon0.2 = 1
res = ADRESH
volts1 = res*conv1
volts2 = res*conv2
volts2 = volts2/100
volts1 = volts1 + volts2
pause 100
lcdout $fe,1
lcdout $fe,$80+4, "V=", dec4 volts1
goto main
end
- - - - - - -- - - - -- - - - -- - - -- - - -
when the current sensor sense current,it convert to voltage (1A=40mV)
when zero current,the Vout is Vcc/2(2.5V)
let say current sensor sense 1A,Vout is 40mV max and Vp-p is 80mV
my LCD will display 2460mV varied to 2540mV (which is Vp-p 80mV)
how can i capture the 2540mV value and display it on LCD??
i'm using pic16f877a and current sensor (acs754-050) is my analog input...
i do get the Vout value but the value is varied(display on LCD) because i monitored 415VAC...
how can i get the Vmax of sine wave???
any ideas???
my coding:
- - - - - - - - - - -- - - - - --
define osc 4
Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 1
Define LCD_EREG PORTE
Define LCD_EBIT 2
define LCD_BITS 4
define LCD_lines 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
' Define ADCIN parameters
Define ADC_BITS 8 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
adcon1 = %00000100
ADCON0 = %11011001
trisd = 0
trisb = %01111100
trise = 0
res var word
volts1 var word
volts2 var word
conv1 con 19
conv2 con 60
Pause 500
main:
adcon0.2 = 1
res = ADRESH
volts1 = res*conv1
volts2 = res*conv2
volts2 = volts2/100
volts1 = volts1 + volts2
pause 100
lcdout $fe,1
lcdout $fe,$80+4, "V=", dec4 volts1
goto main
end
- - - - - - -- - - - -- - - - -- - - -- - - -
when the current sensor sense current,it convert to voltage (1A=40mV)
when zero current,the Vout is Vcc/2(2.5V)
let say current sensor sense 1A,Vout is 40mV max and Vp-p is 80mV
my LCD will display 2460mV varied to 2540mV (which is Vp-p 80mV)
how can i capture the 2540mV value and display it on LCD??