Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

3 ph sequence detection using resistor network and programming using pic16f877a

Status
Not open for further replies.

kavin_eees

Member level 3
Joined
May 11, 2012
Messages
57
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,842
hi.

now am working in a project to find the phase sequence of three phase supply with resistor network and programming ..

can any one guide me the way for identify the sequence.
thanks in advance...
 

Hi,

Why not draw the signal waveforms and find out on your own?
Code:
A: H - H - L - L - L - H
B: L - H - H - H - L - L
C: L - L - L - H - H - H

Klaus
 

Hi,

Why not draw the signal waveforms and find out on your own?
Code:
A: H - H - L - L - L - H
B: L - H - H - H - L - L
C: L - L - L - H - H - H

Klaus

sorry i didnt get u...?
will u pls tell me in brief?
 

Hi,

please take a sheet of paper and a pencil.

Draw the 3 phases in one diagram of 360° in length.
now draw a vertical line every time when a signal crosses zero level. (rising or falling)

You get 6 x 60° sections.
in each section:
* either two signals are postive (H) and one signal is negative (L)
* or one signal is positive and two signals are negative

In my table I named the three phases "A", "B", "C", and "H" is for positive voltage, "L" is for negative voltage.

--> if you feed each phase to a comparator referenced to the star point (or neutral) then you will get HIGH (positive) and LOW (negative) outputs fed to your microcontroller.

****
now to the microcontroller logic:

let´s assume the status is:
A: L
B: H
C: L

then there are only two valid "next" status (stati) possible.
either:
A: L
B: H
C: H
for forward = CW

or:
A: H
B: H
C: L
for reverse = CCW

everything else is invalid.

Klaus
 
dear klausST
thanks for ur guidance ...
i had completed the phase sequence finder...
once again thanks a lot..
edaboard rocks....:)
 

Hi,

please take a sheet of paper and a pencil.

Draw the 3 phases in one diagram of 360° in length.
now draw a vertical line every time when a signal crosses zero level. (rising or falling)

You get 6 x 60° sections.
in each section:
* either two signals are postive (H) and one signal is negative (L)
* or one signal is positive and two signals are negative

In my table I named the three phases "A", "B", "C", and "H" is for positive voltage, "L" is for negative voltage.

--> if you feed each phase to a comparator referenced to the star point (or neutral) then you will get HIGH (positive) and LOW (negative) outputs fed to your microcontroller.

****
now to the microcontroller logic:

let´s assume the status is:
A: L
B: H
C: L

then there are only two valid "next" status (stati) possible.
either:
A: L
B: H
C: H
for forward = CW

or:
A: H
B: H
C: L
for reverse = CCW

everything else is invalid.

Klaus

Hi,

please take a sheet of paper and a pencil.

Draw the 3 phases in one diagram of 360° in length.
now draw a vertical line every time when a signal crosses zero level. (rising or falling)

You get 6 x 60° sections.
in each section:
* either two signals are postive (H) and one signal is negative (L)
* or one signal is positive and two signals are negative

In my table I named the three phases "A", "B", "C", and "H" is for positive voltage, "L" is for negative voltage.

--> if you feed each phase to a comparator referenced to the star point (or neutral) then you will get HIGH (positive) and LOW (negative) outputs fed to your microcontroller.

****
now to the microcontroller logic:

let´s assume the status is:
A: L
B: H
C: L

then there are only two valid "next" status (stati) possible.
either:
A: L
B: H
C: H
for forward = CW

or:
A: H
B: H
C: L
for reverse = CCW

everything else is invalid.

Klaus

dear klausst.

in simulation it is working perfectly
but in hard ware it not at all working...
kindly give suggestions.
pls find the code for reference



Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include<pic.h>
#include <htc.h>
#include<math.h>
#include<string.h>
#include<stdio.h> 
#define _XTAL_FREQ   8000000  
 
 
__CONFIG (DEBUGDIS & LVPDIS & BOREN & MCLRDIS& PWRTDIS & WDTDIS & INTIO); //MCLREN
 
 
 
 
unsigned int GetADCValue1()
{
    //ADCON0 &= 0xc7;         // Clear Channel selection bits
    //ADCON0 |= (Channel<<3); // Select channel pin as ADC input
    
    __delay_ms(3);         // Time for Acqusition capacitor 
                            // to charge up and show correct value
    GODONE  = 1;            // Enable Go/Done
 
    while(GODONE);        // Wait for conversion completion
 
    return ((ADRESH<<8)+ADRESL);   // Return 10 bit ADC value
}
 
 
unsigned int GetADCValue2()
{
    ADCON0 = 0xc5;         // Clear Channel selection bits
    //ADCON0 |= (Channel<<3); // Select channel pin as ADC input
    
    __delay_ms(3);         // Time for Acqusition capacitor 
                            // to charge up and show correct value
    GODONE  = 1;            // Enable Go/Done
 
    while(GODONE);        // Wait for conversion completion
 
    return ((ADRESH<<8)+ADRESL);   // Return 10 bit ADC value
}
 
