Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 9th September 2007, 05:17 AM   (permalink)
Default LIPO alarm

okay, so im back to my lipo alarm project. i still dont get it and its been a while since i tried to get it!! I have this code that someone gave me, but i need to make it work for the 12F629. it needs to change flash patterns when the voltage of the lipo drops below 9.8 volts. can someone please help me understand this and what i need to do to make it work for me???? thanks

; PIC18F4620
define OSC 40 ; 40 MHz Oscillator"
TRISA = %00000011 ; portA.0 and A.1 are inputs
TRISD = %00000000 ; Port D all outputs


ADCON1 = %0001101

; Comparator Control
CMCON = %00000110
;CMCON.7 = 0 ; C2OUT Comparator Output 2 (Read Only)
;CMCON.6 = 0 ; C1OUT Comparator Output 1 (Read Only)
;CMCON.5 = 0 ; C2INV Comparator 2 Output Inversion
;CMCON.4 = 0 ; C1INV Comparator 1 Output Inversion
;CMCON.3 = 0 ; Comparator Input Switch
;CMCON.2 = 1 ; )
;CMCON.1 = 1 ; )Mode 110
;CMCON.0 = 0 ; )
; ;
; Comparator Voltage Reference Control
CVRCON = %10101010
;CVRCON.7 = 1 ; CVREN Voltage Reference Enable (1 = on, 0 = OFF)
;CVRCON.6 = 0 ; CVROE VREF Output Enable
;CVRCON.5 = 1 ; CVRR Comparator Range Selection bit
;CVRCON.4 = 0 ; CVRSS Comparator Reference Source
;CVRCON.3 = 1 ; )
;CVRCON.2 = 0 ; ) Set for Reference Voltage
;CVRCON.1 = 1 ; ) 1010 sets 2.083v in Low Range
;CVRCON.0 = 0 ; ) 9.2 Volts from Battery

; Start Main Program Loop
loop:
if CMCON.6 = 1 then
CVRCON = %10101101 ; 2.083V
PortD.7 = 1
else
CVRCON = %10101010 ; 2.708V
PortD.7 = 0
endif

Goto loop ; Do it forever
samtheboxer is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
alarm annunciator project projectthief General Electronics Chat 5 2nd April 2008 10:00 PM
I want to improve my remote car alarm system. Turbo_Boss Electronic Projects Design/Ideas/Reviews 2 4th January 2007 10:27 PM
Burglar alarm madmikejt12 Chit-Chat 6 21st October 2006 12:40 PM
Alarm Display Project loranimal Electronic Projects Design/Ideas/Reviews 4 19th March 2005 06:14 PM
Need A Simple Alarm Clock Circuit Handiplus Electronic Projects Design/Ideas/Reviews 0 29th March 2004 03:02 PM



All times are GMT. The time now is 08:30 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker