iccavr_source
所属分类:处理器开发
开发工具:C/C++
文件大小:2KB
下载次数:3
上传日期:2011-06-14 00:24:46
上 传 者:
lingfeng
说明: M8 TLC2543
PB5-DATADIN
PB0-DATAOUT
PB1-#CS
PB2-CLOCK
//本程序没有使用tlc2543的EOC(转换结束标志)信号,片选一直处于选中,也可以自己加入片选信号
unsigned int tlc2543(unsigned char senddata)
{
unsigned int recdata = 0
unsigned int i = 0
senddata = 0B11010000 //控制字
recdata = 0 //接收到的转换结果数据
//PORTB &= 0B11111101 //片选使能(可选)
NOP()
NOP()
for(i=0 i<12 i++)
{
if(senddata & 0x80)
PORTB |= 0B00100000
else PORTB &= 0B11011111 //准备发送控制字
senddata <<= 1
if(PINB & 0x01)
recdata |= 0x0001
else recdata &= 0xfffe
recdata <<= 1 //接收上次转换结果
(M8 TLC2543 PB5-DATADIN PB0-DATAOUT PB1-# CS PB2-CLOCK// This program does not use tlc2543 the EOC (end of conversion flag) signal, chip select has been in a select, you can also add their own chip-select signal unsigned int tlc2543 (unsigned char senddata) {unsigned int recdata = 0 unsigned int i = 0 senddata = 0B11010000 // control word recdata = 0 // receive the results of the data conversion// PORTB & = 0B11111101 // Chip Enable ( optional) NOP () NOP () for (i = 0 i < 12 i++) {if (senddata & 0x80) PORTB | = 0B00100000 else PORTB & = 0B11011111 // ready to send control words senddata < < = 1 if (PINB & 0x01) recdata | = 0x0001 else recdata & = 0xfffe recdata < < = 1 // Receive the last conversion result)
文件列表:
iccavr_source\ICCAVR源程序.txt (3401, 2004-11-28)
iccavr_source\修正版本.txt (899, 2004-12-05)
iccavr_source (0, 2011-06-02)
近期下载者:
相关文件:
收藏者: