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.

Need Help with Frequency Reading 16F877A

Status
Not open for further replies.

xylynn

Member level 2
Joined
Nov 26, 2007
Messages
47
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,579
Hello
I'm newbie with PIC.

I would like to read 12.5 kHz square wave frequency from printer port output. This 12.5 kHz square wave have to be read by PIC16F877A. If 12.5 kHz is read, then PIC's output will be High. If 12.5 kHz isn't read, the output will be Low.

Can anyone suggest me how to do this?

Thanks in advanced.....

kindly respect
xylynn
 

You need a fixed reference to compare it with. Look at using one of the timer registers to create a 'time window' during which you count pulses. 12.5KHz is a bit fast for a software loop to read so look at feeding the signal straight into TMR0 which can count at MHz rates. The idea is you generate a window period of say 10mS using TMR1 or TMR2. At the start of the window you clear TMR0 and at the end of the period you read TMR0, in 10mS the count should have reached 12.5KHz/100 = 125. You can then compare the number to see if it is valid or not.

Brian.
 
  • Like
Reactions: xylynn

    xylynn

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top