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 / issue regarding waveform generation with atmega16

issue regarding waveform generation with atmega16

|

Microcontroller › AVR › issue regarding waveform generation with atmega16

  • This topic has 1 reply, 2 voices, and was last updated 13 years, 2 months ago by AJISH ALFRED.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • November 22, 2012 at 9:36 am #2001
    lokesh tiwari
    Participant

    sir i want to generate 4 square waves at 4 saperate pins of atmega 16 MCU….for 250ms time period for each………….now tell me that how can i do it……………..

    one more thing i studied the article on this wavesite(engineersgarage.com)named as waveform generation….bt at the time of compilation through avr studio4 it shows an error…..

    may you plz check it and plz tell me that what is the error….and am i doing right?

    my code is…

     

     

    #include<avr/io.h>
    #include<util/delay.h>
    #include<avr/interrupt.h>
    void t0_init(void);
     
    #define FREQ 1000000 // crsytal freqeuncy
    #define PRECSALER 1024
    #define F_OUT 4 // output frequency
    #define OCR0_VALUE ((((FREQ)/PRECSALER)/F_OUT)-1)
    int main()
    {
    t0_init(); // timer initialize
    sei(); // enable global interrupts
    while(1);
    }
     
    void t0_init()
    {
    // WGM0[1:0]= 10, for CTC mode
    // COM0[1:0]= 01, to toggle OC0 on compare match
    // CS0[2:0] =010. for prescaler 8
     
    TCCR0=(1<<WGM01)|(1<<COM00)|(1<<CS02)|(1<<CS00);
    DDRB|=(1<<PB3);
    DDRD|=(1<<PD4)|(1<<PD5)|(1<<PD7) // select as output pin 
    TIMSK|=(1<<OCIE0); //enable output compare interrupt
    }
     
    ISR(TIMER0_COMP_vect) // interrupt subroutine
    {
    OCR0=(uint8_t)OCR0_VALUE; //put OCR value
    }
     
     
     
    and the error is………………
    ../demo1.c:26: error: called object ‘128’ is not a function
    plz guide me plz
     
     

     

    November 22, 2012 at 5:17 pm #8779
    AJISH ALFRED
    Participant

    Can you please tell me whcih is your line number 26 in the .c file?

  • 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

  • RC Electronic Speed Control Capacitors February 17, 2026
  • Annex32 / Annex RDS For ESP Micros - A Quick and Dirty Example February 16, 2026
  • Convenient audio FFT module? February 16, 2026
  • CR2/CR123A Batteries In Projects February 16, 2026
  • Harman Kardon radio module BMW noise February 16, 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