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
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 8 years, 10 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

  • How to power up two stereo audio amplifiers from a single source of power supply August 16, 2022
  • Need help for diy ups project August 16, 2022
  • Is there a discord for this forum? August 16, 2022
  • cadence transient and pss simulation August 16, 2022
  • Digital Display Information August 16, 2022

Stay Up To Date

Newsletter Signup
EngineersGarage

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