pulse program for pic16f873

Discussion in 'Embedded Systems and Microcontrollers' started by haran, Jun 11, 2008.

  1. haran

    Thread Starter Active Member

    Apr 6, 2008
    can u guys help me to crate a pulse program for pic16f873? i need the pic 2 send out a pulse in the frequency of 40khz:confused:
  2. CVMichael

    AAC Fanatic!

    Aug 3, 2007
    I think what you need is to setup an interrupt, that turns one of the pins on and off, at your required frequency.

    I just found out how to use interrupts myself :)

    Here is the link:
    in the last post you will see code for the interrupt

    To calculate the values that you need for your frequency use this formula:
    pic_clock_MHz / 8 / prescaler / (256-Timer_initial_value) = your frequency

    Read pages 6 & 7 from the PDF link I posted for a better explanation on how to calculate the values