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 / PROGRAMMING Atmega 16.. Doubts

PROGRAMMING Atmega 16.. Doubts

|

Microcontroller › AVR › PROGRAMMING Atmega 16.. Doubts

  • This topic has 0 replies, 1 voice, and was last updated 12 years, 4 months ago by Muralikrishna R.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • February 2, 2013 at 3:23 pm #2100
    Muralikrishna R
    Participant

    i got a sensor which measures speed from TYRE and give out different digital pulses at different speeds(ie frequency is different as speed changes=Pwm). MY INTENTION is,for a particular frequency (coreponding to a specified speed) say 20Hz,i need to make an output pin HIGH. I wrote the program for TIMER COUNT, and to make the output high.

    NOW, I WANNA know to which pin i should give the SENSOR OUTPUT ie the pwm signal, which is the input to my ATMEGA 16. Through Input capture pin? If so,how do i configure it.

    Please do help.

    my code so far: all i need is an input pwm to ATMEGA 16

     

    #include <avr/io.h>

     
    int main (void)
    {
    DDRB |= (1 << 0); // Set LED as output
     
    TCCR1B |= (1 << CS10); // Set up timer
     
    for (;;)
    {
    // Check timer value in if statement, true when count matches 1/20 of a second
    if (TCNT1 >= 49999)
    {
    PORTB ^= (1 << 0); // Toggle the LED
     
    TCNT1 = 0; // Reset timer value
    }
    }
    }
  • Author
    Posts
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Adhesive Defibrillator Pad Cable June 25, 2025
  • Epson crystal oscillators June 25, 2025
  • Simple LED Analog Clock Idea June 24, 2025
  • Fun with AI and swordfish basic June 24, 2025
  • Microinverters and storeage batteries? June 23, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 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