Using The Timers In A PIC [C++ + SDCC]

Discussion in 'Embedded Systems and Microcontrollers' started by ajm113, Jan 16, 2012.

  1. ajm113

    Thread Starter Member

    Feb 19, 2011
    176
    5
    I was wondering if I could use the timers in a PIC18F4550 to save some space and use them as to count how long a event has been active in C using SDCC. I'm new using this compiler and library's. =/

    e.g: I'm writing a fire alarm panel program that has all the bells and whistles a commercial one you would see. What I'm trying to accomplish is a cut off delay. When the alarm has been active for more then 20 minutes, I want the audible signal devices to shut off. (This feature is in many of them, it stops a false alarm from sounding encase no one is home)

    I was hopping for someone to write a simple example of using the timer in a PIC in C to help me get a better idea how to write this. I seem to have everything down such as reading ADC, setting pins outputs and inputs, but I've never played with timers.

    Thank you, Ajm.
     
    Last edited: Jan 16, 2012
  2. stahta01

    Member

    Jun 9, 2011
    133
    21
    Is there any reason that you believe the SDCC compiles C++ code?
    If yes, what is the reason you think a C only Compiler compiles C++ code?

    Note: If it was caused by "SDCPP" it is the C preprocessor not C++ Compiler.

    Tim S.
     
  3. ajm113

    Thread Starter Member

    Feb 19, 2011
    176
    5
    Oops sorry I'm so used to writing C++ 90% of the time. I called C by C++ by mistake. Just a error in referencing is all.

    Anyways on topic...
     
    Last edited: Jan 16, 2012
Loading...