unsigned int GetADCValue3()
{
    ADCON0 = 0xc9;         // Clear Channel selection bits
    //ADCON0 |= (Channel<<3); // Select channel pin as ADC input
    
    __delay_ms(3);         // Time for Acqusition capacitor 
                            // to charge up and show correct value
    GODONE  = 1;            // Enable Go/Done
 
    while(GODONE);        // Wait for conversion completion
 
    return ((ADRESH<<8)+ADRESL);   // Return 10 bit ADC value
}
 
 
/*void start_timer()
{
GIE=1;
TMR1IE   = 1;
}
void stop_timer()
{
GIE=0;
T1CON=0x00;
TMR1ON=0;
//TMR1IE     = 0;
}
 
void InitTimer0(){
 T1CON   = 0x01;
  //TMR1IF   = 0;
  TMR1H  = 0x00;
  TMR1L  = 0x00;
  TMR1IE     = 0;
  INTCON     = 0x00;
 
}
 
*/
void main()
{
 
unsigned int ADC_value,high,low;
unsigned int address,RL,RH,YL,YH,BL,BH;
 
 
    TRISC=0x00;
    PORTC=0x00;
TRISA=0xff;
TRISB=0x00;
PORTB=0x00;
ADCON0=0xc1;
ADCON1=0x80;
ANSEL=0x0f;
//stop_timer();
 
    while(1)
    {
    do
    {
    RL= GetADCValue1();
    RH=GetADCValue1();
    }while(!(RL<RH));
 
    YL=GetADCValue2();
    YH=GetADCValue2();
if((RL<RH) && (YL<YH))
{
RB3=1;
}
else
RB3=0;
while(1);
    }
}

 
Last edited by a moderator:

Hi,

but in hard ware it not at all working...
--> then show us your hardware. And give a more detailed error description.

Klaus
 

pls find the circuit...View attachment voltage detection.BMP

- - - Updated - - -

pls find the modified code..


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include<pic.h>
#include <htc.h>
#include<math.h>
#include<string.h>
#include<stdio.h> 
#define _XTAL_FREQ   8000000  
 
 
__CONFIG (DEBUGDIS & LVPDIS & BOREN & MCLRDIS& PWRTDIS & WDTDIS & INTIO); //MCLREN
 
 
 
 
unsigned int GetADCValue1()
{
 //__delay_us(10); 
    ADCON0 = 0xc1;         // Clear Channel selection bits
    //ADCON0 |= (Channel<<3); // Select channel pin as ADC input
    
    __delay_us(800);         // Time for Acqusition capacitor 
                            // to charge up and show correct value
    GODONE  = 1;            // Enable Go/Done
 
    while(GODONE);        // Wait for conversion completion
 
    return ((ADRESH<<8)+ADRESL);   // Return 10 bit ADC value
}
 
 
unsigned int GetADCValue2()
{// __delay_us(10); 
    ADCON0 = 0xc5;         // Clear Channel selection bits
    //ADCON0 |= (Channel<<3); // Select channel pin as ADC input
    
    __delay_us(800);         // Time for Acqusition capacitor 
                            // to charge up and show correct value
    GODONE  = 1;            // Enable Go/Done
 
    while(GODONE);        // Wait for conversion completion
 
    return ((ADRESH<<8)+ADRESL);   // Return 10 bit ADC value
}
 
unsigned int GetADCValue3()
{ //__delay_us(10); 
    ADCON0 = 0xc9;         // Clear Channel selection bits
    //ADCON0 |= (Channel<<3); // Select channel pin as ADC input
    
    __delay_us(800);         // Time for Acqusition capacitor 
                            // to charge up and show correct value
    GODONE  = 1;            // Enable Go/Done
 
    while(GODONE);        // Wait for conversion completion
 
    return ((ADRESH<<8)+ADRESL);   // Return 10 bit ADC value
}
 
void main()
{
 
unsigned int ADC_value,high,low;
unsigned int address,RL,RH,YL,YH,BL,BH;
 
 
    TRISC=0x00;
    PORTC=0x00;
TRISA=0xff;
TRISB=0x00;
PORTB=0x00;
//ADCON0=0xc1;
ADCON1=0x80;
ANSEL=0x0f;
//stop_timer();
 
    while(1)
    {
    do
    {
    RL= GetADCValue1();
    RH=GetADCValue1();
    YL=GetADCValue2();
    YH=GetADCValue2();
    }while(!((RL<RH) && (YL<YH)));
 
 
//  YL=GetADCValue2();
    //YH=GetADCValue2();
if((RL<RH) && (YL<YH))
{
RB3=1;
}
else
RB3=0;
//while(1);
    }
}

 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top