EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Understanding timers/interrupts

Understanding timers/interrupts

|

Microcontroller › 8051 › Understanding timers/interrupts

  • This topic has 1 reply, 2 voices, and was last updated 11 years, 9 months ago by AJISH ALFRED.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 23, 2014 at 2:56 pm #3096
    John Jameson
    Participant
    Hey guys,
    I’m looking over some code here for a pulse sensor and are just looking for some clarification on some points,from I can see the interrupt of the mirco is being used to detect the pulse when a finger is placed on a sensor,I’m just gonna post the interrupts rather than post the whole code.
    Variables used are all ints
    void extrint (void) interrupt 0 // external Interrupt to detect the pulse
    {
    bt=tick; // number of ticks are picked
    tick=0; // reset for next counting
    }
    [/CODE]
    so is bt or tick equal to the number of pulses the sensor reads when a finger is placed over it?
    And resets back when the finger is removed? 
     
    [CODE]void timer0 (void) interrupt 1 using 1 // Timer 0 for one second time
    {
    TH0 = 0xdc; //The value is taken for Ssc/100 at crystal 11.0592MHz
    sec100++; // It is incremented every Ssc/100 at crystal 11.0592MHz
    tick++; // This variable counts the time period of incoming pulse in Sec/100
    if(tick>=3500){tick=0;} // tick are limited to less than 255 for valid calculation
    if(sec100 >=100) // 1 sec = sec100 * 100
    {
    sec++;
    sec100=0;
    }
    }
    [/CODE]
    Not sure on this one,is this a timing reference for the pulses? or something to work out a 1 second timer as it says in comment,I’m a bit lost here

    [CODE]void extrint (void) interrupt 0 // external Interrupt to detect the pulse

    {
    bt=tick; // number of ticks are picked
    tick=0; // reset for next counting
    }
    [/CODE]
    so is bt or tick equal to the number of pulses the sensor reads when a finger is placed over it?
    And resets back when the finger is removed? 
     
    void timer0 (void) interrupt 1 using 1 // Timer 0 for one second time
    {
    TH0 = 0xdc; //The value is taken for Ssc/100 at crystal 11.0592MHz
    sec100++; // It is incremented every Ssc/100 at crystal 11.0592MHz
    tick++; // This variable counts the time period of incoming pulse in Sec/100
    if(tick>=3500){tick=0;} // tick are limited to less than 255 for valid calculation
    if(sec100 >=100) // 1 sec = sec100 * 100
    {
    sec++;
    sec100=0;
    }
    }
    [/CODE]
    Not sure on this one,is this a timing reference for the pulses? or something to work out a 1 second timer as it says in comment,I’m a bit lost here

    [CODE]void timer0 (void) interrupt 1 using 1 // Timer 0 for one second time

    {
    TH0 = 0xdc; //The value is taken for Ssc/100 at crystal 11.0592MHz
    sec100++; // It is incremented every Ssc/100 at crystal 11.0592MHz
    tick++; // This variable counts the time period of incoming pulse in Sec/100
    if(tick>=3500){tick=0;} // tick are limited to less than 255 for valid calculation
    if(sec100 >=100) // 1 sec = sec100 * 100
    {
    sec++;
    sec100=0;
    }
    }
    [/CODE]
    Not sure on this one,is this a timing reference for the pulses? or something to work out a 1 second timer as it says in comment,I’m a bit lost here
    May 27, 2014 at 6:59 am #11775
    AJISH ALFRED
    Participant

    Hi John,

    Suggest you to post the entire code, so that things will become more clear for others to post their comments on your query.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • What branch of electronics has easy spare parts sourcing in north africa ? March 6, 2026
  • USING EASYEDA BUT SOMETHING ISN'T RIGHT? March 6, 2026
  • ESP32 Sub Forum March 6, 2026
  • Hello & a Request: Recommendations for obsolete Panasonic filter Capacitors. March 6, 2026
  • Pnp transistor query March 6, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise