+ Post New Thread
Results 1 to 2 of 2
  1. #1
    Full Member level 4
    Points: 4,936, Level: 16
    Faizan Jawaid's Avatar
    Join Date
    Jul 2008
    Location
    Karachi, Pakistan
    Posts
    189
    Helped
    22 / 22
    Points
    4,936
    Level
    16

    How to generate square wave using timers in PIC?

    Can anyone pls tell me how to generate square wave using Timers rather than delay in PIC microcontrollers (16F876). Im using CCS COMPILER.

    Regards.

    •   Alt18th July 2008, 20:22

      advertising

        
       

  2. #2
    Full Member level 6
    Points: 13,819, Level: 28

    Join Date
    Jun 2004
    Location
    Sao Paulo - Brasil
    Posts
    331
    Helped
    64 / 64
    Points
    13,819
    Level
    28

    Re: Timers in PIC???

    You could do the following:

    1) Use timer interruption (when the timer overflows) to call the interruption routine that toggles one or more output port state.

    2) Timer1 registers can be loaded with a value defined by the user, the difference between 65535 (max count) and the value loaded in the timer registers will be the period of a semi cycle of the output signal. Timer1 clock can be configured and depends on of main clock and the prescaler setting.

    3) The period of time wasted by the interruption service routine should not be greater than the period between two timer interruptions



+ Post New Thread
Please login