TQ2416 development board TIMER interrupt application control device

Publisher:RadiantSerenityLatest update time:2018-11-26 Source: eefocusKeywords:TQ2416  TIMER Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

       This issue introduces the control device code application of the new generation ARM9 development board TQ2416, using TIMER code to control the time period of the device. Timer syntax, timer code, the function is to repeatedly trigger the timer event of the specified window within the specified time interval.


  Below is what senior blogger dengchonglin shared about how to apply TIMER code on the TQ2416 development board.


  If you need to use the TQ2416 development board as a control device, you need to implement US level interrupts~!


  And it cannot be realized by FOR loop, because FOR loop is a timer that temporarily uses resources. This will make the CPU of the development board too expensive and unable to bear it. Using TIMER code can better run the control program.


  I looked at the DATASHEET and found that there are 5 TIMERs: TIMER0~3 PWM output, TIMER4 system TICK


  TIMER4 TICK


  TIMER3 TOUCH


  TIMER2


  TIMER1


  TIMER0 BL


  Finally decided to use TIMER2 interrupt to achieve.


  1. Apply for an event


  2. Start a thread to wait for an interrupt event


  3. Set TIMER2 PWM


  g_pPWMRegs->TCFG1 &= (~(0xf<<20)); //For interrupt


  g_pPWMRegs->TCFG1 &= (~(0xf<<8));


  g_pPWMRegs->TCFG1 |= (0<<8); //mux = 1/2


  g_pPWMRegs->TCON &= (~(0xf<<12));


  Set the timer time


  void Set_Timer(UINT32 nUS)


  {


  DWORD tmp;


  g_pPWMRegs->TCNTB2 = nUS*g_PRINTER_1us_Counter - 1;


  g_pPWMRegs->TCMPB2 = 0 ;


  //Be sure to use the following assignment method, otherwise no interrupt will occur


  tmp = g_pPWMRegs->TCON & (~(0xf << 12));


  g_pPWMRegs->TCON = tmp | (2 << 12);


  g_pPWMRegs->TCON = tmp | (1 << 12);

  

  }


  At this point, TIMER2 is already running!


Keywords:TQ2416  TIMER Reference address:TQ2416 development board TIMER interrupt application control device

Previous article:ARM9: How to port linux2.6.38 kernel to TQ2440
Next article:2416RBG interface LCD is replaced with I80 interface LCD driver to modify NK part

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号