hi,how can i use the internal comparator in pic16f877a.can someone help me with the coding please.my Vin is 3.40 and my Vref is 4.00.please help me...
Printable View
hi,how can i use the internal comparator in pic16f877a.can someone help me with the coding please.my Vin is 3.40 and my Vref is 4.00.please help me...
See Melanie's excellent post here
http://list.picbasic.com/forum/messages/3064/3607.html?
it is for a different processor but converting to the 877a should be straight forward. Reply if you need more
OMG... I wrote that SIX YEARS ago!!!
Hi, Mel
I'm Aaaaabsolutely suuuuuure it's not you but your Elder sista ...
regards
Alain
thanx.i will work it out.if something goes wrong...i'll tell u guys...
' Device Programming Options
' --------------------------
@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
' System Clock Options
@ DEVICE pic16F628, WDT_ON
' Watchdog Timer
@ DEVICE pic16F628, PWRT_ON
' Power-On Timer
@ DEVICE pic16F628, MCLR_OFF
' Master Clear Options (Internal)
@ DEVICE pic16F628, BOD_ON
' Brown-Out Detect
@ DEVICE pic16F628, LVP_OFF
' Low-Voltage Programming
@ DEVICE pic16F628, CPD_OFF
' Data Memory Code Protect
@ DEVICE pic16F628, PROTECT_OFF
' Program Code Protection
i can't compile if those code are exist.i use pic16f877a.
@ DEVICE pic16F877a, INTRC_OSC_NOCLKOUT
' System Clock Options
@ DEVICE pic16F877a, WDT_ON
' Watchdog Timer
@ DEVICE pic16F877a, PWRT_ON
' Power-On Timer
@ DEVICE pic16F877a, MCLR_OFF
' Master Clear Options (Internal)
@ DEVICE pic16F877a, BOD_ON
' Brown-Out Detect
@ DEVICE pic16F877a, LVP_OFF
' Low-Voltage Programming
@ DEVICE pic16F877a, CPD_OFF
' Data Memory Code Protect
@ DEVICE pic16F877a, PROTECT_OFF
' Program Code Protection
BatVal var CMCON.7
BatLoLED var PORTB.7
CMCON=%00100101
VRCON=%11101100
Pauseus 10
TRISA=%11111111
TRISB=%00000000
BatLoLoop:
BatLoLED=BatVal
Goto BatLoLoop
End
my vref=4v, vin=3.6 and my vout=9v.can someone help me which part of the coding need to be edit.please...
Vref = 4v - what is Vref connected to?Quote:
my vref=4v, vin=3.6 and my vout=9v.can someone help me which part of the coding need to be edit.please...
Vin = 3.6v - what is Vin connected to?
Vout = 9v - what is Vout connected to?
Read the datasheet for the 16F877A!
Can MCLR be turned off?
How many oscillator modes does the 16F877A have? What are they?
I Love the way you think Melanie . . .
I wish more engineers thought as you do.Quote:
In a battery operated piece of equipment we need to detect when the
batteries are getting low, so in turn we can switch on a 'Battery Low' LED
to help flatten whats left of the battery even quicker... seems sensible to
me....
thanx everyone.it's work.but i have another problem that i can't solve.feel free to check my new thread...