Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

PIC 16F676 C CODE for analog i/p signal detect

10 posts / 0 new
Last post
Dhananjaya
Dhananjaya's picture
Offline
Last seen: 1 year 4 months ago
Joined: 18/01/2014 - 13:58
PIC 16F676 C CODE for analog i/p signal detect

Sir, i am trying to detect a three phases lines i.e which phase is available or not by using pic16f676 .(three phases like R, Y & B Phases individually connected to pic16f676 micro controller pins RA0,RA1 & RA2 respectively) using series of  2.2M ohm 1/2 watt+5M ohm 1/4 watt to PIC pin RA0 and 10K ohm connected to ground & PIC RA0.
 
if R,Y & B phases (Three phase present) all are available  RC0 pin connected(Three_phase) LED will Glow ON 
if only R phase is available  RC1 pin connected(Single_phase) LED will Glow ON 
if R & B phases are available  & Y phase failure  RC2 pin connected (Two_phase)LED will Glow ON 
 
i don't want digital conversion only phase is available OR not so how to detect these phases are available or not for C code ...
 
i am initialize like this
#define R_phase RA0
#define Y_phase RA1
#define B_phase RA2
 
#define Three_phase_LED RC0
#define Two_phase_LED RC1
#define Single_phase_LED RC2
#define NO_phase_LED RC3
 
void main()
{
CMCON=0x07;
ANSEL=0x00; 
TRISA =0b001111;
PORTA=0b001111;
TRISC=0b000000;
PORTC=0b00000;
 
while(R_phase&&Y_phase&&B_phase)
{
Three_phase_LED = 1;    ///RC0 pin connected(Three_phase) LED will Glow ON
}
 
while(R_phase&&B_phase)
{
Two_phase_LED = 1;    ///RC1 pin connected(Two_phase) LED will Glow ON
}
while(R_phase||Y_phase||B_phase)
{
Single_phase_LED = 1;    ///RC2 pin connected(Single_phase) LED will Glow ON
}
while(!R_phase&&!Y_phase&&!B_phase)
{
  NO_phase_LED = 1;    ///RC3 pin connected(No_phase) LED will Glow ON
}
}
 
 
I have tried this concept but only  NO_phase_LED = 1;     LED  Glow ON
 
finally i want detect AC mains either three/two/single phase available please let me know the program  concept
 
thanking with u...  

rahul
rahul's picture
Offline
Last seen: 1 year 6 months ago
Joined: 08/09/2012 - 15:26
ckt dia req

can u plz share circuit diagram with us??

fst thing is that u can not measure ac signal directly u need to convert it in TTL form or use adc..

it wil be fine if u can communicate on my mail id rahul10tungar@gmail.com

 

Dhananjaya
Dhananjaya's picture
Offline
Last seen: 1 year 4 months ago
Joined: 18/01/2014 - 13:58
To get the input voltage from



To get the input voltage from the voltage divider resistors voltage is 3.5 volts its not working but when i connect DC 3 volts its working good 
The input to RA0  positive D/C voltage sufficient to indicate a logic "1" , when the phase is present, and a logic "0" when the phase is absent. how to convert TTL form as your sugession otherwise please let me ADC code...

rahul
rahul's picture
Offline
Last seen: 1 year 6 months ago
Joined: 08/09/2012 - 15:26
email id req

post your mail id i will share adc logic with u.

harsha vardhan
 harsha vardhan's picture
ADC reading in 16f676 with serial o/p

hello sir, i am working on 16f676.  i want to read adc values from sensor and send the values through serial. i required the program, can u please help me with that? 

my mail id is harshabezawada1@gmail.com

thank you.

rahul
rahul's picture
Offline
Last seen: 1 year 6 months ago
Joined: 08/09/2012 - 15:26
email id & ckt dia

post ur email id and circuit diagram

Dhananjaya
Dhananjaya's picture
Offline
Last seen: 1 year 4 months ago
Joined: 18/01/2014 - 13:58
PIC 16F676 ADC C code

thank u for advance... i have to try for ADC in microchip PIC16F676 for 3 channels (3 analog inputs i.e.RA0,RA1 & RA2)-AN0,AN1,AN2) please give me ADC configuration bits /ADC initialize...for this chip.in C code

 

email id icafesaptagiri@gmail.com

waagyi
 harsha vardhan's picture
16f676 adc problem

I do not know the configuration of pic for adc application.Data sheet can not help mw. what i want is a set of codes that read analog input. Are there any one who can help me.

Ashutosh Bhatt
Ashutosh Bhatt's picture
Offline
Last seen: 1 week 2 days ago
Joined: 21/12/2010 - 15:59
this is not the way to

this is not the way to connect direct 3 phase lines with any micro controller

use Zero Cross Detector circuit (ZCD) 

this will continuous pulses till the particular phase is present

Ashutosh Bhatt
Ashutosh Bhatt's picture
Offline
Last seen: 1 week 2 days ago
Joined: 21/12/2010 - 15:59
you need 3 saparate ZCD -

you need 3 saparate ZCD - zero cross detector circuits one for each phase

the output of ZCD is continuous pulses till AC is present

as soon as AC gone - the pulses will disappear

so continuously monitor pulses from 3 sides and when any one or more is absent turn on the LED 

thats all