?? util.lst
字號:
C51 COMPILER V7.50 UTIL 05/14/2006 13:37:19 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE UTIL
OBJECT MODULE PLACED IN util.OBJ
COMPILER INVOKED BY: C:\Program Files\Keil\C51\BIN\C51.EXE util.c OPTIMIZE(9,SPEED) BROWSE DEBUG OBJECTEXTEND
line level source
1 /*= util.c =========================================================================================
2 *
3 * Copyright (C) 2004 Nordic Semiconductor
4 *
5 * This file is distributed in the hope that it will be useful, but WITHOUT WARRANTY OF ANY KIND.
6 *
7 * Author(s): Ole Saether
8 *
9 * COMPILER:
10 *
11 * This program has been tested with Keil C51 V7.08 and 7.09
12 *
13 * $Revision: 2 $
14 *
15 *==================================================================================================
16 */
17 #include <Nordic\reg9e5.h>
18 #include "uart.h"
19 #include "util.h"
20
21 const char hex_tab[] = "0123456789ABCDEF"; // ASCII-hex table used by hex-output routines
22
23 static volatile unsigned idata timer[2]; // Two utility timers used in radio.c
24 static volatile unsigned char t0lrel, t0hrel;
25
26 void Delay100us(unsigned char n)
27 {
28 1 unsigned char i;
29 1 while(n--)
30 1 for(i=0;i<35;i++)
31 1 ;
32 1 }
33
34 unsigned char SpiReadWrite(unsigned char b)
35 {
36 1 EXIF &= ~0x20; // Clear SPI interrupt
37 1 SPI_DATA = b; // Move byte to send to SPI data register
38 1 while((EXIF & 0x20) == 0x00) // Wait until SPI hs finished transmitting
39 1 ;
40 1 return SPI_DATA;
41 1 }
42
43 //void PutString(const char *s)
44 //{
45 // while(*s != 0)
46 // PutChar(*s++);
47 //}
48
49 //void HexOutNib(unsigned char n)
50 //{
51 // PutChar(hex_tab[n & 0x0f]);
52 //}
53
54 //void HexOutByte(unsigned char b)
55 //{
C51 COMPILER V7.50 UTIL 05/14/2006 13:37:19 PAGE 2
56 // HexOutNib(b >> 4);
57 // HexOutNib(b & 0x0f);
58 //}
59
60 //void HexOutWord(unsigned int w)
61 //{
62 // HexOutByte(w >> 8);
63 // HexOutByte(w & 0xff);
64 //}
65
66 void InitTimer(void)
67 {
68 1 timer[0] = timer[1] = 0;
69 1
70 1 TR0 = 0;
71 1 TMOD &= ~0x03;
72 1 TMOD |= 0x01; // mode 1
73 1 CKCON |= 0x08; // T0M = 1 (/4 timer clock)
74 1 t0lrel = 0x60; // 1KHz tick...
75 1 t0hrel = 0xF0; // ... = 65536-16e6/(4*1e3) = F060h
76 1 TF0 = 0; // Clear any pending Timer0 interrupts
77 1 TR0 = 1; // Start Timer0
78 1 ET0 = 1; // Enable Timer0 interrupt
79 1 }
80
81 void Timer0ISR (void) interrupt 1
82 {
83 1 TF0 = 0; // Clear Timer0 interrupt
84 1 TH0 = t0hrel; // Reload Timer0 high byte
85 1 TL0 = t0lrel; // Reload Timer0 low byte
86 1 timer[0]++; // Increment timer[0]
87 1 timer[1]++; // Increment timer[1
88 1 }
89
90 void ResetTimer(unsigned char n)
91 {
92 1 ET0 = 0; // Disable Timer0 interrupt
93 1 timer[n & 0x01] = 0; // Clear timer[n]
94 1 ET0 = 1; // Enable Timer0 interrupt
95 1 }
96
97 unsigned GetTimer(unsigned char n)
98 {
99 1 unsigned tmp;
100 1 ET0 = 0; // Disable Timer0 interrupt
101 1 tmp = timer[n]; // Clear timer[n]
102 1 ET0 = 1; // Enable Timer0 interrupt
103 1 return tmp;
104 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 139 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 19 ----
IDATA SIZE = 4 ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -