PDA

View Full Version : Comparator voltage reference module



amodpathak
- 11th December 2014, 11:22
Pls tell me what is the use of comparator voltage reference module?

HenrikOlsson
- 11th December 2014, 11:50
To provide the comparator(s) with an internally generated reference voltage so you don't have to "waste" a second I/O pin for that.

Dave
- 11th December 2014, 15:34
It also allows one to change the comparator voltage in software.

amodpathak
- 11th December 2014, 15:53
Actually in my temperature controller circuit ADC value fluctuates with wide range when a heavy load through a relay is connected.I am using 16f876a micro and Pin A0 as ADC input.

towlerg
- 11th December 2014, 17:49
Sounds like you want to buffer that relay.

George

Demon
- 11th December 2014, 18:17
If the load is a motor, current spikes on start-up. Might want to average sampling, or delay between samples.

Robert

amodpathak
- 11th December 2014, 18:51
Load is 4 kw heater.Somebody in here in Lucknow ( India) told me to use comparator voltage reference module.I don't know what to do .Confused.

Demon
- 11th December 2014, 20:12
Pause for a few seconds when the relay is activated, then start taking samples.

Robert

amodpathak
- 12th December 2014, 08:50
Here is my code_----


'DIGITAL TEMP CNTROLLER USING 16F876A'


DG1 VAR BYTE
DG2 VAR BYTE
DG3 VAR BYTE
DIGIT VAR BYTE
DG VAR BYTE
COUNTT VAR BYTE

NUMB VAR WORD
N VAR WORD
adval var word
temp var word
TEMPP VAR WORD


ADCON1=%10000000
adcon0=%00000101
TRISA=1
TRISB=%00111000
TRISC=0


gosub mread
n=numb
GOSUB DIGITCALC





'-------------------------------------------------------------------------

MAIN1:

GOSUB DISPLAY

IF PORTB.3=1 THEN MREAD

IF PORTB.3=0 THEN MAIN




GOTO MAIN1






'-------------------------------------------------------------------------
MAIN:

ADCON0.2=1

GO:
IF ADCON0.2=1 THEN GO

adval.HIGHBYTE = ADRESH
adval.lowbyte = ADRESL

'temp=(adval*500)/1024
temp=adval
N=temp
gosub display
gosub digitcalc


If adval>NUMB then PORTB.7=0
pause 1000
IF ADVAL< NUMB-5 THEN PORTB.7=1
pause 1000
GOTO MAIN1


'_____________________________________

UP:
IF NUMB=400 THEN MAIN
NUMB=NUMB+1
N=NUMB
GOSUB DIGITCALC
IF PORTB.4=1 THEN MEMORY
GOTO MAIN1


memory:
WRITE 0,numb.HighByte

WRITE 1,numb.LowByte

GOTO MAIN1

'_____________________________________

DOWN:
IF NUMB=0 THEN MAIN 'MIN LIMIT
NUMB=NUMB-1
N=NUMB
GOSUB DIGITCALC
IF PORTB.5=1 THEN MEMORY
GOTO MAIN1


'_____________________________________
MREAD:
READ 0,numb.HighByte

READ 1,numb.LowByte

n=numb
gosub digitcalc
IF PORTB.4=1 THEN UP
IF PORTB.5=1 THEN DOWN
goto main1











__________________________________________________ _
DISPLAY:


FOR COUNTT=0 TO 99

PORTC=DG1
PORTB.2=1
PAUSEUS 300
PORTB.2=0

PORTC=DG2
PORTB.1=1
PAUSEUS 300
PORTB.1=0

PORTC=DG3
PORTB.0=1
PAUSEUS 300
PORTB.0=0

NEXT COUNTT

RETURN

'_________________________________________________ _______________



'_________________________________________________ _________________________
DIGITCALC:

DIGIT=0
LP1:
IF N<100 THEN DS1
N=N-100
DIGIT=DIGIT+1
GOTO LP1
DS1:
GOSUB FND
DG1=DG


DIGIT=0
LP2:
IF N<10 THEN DS2
N=N-10
DIGIT=DIGIT+1
GOTO LP2

DS2:
GOSUB FND
DG2=DG

DIGIT=N
GOSUB FND
DG3=DG

RETURN




'_________________________________________________ _________________________


'_________________________________________________ _________________________
FND:

FND0:
IF DIGIT>0 THEN FND1
DG=$7E '%0111 1110
GOTO FNDEND

FND1:
IF DIGIT>1 THEN FND2
DG=$48 '%0100 1000
GOTO FNDEND

FND2:
IF DIGIT>2 THEN FND3
DG=$3D '%0011 1101
GOTO FNDEND

FND3:
IF DIGIT>3 THEN FND4
DG=$6D '%0110 1101
GOTO FNDEND

FND4:
IF DIGIT>4 THEN FND5
DG=$4B '%0100 0011
GOTO FNDEND

FND5:
IF DIGIT>5 THEN FND6
DG=$67 '%0110 0111
GOTO FNDEND

FND6:
IF DIGIT>6 THEN FND7
DG=$77 '%0111 0111
GOTO FNDEND

FND7:
IF DIGIT>7 THEN FND8
DG=$4C '%0100 1100
GOTO FNDEND

FND8:
IF DIGIT>8 THEN FND9
DG=$7F '%0111 1111
GOTO FNDEND

FND9:
DG=$6F '%0110 1111


FNDEND:



RETURN
'_________________________________________________ _________________________

Demon
- 12th December 2014, 23:38
Comments would be helpful.

amodpathak
- 16th December 2014, 20:03
My problem is solved by using a 220 uf capacitor in my thermocouple amplifier. Now another problem arose .I think my circuit hangs.After running fine for a hour display on seven segment goes off.When I re- start circuit it works again.What can I do to rectify it.

Demon
- 16th December 2014, 20:17
Hard to answer without a schematic.

How is your power supply, enough current? Do other devices turn on during this time and take up too much current?


EDIT: Blink a LED in this part just to be sure nothing is going wrong.


MAIN:

ADCON0.2=1

GO:
IF ADCON0.2=1 THEN GO

amodpathak
- 16th December 2014, 20:32
I will share my schematic tomorrow? Thanks Demon ( ji)