?? [原創(chuàng)]cs5532程序.htm
字號(hào):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0039)http://pdf.18ic.com/post_14_2509_1.html -->
<HTML><HEAD><TITLE>[原創(chuàng)]CS5532程序</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META http-equiv=Pragma content=no-cache>
<META http-equiv=expires content="">
<META content=[原創(chuàng)]CS5532程序 name=keywords><LINK
href="[原創(chuàng)]CS5532程序.files/style.css" type=text/css rel=stylesheet>
<SCRIPT src="[原創(chuàng)]CS5532程序.files/bbsgood.js"></SCRIPT>
<SCRIPT src="[原創(chuàng)]CS5532程序.files/qqubb.js"></SCRIPT>
<META content="MSHTML 6.00.2900.3199" name=GENERATOR></HEAD>
<BODY topMargin=0>
<TABLE class=k98AAB1 cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width=159 height=84></TD>
<TD width=640>站長推廣國產(chǎn)器件和非日產(chǎn)器件歷時(shí)6年多,請大家多支持,歡迎在這里探討技術(shù),如需求器件,技術(shù)咨詢,請聯(lián)系我們: 電話:
025-8481 0381 站長同時(shí)是21ic論壇器件替換/工控論壇斑竹
21ic南京分會(huì)長;EDNCHINA嵌入式系統(tǒng)斑竹;cnni民族產(chǎn)業(yè)網(wǎng)(反日貨聯(lián)盟)江蘇分會(huì)長,
如可能請大家盡可能宣傳http://www.18ic.com 歡迎在站點(diǎn),博客,論壇簽名加上本站鏈接,謝謝!</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TBODY>
<TR>
<TD class=menu_td align=right height=30>
<SCRIPT src="[原創(chuàng)]CS5532程序.files/indexlogin.htm"></SCRIPT>
</TD></TR>
<TR>
<TD height=3></TD></TR></TBODY></TABLE>
<TABLE class=table0 style="BORDER-COLLAPSE: collapse" width="100%" align=center
border=1>
<TBODY>
<TR>
<TD height=27> <A
href="http://pdf.18ic.com/index.asp">論壇首頁</A> → <A
href="http://pdf.18ic.com/index_12.html">嵌入式系統(tǒng)討論區(qū)</A> → <A
href="http://pdf.18ic.com/list_14_1.html">單片機(jī)</A> → [原創(chuàng)]CS5532程序</TD></TR></TBODY></TABLE>
<TABLE width="100%" align=center>
<TBODY>
<TR>
<TD><A href="http://pdf.18ic.com/Post.asp?BoardID=14"><FONT
color=#ff0000>點(diǎn)這里發(fā)新帖</FONT></A> <A
href="http://pdf.18ic.com/RePost.asp?RePost=RePost&PostID=2509&BoardID=14">
回復(fù)話題</A></TD>
<TD align=right><INPUT id=button1 title=點(diǎn)擊復(fù)制標(biāo)題和地址到剪貼版,直接在MSN/QQ上粘貼即可. style="FONT-SIZE: 10pt; WIDTH: 190px" onclick=CText() type=button value=復(fù)制地址在MSN/QQ上發(fā)給好友 name=button1></TD></TR></TBODY></TABLE>
<TABLE class=table1 style="BORDER-COLLAPSE: collapse" cellSpacing=0
cellPadding=0 width="100%" align=center border=1>
<TBODY>
<TR>
<TD class=td1_title3
height=25> 標(biāo)題:<B>[原創(chuàng)]CS5532程序</B></TD></TR></TBODY></TABLE>
<TABLE class=table1
style="TABLE-LAYOUT: fixed; WORD-BREAK: break-all; BORDER-COLLAPSE: collapse; WORD-WRAP: break-word"
cellSpacing=0 cellPadding=0 width="100%" align=center border=1>
<TBODY>
<TR>
<TD class=table1 vAlign=top width="20%">
<TABLE width="100%">
<TBODY>
<TR>
<TD> <B><A
href="http://pdf.18ic.com/UserInfo.asp?UserName=txyuseing">txyuseing</A></B></TD></TR>
<SCRIPT language=javascript type=text/javascript>
imgObj = new Image();
imgObj.src = "Images/userface/image1.gif";
if (imgObj.width>150){
document.write("<tr><td align=center><a href=/UserInfo.asp?UserName=txyuseing><img src=Images/userface/image1.gif border=0 width=150></a></td></tr>")
}
else
{
document.write("<tr><td align=center><a href=/UserInfo.asp?UserName=txyuseing><img src=Images/userface/image1.gif border=0></a></td></tr>")
}
</SCRIPT>
<TR>
<TD> 權(quán)限:普通用戶</TD></TR>
<TR>
<TD> 積分:478</TD></TR>
<TR>
<TD> 發(fā)帖數(shù):19</TD></TR>
<TR>
<TD>時(shí)間:2006-8-27 14:25:20</TD></TR></TBODY></TABLE></TD>
<TD class=td1 vAlign=top height="100%">
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD height="100%">
<TABLE
style="TABLE-LAYOUT: fixed; WORD-BREAK: break-all; WORD-WRAP: break-word"
height="100%" width="99%" align=center border=0>
<TBODY>
<TR>
<TD vAlign=top>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD class=td2_nl vAlign=top>
<P>CS5532_TEST</P>
<P>//////////////////////////////////////////////////////////<BR>////////////////
CS5532
////////////////////////<BR>//////////////////////////////////////////////////////////</P>
<P>//#include "AT89X51.H"<BR>#include
"reg51.h" //changed by <A
href="mailto:taoxy@20060110">taoxy@20060110</A><BR>#include
"stdio.h"<BR>#include "intrins.h"<BR>#include
"stdlib.h"<BR>#include "absacc.h"</P>
<P><BR>#define uchar unsigned char</P>
<P>// Original design board<BR>sbit
CS5532_CS=P1^2;<BR>sbit CS5532_SDI=P1^3;<BR>sbit
CS5532_SCLK=P1^5;<BR>sbit CS5532_SDO=P2^4;</P>
<P><BR>// PCB Version<BR>//sbit
CS5532_CS=P1^3;<BR>//sbit CS5532_SDI=P1^2;<BR>//sbit
CS5532_SDO=P1^1;<BR>//sbit CS5532_SCLK=P1^0;</P>
<P><BR>// all design board ?<BR>sbit
CS5532_A0=P1^6;<BR>sbit CS5532_A1=P1^7;</P>
<P><BR>#define RxdTxd4b_0
DBYTE[0x20]<BR>#define RxdTxd4b_1
DBYTE[0x21]<BR>#define RxdTxd4b_2
DBYTE[0x22]<BR>#define RxdTxd4b_3
DBYTE[0x23]</P>
<P><BR>uchar idata RxdTxd4b[4];</P>
<P>void CS5532_Txd(uchar);<BR>void
CS5532_Txd_init(uchar);<BR>void read_reg(uchar
address_pt);<BR>void read_data(uchar
address_pt);<BR>void read_data1(uchar
address_pt);<BR>void
CS5532_init(void);<BR> <BR>void
main(void)<BR>{<BR> <BR> uchar
i,k,address_pt;<BR> uchar
flag=0;<BR> address_pt =
32; // RAM
數(shù)據(jù)區(qū)起始地址<BR> CS5532_init();</P>
<P> for(k=0;k<20;k++) _nop_();</P>
<P>//************************************************<BR>//
系統(tǒng)軟復(fù)位( CS5532_init() 包含該部分)<BR>
<BR> CS5532_Txd(0x03); //
Soft Reset <BR>
CS5532_Txd(0x2A);<BR>
CS5532_Txd(0x00);<BR>
CS5532_Txd(0x04);<BR> CS5532_Txd(0x00);</P>
<P> CS5532_Txd(0x0B); //
Read Config Reg<BR>
DBYTE[address_pt++]=0x0B;<BR>
read_reg(address_pt);<BR> address_pt =
address_pt +4;<BR>
CS5532_Txd(0x0B); // Read Config
Reg<BR>
DBYTE[address_pt++]=0x0B;<BR>
read_reg(address_pt);<BR> address_pt =
address_pt
+4;<BR>//////////////////////////////////////////////</P>
<P> CS5532_Txd(0x05); //
Setup REG <BR>
CS5532_Txd(0x32);<BR>
CS5532_Txd(0x34);<BR>
CS5532_Txd(0x00);<BR>
CS5532_Txd(0x00);<BR> <BR>
CS5532_Txd(0x03); // Config ReG
<BR> CS5532_Txd(0x40);<BR>
CS5532_Txd(0x00);<BR>
CS5532_Txd(0x00);<BR> CS5532_Txd(0x00);</P>
<P> CS5532_Txd(0x03); //
Config ReG <BR>
CS5532_Txd(0xC0);<BR>
CS5532_Txd(0x00);<BR>
CS5532_Txd(0x00);<BR> CS5532_Txd(0x00);</P>
<P> CS5532_Txd(0x03); //
Config ReG <BR>
CS5532_Txd(0x01);<BR>
CS5532_Txd(0x80);<BR>
CS5532_Txd(0x00);<BR> CS5532_Txd(0x00);</P>
<P> CS5532_Txd(0x0B); //
Read Config Reg<BR>
DBYTE[address_pt++]=0x0B;<BR>
read_reg(address_pt);<BR> address_pt =
address_pt +4;</P>
<P> CS5532_Txd(0x0D); //
Read Setup Reg<BR>
DBYTE[address_pt++]=0x0D;<BR>
read_reg(address_pt);<BR> address_pt =
address_pt +4;<BR> </P>
<P> _nop_(); _nop_(); _nop_(); _nop_();</P>
<P> address_pt = 52; <BR>
CS5532_CS=1;
// 未校準(zhǔn)前轉(zhuǎn)換<BR> CS5532_Txd(0x80);<BR>
while(CS5532_SDO)<BR> _nop_(); _nop_();
_nop_(); _nop_();<BR>
DBYTE[address_pt++]=0x80;<BR>
read_data(address_pt);<BR> address_pt = address_pt
+4;<BR> _nop_(); _nop_(); _nop_();
_nop_();</P>
<P>/*<BR> CS5532_Txd(0x81); //
自偏移校準(zhǔn)<BR> while(CS5532_SDO)<BR>
_nop_(); _nop_(); _nop_(); _nop_();<BR>*/</P>
<P>/*<BR> CS5532_Txd(0x82);
// 自增益校準(zhǔn)<BR> while(CS5532_SDO)<BR>
_nop_(); _nop_(); _nop_(); _nop_();<BR>*/</P>
<P><BR> CS5532_Txd(0x85); //
偏移校準(zhǔn)<BR> while(CS5532_SDO)<BR>
_nop_(); _nop_(); _nop_(); _nop_();</P>
<P><BR>/*<BR> CS5532_Txd(0x86);
// 增益校準(zhǔn)<BR> while(CS5532_SDO)<BR>
_nop_(); _nop_(); _nop_(); _nop_();<BR>*/</P>
<P>/*<BR>
// 測試寄存器寫回默認(rèn)值<BR>
CS5532_Txd(0x07); // REF TEST
<BR> CS5532_Txd(0x00);<BR>
CS5532_Txd(0x00);<BR>
CS5532_Txd(0x1A);<BR>
CS5532_Txd(0x00);<BR>*/</P>
<P>//單次轉(zhuǎn)換<BR>//////////////////////////////////////////////////</P>
<P>for(i=0;i<5;i++)<BR> {<BR>
CS5532_CS=1;<BR> _nop_(); _nop_(); _nop_();
_nop_();<BR> _nop_(); _nop_(); _nop_();
_nop_(); <BR> _nop_(); _nop_(); _nop_();
_nop_(); <BR>// address_pt = 48;<BR>
CS5532_Txd(0x80);<BR> while(CS5532_SDO)<BR>
_nop_(); _nop_(); _nop_(); _nop_();<BR>
DBYTE[address_pt++]=0x80;<BR>
read_data1(address_pt);<BR> address_pt =
address_pt +4;<BR> for(k=0;k<20;k++)
_nop_(); <BR> }</P>
<P> //
連續(xù)轉(zhuǎn)換<BR> //***************************************************
</P>
<P>
CS5532_Txd(0xC0);//連續(xù)轉(zhuǎn)換命令<BR>
while(CS5532_SDO)<BR>
_nop_(); _nop_(); _nop_(); _nop_(); </P>
<P> for(i=0;i<5;i++)<BR> {
<BR> for(k=0;k<20;k++)
_nop_();//delay1 <BR>// address_pt =
48;<BR>
while(CS5532_SDO)<BR>
_nop_(); _nop_(); _nop_(); _nop_();<BR>
DBYTE[address_pt++]=0xC0;<BR>
read_data1(address_pt);<BR>
address_pt = address_pt +4;<BR>
for(k=0;k<20;k++) _nop_();
//delay<BR> }</P>
<P> for(i=0;i<5;i++)<BR> {
<BR> for(k=0;k<20;k++)
_nop_();//delay1 <BR>// address_pt =
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -