📄 9851.lst
字号:
C51 COMPILER V8.09 9851 10/04/2008 12:12:27 PAGE 1
C51 COMPILER V8.09, COMPILATION OF MODULE 9851
OBJECT MODULE PLACED IN 9851.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE 9851.C BROWSE DEBUG OBJECTEXTEND
line level source
1 #include<regx51.h>
2 #include <intrins.h>
3 #include <AD9851.h>
4 sbit RST_AD9851= P3^0;
5 //长延时
6 /******
7 void Delay80Ms(unsigned int k)
8 {
9 unsigned int j;
10 while(k--)
11 {
12 j=7269;
13 while(j--);
14 }
15 }
16 *////////
17 sbit FQ_UD_AD9851=P3^2;
18 sbit W_CLK_AD9851=P3^1;
19
20
21 //======================
22 unsigned long int freq = 0;
23 unsigned long int freq1=0;
24 unsigned long int freq2=0;
25 //unsigned char Control_AD9851 = 0x09; // Phase0 ,power down mode and 6 REFCLK Multiplier enable
26 //unsigned char Control_AD9851 = 0x00; // Phase0 ,power on mode and 6 REFCLK Multiplier disable
27 unsigned char Control_AD9851 = 0x01; // Phase0 ,power on mode and 6 REFCLK Multiplier enable
28 unsigned char W4=0X0e;
29 unsigned char W3=0X38;
30 unsigned char W2=0Xe3;
31 unsigned char W1=0X8e;
32 unsigned char W5;
33 unsigned char W6;
34 unsigned char W7;
35 unsigned char W8;
36 void Parallel2Serial_AD9851(void)
37 { FQ_UD_AD9851=0;
38 1 W_CLK_AD9851=0;
39 1 P1=Control_AD9851; //写入控制字
40 1 W_CLK_AD9851=1;
41 1 W_CLK_AD9851=0;
42 1
43 1 P1=W1; // P0=W8; //先发高位
44 1 W_CLK_AD9851=1;
45 1 W_CLK_AD9851=0;
46 1
47 1 P1=W2; //P0=W7;
48 1 W_CLK_AD9851=1;
49 1 W_CLK_AD9851=0;
50 1
51 1 P1=W3; // P0=W6;
52 1 W_CLK_AD9851=1;
53 1 W_CLK_AD9851=0;
54 1
55 1 P1=W4;//P0=W5;
C51 COMPILER V8.09 9851 10/04/2008 12:12:27 PAGE 2
56 1 W_CLK_AD9851=1;
57 1 W_CLK_AD9851=0;
58 1
59 1 FQ_UD_AD9851=1;
60 1 FQ_UD_AD9851=0;
61 1 }
62
63 void Set_Freq(float Freqency)
64 {
65 1
66 1 unsigned char i;
67 1
68 1 //freq= (unsigned long int)(23.86092942*Freqency); // SYSCLK = 180 MHz
69 1 // freq= (unsigned long int)(23.86115*Freqency); // SYSCLK = 180 MHz
70 1 freq= (unsigned long int)(28.6331153*Freqency); // SYSCLK = 150 MHz
71 1 // freq=200;
72 1 // freq2=200;
73 1
74 1 /* for(i=0;i<32;i++)
75 1 {
76 1 if(freq&0x0001)
77 1 {
78 1 if(i==0) freq1=freq1+1;
79 1 freq1=(freq1+1)<<1;
80 1 freq=freq>>1;
81 1 }
82 1 else
83 1 {
84 1 if(i==0) freq1=0;
85 1 freq1=freq1<<1;
86 1 freq=freq>>1;
87 1 }
88 1 } */
89 1 freq1=freq|(freq&0x01);
90 1 for(i=0;i<32;i++)
91 1 {
92 2 freq1=freq1<<1; //左移一位
93 2 freq=freq>>1;
94 2 freq1=freq1|(freq&0x01);
95 2 }
96 1
97 1
98 1 //把freq中的高位放到freq1的低位
99 1 W1=(unsigned char)freq1&0xff;
100 1 freq1=freq1>>8;
101 1 // W5=(unsigned char)freq2&0xff;
102 1 // freq2=freq2>>8;
103 1
104 1 W2=(unsigned char)freq1&0xff;
105 1 freq1=freq1>>8;
106 1 // W6=(unsigned char)freq2&0xff;
107 1 // freq2=freq2>>8;
108 1
109 1 W3=(unsigned char)freq1&0xff;
110 1 freq1=freq1>>8;
111 1 // W7=(unsigned char)freq2&0xff;
112 1 // freq2=freq2>>8;
113 1
114 1 W4=(unsigned char)freq1&0xff;
115 1 // W8=(unsigned char)freq2&0xff;
116 1
117 1 Parallel2Serial_AD9851();
C51 COMPILER V8.09 9851 10/04/2008 12:12:27 PAGE 3
118 1 }
119 void main(void)
120 {
121 1
122 1 RST_AD9851=1;
123 1 RST_AD9851=1;
124 1 RST_AD9851=0;
125 1 Set_Freq(8000000);//发送的频率
126 1 while(1)
127 1 {
128 2 ;
129 2 }
130 1
131 1
132 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 255 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 21 4
IDATA SIZE = ---- ----
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 + -