PIC12F629 small question

Status
Not open for further replies.
try,
Code:
unsigned char i;
bit oldstate;                       // Old state flag
void main() {
OSCCAL = 0b11111101;                   // calibrate internal osilator 4 MHz
CMCON = 0b00000100;                 // CIN- analog, Internal VRef
GPIO = 0;                          //<<<<<<added
TRISIO = 0b00000010;                     // gp2 = output
VRCON  = 0b10101111;                   // sets Vref
gpio.F2 = 0;

Mike.
 
I have added GPIO = 0,
nothing changes. I have noticed one more thing, maybe important. When I connect both voltages- from car battery and from power grid - transformer 230/12 V is buzzing (it is quite without 12 V from battery).
 
When the relay is powered with signal from PIC current value is 24 mA and in off position is 0,1 mA, is this ok for permanent operation?
 
I have solved it

I have replaced 7805 with zenner diode 5,1V. I have tried it with 5V and 12V relay and it works like it should work.
I am sending wiring diagram. Should I replace 2 capacitors C3 and C4?

thanks
 

Attachments

  • Shema_zener_diode.png
    19.2 KB · Views: 160
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…