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 / What is PROBLEM?

What is PROBLEM?

|

Microcontroller › 8051 › What is PROBLEM?

  • This topic has 3 replies, 2 voices, and was last updated 11 years, 8 months ago by AJISH ALFRED.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • August 28, 2013 at 2:42 am #2606
    SADIN
    Participant

    i used keilC- at89s52 but it doesn’t work.

    Can you help me????

    /* ==================chuongtrinh tao 3 song vuong =================== */
    #include<reg52.h>              // Dinh kem file thu vien
    #include<stdio.h>
    /*==================khai bao bien==================*/
    sbit  wave0= P1^0;                // xuat ra 3 pin
    sbit  wave1= P1^1;             
    sbit  wave2= P1^2;   
    /*=================hàm ngat timer 2==================*/
     void timer2(void) interrupt 5
     { wave0=~wave0;
     }
      /*=================hàm ngat timer 1==================*/
     void timer1(void) interrupt 3
     { wave1=~wave1;
     }
    /*=================hàm ngat timer 0==================*/
     void timer0(void) interrupt 1
     { TR0=0;
        TH0=-10000/256;            // xung chu ky 20000us
    TL0=-10000%256;
    TR0=1;
    wave2=~wave2;
     }
    /*


    ham chinh


    */
    void main(void)
    { T2MOD=0x02;              // DCEN=0,timer 2 dem len
     RCAP2H=-25000/256;        // xung chu ky 50000us
     RCAP2L=-25000%256;
     TR2=1;
     TMOD=0x21;               // timer0- mode1; timer1 – mode 2
     TH1=-100;   // xung chu ky 200us
     TL1=-100;      
     TR1=1;
    /* khoi tao cac thanh ghi cho phep ngat va uu tien ngat */
        IE=0xAA;
    TF0=1;
    while(1) ;
    }
     
    September 24, 2013 at 4:34 am #10479
    AJISH ALFRED
    Participant

    Hi Sadin,

    Could you please post a small description about what are you exactly trying to achieve with that code. It would be easy for us to help you if the comments were written in English.

    September 24, 2013 at 3:02 pm #10482
    SADIN
    Participant

    Thanks!

    I found errors: library( reg52) didn’t have T2mod register.

    September 25, 2013 at 4:44 am #10483
    AJISH ALFRED
    Participant

    You need to include the header file for timers. I don’t remember the exact header file name, suggest you to google it!

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

RSS Recent Posts

  • Can I make two inputs from one?? June 17, 2025
  • Photo interrupter Connections June 17, 2025
  • Is AI making embedded software developers more productive? June 17, 2025
  • Why can't I breadboard this oscillator? June 17, 2025
  • Cataract Lens Options? June 16, 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