EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
You are here: Home / Topics / PIC 16F676 C CODE for analog i/p signal detect

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

|

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

  • This topic has 9 replies, 4 voices, and was last updated 4 years, 10 months ago by Ashutosh Bhatt.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • July 3, 2015 at 2:06 pm #3741
    Dhananjaya
    Participant

    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…  

    July 5, 2015 at 8:27 am #13039
    rahul
    Participant

    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 [email protected]

     

    July 6, 2015 at 6:55 am #13040
    Dhananjaya
    Participant



    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…

    July 6, 2015 at 10:17 am #13041
    rahul
    Participant

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

    July 6, 2015 at 11:29 am #13042
    rahul
    Participant

    post ur email id and circuit diagram

    July 6, 2015 at 1:26 pm #13043
    Dhananjaya
    Participant

    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 [email protected]

    October 15, 2016 at 2:00 pm #14196
    Anonymous
    Guest

    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.

    October 21, 2016 at 10:09 am #14208
    Ashutosh Bhatt
    Participant

    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

    September 22, 2017 at 7:14 am #14663
    Anonymous
    Guest

    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 [email protected]

    thank you.

    October 19, 2017 at 1:23 pm #14674
    Ashutosh Bhatt
    Participant

    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

  • Author
    Posts
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • How to power up two stereo audio amplifiers from a single source of power supply August 16, 2022
  • Need help for diy ups project August 16, 2022
  • Is there a discord for this forum? August 16, 2022
  • cadence transient and pss simulation August 16, 2022
  • Digital Display Information August 16, 2022

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools