| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- C51 COMPILER V9.53.0.0 DELAY 09/30/2018 11:45:28 PAGE 1
- C51 COMPILER V9.53.0.0, COMPILATION OF MODULE DELAY
- OBJECT MODULE PLACED IN .\Output\Delay.obj
- COMPILER INVOKED BY: D:\Keil_v5\C51\BIN\C51.EXE ..\..\Code\User\Common\Delay.c LARGE OPTIMIZE(0,SPEED) BROWSE INCDIR(../
- -../Code/Include;../../Code/User;../../Code/User/Common;../../Code/User/Driver) DEFINE(FOSC_160000=1) DEBUG OBJECTEXTEND
- -PRINT(.\Output\LST\Delay.lst) TABS(2) OBJECT(.\Output\Delay.obj)
- line level source
- 1 /*--------------------------------------------------------------------------------------------------------
- --*/
- 2 /*
- - */
- 3 /* Copyright(c) 2017 Nuvoton Technology Corp. All rights reserved.
- - */
- 4 /*
- - */
- 5 /*--------------------------------------------------------------------------------------------------------
- --*/
- 6
- 7 //********************************************************************************************************
- -***
- 8 // Website: http://www.nuvoton.com
- 9 // E-Mail : [email protected]
- 10 // Date : Jan/21/2017
- 11 //********************************************************************************************************
- -***
- 12 #include "Common.h"
- 13 #include "Delay.h"
- 14
- 15 uint8 BIT_TMP;
- 16
- 17 //-------------------------------------------------------------------------
- 18 void Timer0_Delay100us ( uint32 u32CNT )
- 19 {
- 20 1 clr_T0M; //T0M=0, Timer0 Clock = Fsys/12
- 21 1 TMOD |= 0x01; //Timer0 is 16-bit mode
- 22 1 set_TR0; //Start Timer0
- 23 1
- 24 1 while ( u32CNT != 0 )
- 25 1 {
- 26 2 TL0 = LOBYTE ( TIMER_DIV12_VALUE_100us ); //Find define in "Function_define.h" "TIMER VALUE"
- 27 2 TH0 = HIBYTE ( TIMER_DIV12_VALUE_100us );
- 28 2
- 29 2 while ( TF0 != 1 ); //Check Timer0 Time-Out Flag
- 30 2
- 31 2 clr_TF0;
- 32 2 u32CNT --;
- 33 2 }
- 34 1
- 35 1 clr_TR0; //Stop Timer0
- 36 1 }
- 37 //------------------------------------------------------------------------------
- 38 void Timer0_Delay1ms ( uint32 u32CNT )
- 39 {
- 40 1 clr_T0M; //T0M=0, Timer0 Clock = Fsys/12
- 41 1 TMOD |= 0x01; //Timer0 is 16-bit mode
- 42 1 set_TR0; //Start Timer0
- 43 1
- 44 1 while ( u32CNT != 0 )
- 45 1 {
- 46 2 TL0 = LOBYTE ( TIMER_DIV12_VALUE_1ms ); //Find define in "Function_define.h" "TIMER VALUE"
- C51 COMPILER V9.53.0.0 DELAY 09/30/2018 11:45:28 PAGE 2
- 47 2 TH0 = HIBYTE ( TIMER_DIV12_VALUE_1ms );
- 48 2
- 49 2 while ( TF0 != 1 ); //Check Timer0 Time-Out Flag
- 50 2
- 51 2 clr_TF0;
- 52 2 u32CNT --;
- 53 2 }
- 54 1
- 55 1 clr_TR0; //Stop Timer0
- 56 1 }
- 57
- 58 //------------------------------------------------------------------------------
- 59 void Timer1_Delay10ms ( uint32 u32CNT )
- 60 {
- 61 1 clr_T1M; //T1M=0, Timer1 Clock = Fsys/12
- 62 1 TMOD |= 0x10; //Timer1 is 16-bit mode
- 63 1 set_TR1; //Start Timer1
- 64 1
- 65 1 while ( u32CNT != 0 )
- 66 1 {
- 67 2 TL1 = LOBYTE ( TIMER_DIV12_VALUE_10ms ); //Find define in "Function_define.h" "TIMER VALUE"
- 68 2 TH1 = HIBYTE ( TIMER_DIV12_VALUE_10ms );
- 69 2
- 70 2 while ( TF1 != 1 ); //Check Timer1 Time-Out Flag
- 71 2
- 72 2 clr_TF1;
- 73 2 u32CNT --;
- 74 2 }
- 75 1
- 76 1 clr_TR1; //Stop Timer1
- 77 1 }
- 78 //------------------------------------------------------------------------------
- 79 void Timer2_Delay500us ( uint32 u32CNT )
- 80 {
- 81 1 clr_T2DIV2; //Timer2 Clock = Fsys/4
- 82 1 clr_T2DIV1;
- 83 1 set_T2DIV0;
- 84 1 set_TR2; //Start Timer2
- 85 1
- 86 1 while ( u32CNT != 0 )
- 87 1 {
- 88 2 TL2 = LOBYTE ( TIMER_DIV4_VALUE_500us ); //Find define in "Function_define.h" "TIMER VALUE"
- 89 2 TH2 = HIBYTE ( TIMER_DIV4_VALUE_500us );
- 90 2
- 91 2 while ( TF2 != 1 ); //Check Timer2 Time-Out Flag
- 92 2
- 93 2 clr_TF2;
- 94 2 u32CNT --;
- 95 2 }
- 96 1
- 97 1 clr_TR2; //Stop Timer2
- 98 1 }
- 99 //------------------------------------------------------------------------------
- 100 void Timer3_Delay100ms ( uint32 u32CNT )
- 101 {
- 102 1 T3CON = 0x07; //Timer3 Clock = Fsys/128
- 103 1 set_TR3; //Trigger Timer3
- 104 1
- 105 1 while ( u32CNT != 0 )
- 106 1 {
- 107 2 RL3 = LOBYTE ( TIMER_DIV128_VALUE_100ms ); //Find define in "Function_define.h" "TIMER VALUE"
- 108 2 RH3 = HIBYTE ( TIMER_DIV128_VALUE_100ms );
- C51 COMPILER V9.53.0.0 DELAY 09/30/2018 11:45:28 PAGE 3
- 109 2
- 110 2 while ( ( T3CON & SET_BIT4 ) != SET_BIT4 ); //Check Timer3 Time-Out Flag
- 111 2
- 112 2 clr_TF3;
- 113 2 u32CNT --;
- 114 2 }
- 115 1
- 116 1 clr_TR3; //Stop Timer3
- 117 1 }
- 118 //------------------------------------------------------------------------------
- 119 void Timer3_Delay10us ( uint32 u32CNT )
- 120 {
- 121 1 T3CON = 0x02; //Timer3 Clock = Fsys/4
- 122 1 set_TR3; //Trigger Timer3
- 123 1
- 124 1 while ( u32CNT != 0 )
- 125 1 {
- 126 2 RL3 = LOBYTE ( TIMER_DIV4_VALUE_10us ); //Find define in "Function_define.h" "TIMER VALUE"
- 127 2 RH3 = HIBYTE ( TIMER_DIV4_VALUE_10us );
- 128 2
- 129 2 while ( ( T3CON & SET_BIT4 ) != SET_BIT4 ); //Check Timer3 Time-Out Flag
- 130 2
- 131 2 clr_TF3;
- 132 2 u32CNT --;
- 133 2 }
- 134 1
- 135 1 clr_TR3; //Stop Timer3
- 136 1 }
- 137
- 138 //------------------------------------------------------------------------------
- 139 #define TIMER_DIV4_VALUE_1us 65536-4 //4*4/16000000 = 1 uS, // Timer divider = 4 for TM2/TM3
- 140 void Timer3_Delay1us ( uint32 u32CNT )
- 141 {
- 142 1 T3CON = 0x02; //Timer3 Clock = Fsys/4
- 143 1 set_TR3; //Trigger Timer3
- 144 1
- 145 1 while ( u32CNT != 0 )
- 146 1 {
- 147 2 RL3 = LOBYTE ( TIMER_DIV4_VALUE_1us ); //Find define in "Function_define.h" "TIMER VALUE"
- 148 2 RH3 = HIBYTE ( TIMER_DIV4_VALUE_1us );
- 149 2
- 150 2 while ( ( T3CON & SET_BIT4 ) != SET_BIT4 ); //Check Timer3 Time-Out Flag
- 151 2
- 152 2 clr_TF3;
- 153 2 u32CNT --;
- 154 2 }
- 155 1
- 156 1 clr_TR3; //Stop Timer3
- 157 1 }
- 158
- 159 //------------------------------------------------------------------------------
- 160 void Timer3_Delay1ms ( uint32 u32CNT )
- 161 {
- 162 1 T3CON = 0x02; //Timer3 Clock = Fsys/4
- 163 1 set_TR3; //Trigger Timer3
- 164 1
- 165 1 while ( u32CNT != 0 )
- 166 1 {
- 167 2 RL3 = LOBYTE ( TIMER_DIV4_VALUE_1ms ); //Find define in "Function_define.h" "TIMER VALUE"
- 168 2 RH3 = HIBYTE ( TIMER_DIV4_VALUE_1ms );
- 169 2
- 170 2 while ( ( T3CON & SET_BIT4 ) != SET_BIT4 ); //Check Timer3 Time-Out Flag
- C51 COMPILER V9.53.0.0 DELAY 09/30/2018 11:45:28 PAGE 4
- 171 2
- 172 2 clr_TF3;
- 173 2 u32CNT --;
- 174 2 }
- 175 1
- 176 1 clr_TR3; //Stop Timer3
- 177 1 }
- 178
- MODULE INFORMATION: STATIC OVERLAYABLE
- CODE SIZE = 795 ----
- CONSTANT SIZE = ---- ----
- XDATA SIZE = 33 ----
- PDATA SIZE = ---- ----
- DATA SIZE = ---- ----
- IDATA SIZE = ---- ----
- BIT SIZE = ---- ----
- END OF MODULE INFORMATION.
- C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
|