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.

IR+PIC 16f877a counter mode

Status
Not open for further replies.

ansarmytheen

Full Member level 3
Joined
Jan 9, 2010
Messages
155
Helped
55
Reputation
110
Reaction score
53
Trophy points
1,308
Location
kerala
Activity points
2,100
Hai friends,

In my project i interface an IR module with PIC 16F877a,This system is used for counting motro rotation.
PIC in Counter mode using timer1.Now the problem is that when i connect manually to an IR then PIC count properly.But when it connected to the motor it reads wrong count.OR it does not work properly.
Here i post my code.


CODE


int i=0,j=0,k=0;
void main()
{
trisc=0xff;
trisb=0;
t1con=0x0b;
tmr1l=0;
tmr1h=0;
while(1)
{
i=tmr1l;
if(i<50)
{
portb.f0=1;

}
if(i==50)
{
portb.f0=0;
portb.f1=1;
Delay_ms(100);
portb.f1=0;
portb.f2=1;
tmr1l=51;
}
if(i>100)
{
portb.f1=0;
tmr1l=0;
}

}
}
 

when i connect
manually to an IR then PIC count properly.But when it connected to the
motor it reads wrong count.

Could you explain your connections ? What you mean by 'when i connect manually to an IR'?
How you are connecting it to motor?
 

Didn't understood properly but just assuming,is the problem hits you when you want to count for 50 or more?
 

Could you explain your connections ? What you mean by 'when i connect manually to an IR'?
How you are connecting it to motor?

Manually means

if we remove the ir module from motor and it connected with pic.Then we cut the the IR rays by a metal or anything then the counting is correct.
 

please post photos of your hardware. .
i did not get you be more clear!!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top