?? bbs_content.jsp2.htm
字號:
<html><head>
<link rel="STYLESHEET" href="bbs_content.jsp2_files/bbs.css" type="text/css"><title>關于cs5532的初始化問題 ---AVR (原ourAVR.com) 技術論壇</title></head><body bgproperties="fixed" leftmargin="15" topmargin="0" bgcolor="#ffffff" marginheight="0" marginwidth="15" text="#000000"><br>
<script type="text/javascript">
function loadfunction(function_1)
{
var url = function_1.options[function_1.selectedIndex].value;
if (url != "")
{
if(function_1.options[function_1.selectedIndex].className=="class_1")
{
eval(function_1.options[function_1.selectedIndex].value);
}
else if(function_1.options[function_1.selectedIndex].className=="class_2")
{
window.open(url, "");
}
else
{
window.open(url, "class_3");
}
function_1.selectedIndex=0
}
return false;
}
</script>
<table bgcolor="#eeeeee" border="0" cellpadding="0" cellspacing="1" height="20" width="100%">
<tbody><tr>
<td width="26%">
<span class="f01">
<img src="bbs_content.jsp2_files/pixel.gif" height="1" width="14">歡迎您,ilan2003
<img src="bbs_content.jsp2_files/pixel.gif" height="1" width="7"><span class="f03"><font color="#444444">|登錄</font></span>
<img src="bbs_content.jsp2_files/pixel.gif" height="1" width="2"><span class="f03"><font color="#444444">|快速注冊</font></span>
<img src="bbs_content.jsp2_files/pixel.gif" height="1" width="2"><a href="http://www.ouravr.com/bbs/logout.jsp?mother_form=bbs_content.jsp&bbs_sn=762826&bbs_id=1000&bbs_page_no=1" title="退出登錄,并回到首頁" class="tt4">|退出</a>
</span>
</td>
<td align="right" width="74%">
<img src="bbs_content.jsp2_files/pixel.gif" height="1" width="5"><a href="http://www.ouravr.com/index.html" title="回到本站首頁" class="tt4">首頁</a>
<img src="bbs_content.jsp2_files/pixel.gif" height="1" width="5"><a href="http://www.ouravr.com/bbs/search_interface.jsp?mother_form=bbs_content.jsp&bbs_sn=762826&bbs_id=1000&bbs_page_no=1" target="_blank" title="搜索" class="tt4">搜索</a>
<img src="bbs_content.jsp2_files/pixel.gif" height="1" width="5"><a href="http://www.ouravr.com/bbs/online_members_list.jsp" title="當前在線會員" target="_blank" class="tt4">在線</a>
<img src="bbs_content.jsp2_files/pixel.gif" height="1" width="2">
<select name="list1" onchange="javascript:loadfunction(this)">
<option>個人功能</option>
<option>--------------</option>
<option target="_blank" value="user_data.jsp">修改個人資料</option>
<option target="_blank" value="bbs_list.jsp?search_text=ilan2003&search_mode=3&bbs_id=9999">我的主題</option>
<option target="_blank" value="bbs_list.jsp?search_text=ilan2003&search_mode=4&bbs_id=9999">我的回復</option>
</select> <img src="bbs_content.jsp2_files/pixel.gif" height="1" width="2">
<img src="bbs_content.jsp2_files/pixel.gif" height="1" width="5"><a href="http://www.mailshop.cn/" title="阿莫電子郵購服務部" target="_blank" class="tt11">本網站由阿莫電子郵購獨家贊助</a>
</td>
</tr>
</tbody></table>
<table bgcolor="#ffffff" border="0" cellpadding="6" cellspacing="0" height="60" width="100%">
<tbody><tr>
<td align="left" valign="top">
<span class="tt1">
AVR (原ourAVR.com) 技術論壇 -> <a href="javascript:history.go(-1)" class="tt4">搜索主題:CS5532</a> -> 關于cs5532的初始化問題
</span>
</td>
<td align="center" valign="top">
<span class="tt1">跳轉至:</span>
<select name="forumid" onchange="window.location=('bbs_list.jsp?bbs_id='+this.options[this.selectedIndex].value)">
<option value="9999">╟—ourDEV.cn 虛擬總論壇(可查看所有分論壇帖子)</option><option value="2060">╟┬電子綜合</option><option selected="selected" value="1000">║├AVR (原ourAVR.com) 技術論壇</option><option value="1032">║├AT-ARM技術論壇</option><option value="1006">║├51單片機</option><option value="1028">║├PIC單片機</option><option value="1002">║├DSP</option><option value="1029">║├CPLD/FPGA</option><option value="2070">║├其它單片機與PLC</option><option value="1009">║├PCB(Protel等軟件討論)</option><option value="1024">║└機器人論壇</option><option value="1003">╟—馬潮老師專欄(AVR)</option><option value="1004">╟┬電腦綜合論壇</option><option value="1036">║└共享小軟件</option><option value="1020">╟┬悠閑休息區 (灌水壇)</option><option value="1012">║├網站建設與建議</option><option value="0020">║└招標/招聘/自薦(項目招標、找工作、招人)</option><option value="1011">╙┬二手交易置換論壇</option><option value="2040"> ├廣告、求購區</option><option value="2034"> └其它(非技術、非悠閑)</option>
</select>
</td>
<td align="right" valign="top">
</td>
</tr>
</tbody></table>
<table border="0" cellpadding="6" cellspacing="0" height="30" width="100%">
<tbody><tr bgcolor="#5d7790">
<td align="left" width="81%">
<span class="f06"><font color="#ffffff">貼子主題:關于cs5532的初始化問題</font></span>
</td>
<td align="center" width="19%">
<span class="f06"><font color="#ffffff">回復數:</font><font color="#ffffff">1</font>
(其中0條已刪除)
</span>
</td>
</tr>
</tbody></table>
<table bgcolor="#e8e8e8" border="0" cellpadding="0" cellspacing="0" height="30" width="100%">
<tbody><tr>
<td>
<img src="bbs_content.jsp2_files/pixel.gif" height="2" width="20">
<span class="f06"><font color="#444444">相關鏈接:</font>
<font color="#444444">本貼沒有相關鏈接</font></span>
</td>
</tr>
</tbody></table>
<table style="table-layout: fixed;" border="0" cellpadding="6" cellspacing="0" width="100%">
<tbody><tr>
<td class="f03" rowspan="2" style="border-style: solid; border-color: rgb(255, 255, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(187, 187, 187); border-width: 0.5pt;" align="left" bgcolor="#d1d9e2" valign="top" width="19%">
【樓主位】 <font color="#000000">dongdaxing </font><br>
積分:<font color="#000000">17</font><br>
派別:<font color="#000000"></font><br>
等級:<font color="#000000">------</font><br>
來自:<font color="#000000"></font><br>
</td>
<td class="f03" style="border-style: solid solid none none; border-color: rgb(255, 255, 255) rgb(187, 187, 187) -moz-use-text-color -moz-use-text-color; border-width: 0.5pt 0.5pt medium medium;" bgcolor="#d1d9e2" valign="top" width="81%">
<font color="#000000">在前面的一個帖子里面看到有位大蝦關于cs5532的一段程序 其中有段不是很明白請大家指點。
<br>程序如下:
<br>const unsigned char ADInitData[35]=
<br> {0x41,
<br> 0xfe,0x00,0x00,0x00, //通道0
<br> 0xfe,0x00,0x00,0x00, //通道1
<br> 0xfe,0x00,0x00,0x00, //通道2
<br> 0xfe,0x00,0x00,0x00, //通道3
<br> 0x45,
//設置所有通道設置寄存器
<br> 0x31,0xc0,0x31,0xc0,
//0x31:12.5Hz,通道1(1、2腳)
<br> 0x31,0xc0,0x31,0xc0,
//0x71,通道2(19、20腳)
<br> 0x31,0xc0,0x31,0xc0,
<br> 0x31,0xc0,0x31,0xc0,
<br> 0xc0}; //執行多路連續轉換
<br>const unsigned char ADResetData[6]=
<br> {0xfe,0x03,0x20,0x00,0x00,0x00}; //配置寄存器RS位置1,AD復位
<br>//cs5532操作IO延時
<br>void AD_delay(void)
<br>{
<br>}
<br>//cs5532寫寄存器
<br>void AD_write(unsigned char byte)
<br>{
<br> unsigned char i,data;
<br> data=byte;
<br> for(i=0;i<8;i++)
<br> {
<br> if((data&0x80)==0x80) PORTB|=(1<<AD_SDI);
<br> else PORTB&=~(1<<AD_SDI);
<br> AD_delay();
<br> PORTD|=(1<<AD_SCLK);//sclk=1
<br> AD_delay();
<br> PORTD&=~(1<<AD_SCLK);//sclk=0
<br> AD_delay();
<br> data<<=1;
<br> }
<br>}
<br>//cs5532讀寄存器
<br>unsigned char AD_read(void)
<br>{
<br> unsigned char i,data=0;
<br> PORTD&=~(1<<AD_SCLK);//sclk=0
<br> AD_delay();
<br> for(i=0;i<8;i++)
<br> {
<br> data<<=1;
<br> if(((PIND>>AD_SDO)&0x01)==0x01) data|=0x01;
<br> AD_delay();
<br> PORTD|=(1<<AD_SCLK);//sclk=1
<br> AD_delay();
<br> PORTD&=~(1<<AD_SCLK);//sclk=0
<br> AD_delay();
<br> }
<br> return(data);
<br>}
<br>//初始化cs5532
<br>void Init5532(void)
<br>{
<br> unsigned char i,data=0;
<br> for(i=0;i<15;i++)
AD_write(0xff);
//初始化序列
<br> for(i=0;i<6;i++)
AD_write(ADResetData[i]); //復位
cs5532
<br> while(data!=0x10) //等待AD復位
<br> {
<br>
AD_write(0x0b); //讀配置寄存器
<br> data=AD_read();
<br> AD_read();
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -