![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Hello, I need some help!
I am new to PIC's and so far have been programming different flash patterns using PicBasic pro and the 12f629. I have a little electronics experience (simple circuits) and very little programing experience. I would like to program a chip to flash an LED pattern and when my LIPO battery drops to about 9.5 volts, i would like the LED pattern to change. I have a schematic for a voltage alarm using a maxim 8211 chip. I was thinking about using that to trigger the change in patterns on the PIC, but if its at all possible, i would like to just use a single chip in the circuit, so have the whole deal programmed into the chip (it doesnt have to be a 12f629, that is just what i am using now) Im am a little frustrated by the material i have come across so far, its more complex than i need (i dont want to program robots or computer interfaces!) so...... can anyone point me in the right direction or recommend some good resources for pic basic and the type of programing i would like to do? or, maybe you could help me with the program and help me figure out the circuit... thanks for all your help. |
|
|
|
|
|
|
(permalink) |
|
Get a low voltage signal from the MAX IC and feed it into the GP3 in the 12F629.
Show your patterns as they were and write a GP3 INPUT DETECT routine inside your DELAY1 routine (DELAY1 = delay used in the first pattern). If detected GP3 has a signal then shift to the other pattern. So other pattern delay will be DELAY2 again detect GP3 inside this DELAY2 repeat this …….continue…… |
|
|
|
|
|
|
(permalink) |
|
The 629 has a comparator. You could use this with a voltage divider to detect when the voltage has dropped below 9.5V. This would only take up 1 I/O pin (GP1) if you use the internal voltage reference. Have a read of the data sheet.
Mike. |
|
|
|
|
|
|
(permalink) | ||
|
Quote:
Loop High 1 pause 500 low 1 pause 500 goto loop end cant i insert an IF statement saying that if pin X were high or if an input was detected, then goto loop2? Quote:
Basically, from what i understand, i can run a 12v current from the battery then split it in two, one half running through a regulator bringing it down to 5v to feed the chip and the other half running to the chips input (after running it through a series of resistors to bring it down in voltage). the 5v to the chip with stay constant and create an internal voltage reference to compare to the current coming from the battery. as the current drops, the chip with detect the change and "interrupt" the program when it hits a set voltage difference? am i close? |
|||
|
|
|
|
|
(permalink) | |
|
Quote:
Code:
PAT1 movlw b'00000001' movwf PORTB call DELAY1 movlw b'00000010' movwf PORTB call DELAY1 ---- ---- goto PAT1 PAT2 movlw b'00000001' movwf PORTB call DELAY2 movlw b'00000010' movwf PORTB call DELAY2 ---- ---- goto PAT2 DELAY1 btfss GP3 ;check the GP3 button is it pressed or not goto Del_1 ;NO its not pressed then carry on actual delay goto PAT2 ;YES its pressed then goto PAT2 Del_1 decfsz d1,f ;actual delay (scaning speed) goto $-1 decfsz d2,f goto $-3 return DELAY2 ------ ------ |
||
|
|
|
|
|
(permalink) | |
|
Quote:
With something like a 10K resistor from your supply to GP1 and a 5K from GP1 to ground, you would set CMCON=4 (b'00000100'), VRCON to 176 (b'10101111') and bit 6 of CMCON will be set when your voltage is below (approx) 9.5V. No need for interrupts. FYI, I've roughly calculated this so it may be wrong!! If you swap the resistors for a preset potentiometer then you can set the voltage exactly. Mike. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
the voltage at 12v at GP3 would be 3.75v and the low or trigger voltage would be 3v. Does this look right? Also, where does that ground from the divider go? |
||
|
|
|
|
|
(permalink) |
|
You should only have 1 ground which connects to,
The negative terminal of your battery, The gnd connection on your 5V regulator, The Vss pin on the pic. I'm assuming that the -5V refers to the gnd connection of the regulator and the -11 (why not -12) refers to the -ve battery terminal. I'm also assuming you have some capacitors around your regulator. Mike. Edit, the input should go to GP1 if you only want to use 1 pin. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
So, to run it off a 11.1v (usually 12V) LIPO, can i use the +5 volts from the regulator (yes, there is a proper power supply, i just didnt draw it) and then run the -12v to the regulator and the chip (its okay that is a 12V ground?).... Thanks, I will draw up a proper schematic after work. Thanks for your help, I want to get the circuit right and then build on that... |
||
|
|
|
|
|
(permalink) |
|
Sound like it should all work.
Mike. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Voltage | ElectroMaster | Electronic Theory | 44 | 8th August 2007 05:35 PM |
| LIPO low voltage alarm | samtheboxer | Electronic Projects Design/Ideas/Reviews | 3 | 10th July 2007 06:50 PM |
| battery powered low voltage amplifier | mark.arkinstall | Electronic Projects Design/Ideas/Reviews | 17 | 1st July 2007 04:54 PM |
| Voltage reg or voltage reference. | Screech | General Electronics Chat | 4 | 13th May 2005 06:57 AM |
| convertion of acvoltage to high dcvoltage | panchumarthy | Electronic Projects Design/Ideas/Reviews | 8 | 12th December 2003 01:35 PM |