|
|
<div align=center><b>配置6117D板卡MI/O芯片M5113,<BR> 實(shí)現(xiàn)230400/460800bps波特率高速數(shù)據(jù)傳送</b></div></P><P> M6117系列板卡上使用的多路I/O芯片是ALi M5113。它支持快速通用異步收發(fā),最高波特率可達(dá)460800 bps。下面是實(shí)現(xiàn)這種功能的DOS C語(yǔ)言范例代碼:<BR> /* DM&P/ICOP M6117D 系列板卡上ALi M5113范例代碼。*/<BR> #<BR> include <conio.h><BR> void M5113_Write(unsigned char cIdx, unsigned char cData)<BR> {<BR> outportb(0x3f1, 0x51);<BR> outportb(0x3f1, 0x29);<BR> inportb(0x3f1);<BR> outportb(0x3f1, cIdx);<BR> outportb(0x3f1, cData);<BR> }<BR> unsigned char M5113_Read(unsigned char cIdx)<BR> {<BR> outportb(0x3f1, 0x51);<BR> outportb(0x3f1, 0x29);<BR> inportb(0x3f1);<BR> outportb(0x3f1, cIdx);<BR> return inportb(0x3f1);<BR> }<BR> void main()<BR> {<BR> unsigned char cTemp;<BR> /* 上面提到的ALi M5113寄存器數(shù)據(jù)的相關(guān)資料在<BR> <img align=absmiddle src=pic/url.gif border=0><a target=_blank href=http://www.dmp.com.tw/tech/dmp-hw/misc/m5113.pdf> http://www.dmp.com.tw/tech/dmp-hw/misc/m5113.pdf</a> CR8和CR9的16,17頁(yè)上。*/<BR> /* Enable UART1 hi-speed baud rate */<BR> cTemp = M5113_Read(0x88);<BR> /* 設(shè)置通用異步收發(fā)器1 達(dá)到最大波特率。*/<BR> cTemp |= 0x20; /* set CR8 bit5 to 1 */ /* 設(shè)置CR8 bit5到1 */<BR> M5113_Write(0x88, cTemp);<BR> /* 設(shè)置通用異步收發(fā)器2 達(dá)到最大波特率 */<BR> cTemp = M5113_Read(0x99);<BR> cTemp |= 0x20; /* set CR9 bit5 to 1 */ /* 設(shè)置 CR9 bit5到1 */<BR> M5113_Write(0x99, cTemp);<BR> }<BR> /* 參考表格 5-5, 用戶在初始化UART的過(guò)程中:<BR> 使用32770 作為除法因子達(dá)到230400 的波特率。<BR> 使用30769 作為除法因子達(dá)到460800 的波特率。<BR> */<BR> 下載M5113 數(shù)據(jù)資料,請(qǐng)到<img align=absmiddle src=pic/url.gif border=0><a target=_blank href=http://www.dmp.com.tw/tech/dmp-hw/misc/m5113.pdf> http://www.dmp.com.tw/tech/dmp-hw/misc/m5113.pdf</a> 獲取更多詳細(xì)說(shuō)明。<BR> 技術(shù)支持<BR> 更多的技術(shù)支持,請(qǐng)瀏覽<img align=absmiddle src=pic/url.gif border=0><a target=_blank href=http://www.dmp.com.cn/tech> http://www.dmp.com.cn/tech</a><BR> 或者發(fā)郵件到tech@dmp.com.cn.
|
|
|