This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

FREQUENCY MEASUREMENT

ASSUME 900-1100HZS GIVEN TO P3.5.WRITE A PROGRAMME TO SHOW SAME ON LCD DISPLAY .ALREADY I SUCCESSEDED TO WRITE A CODE FOR KHZS IN ASSEMBLY.
I SELECTED TMOD 051H,TH0 OFCH. PLZ GIVE ME IDEA TO SOLVE IT.

Parents
  • Assume a square wave with frequency ranging from 900 to 1100 Hz is presented on pin P3.5. Write a program to determine the input frequency on this port pin and display that value on an attached LCD.

    Sounds like another homework problem.

    1) Write an interrupt handler to detect transitions on the input pin and timestamp detected edges
    2) Main body of code calculates interval between timestamps accumulated by the interrupt handler. For extra credit, you can throw in all sorts of fancy averaging, filtering, and aging schemes here. A really simple system can do all the work in the interrupt handler.
    3) Write a driver for the LCD device you're actually using. In this case, all it needs to do is take an integer as input. You might be able to reimplement putchar() and use printf() to print to the display.
    4) Use that driver to display the value calcuated in step 2.

Reply
  • Assume a square wave with frequency ranging from 900 to 1100 Hz is presented on pin P3.5. Write a program to determine the input frequency on this port pin and display that value on an attached LCD.

    Sounds like another homework problem.

    1) Write an interrupt handler to detect transitions on the input pin and timestamp detected edges
    2) Main body of code calculates interval between timestamps accumulated by the interrupt handler. For extra credit, you can throw in all sorts of fancy averaging, filtering, and aging schemes here. A really simple system can do all the work in the interrupt handler.
    3) Write a driver for the LCD device you're actually using. In this case, all it needs to do is take an integer as input. You might be able to reimplement putchar() and use printf() to print to the display.
    4) Use that driver to display the value calcuated in step 2.

Children
No data