文件名称:iccavr_source
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:2.05kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
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
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
iccavr_source/修正版本.txt
iccavr_source
iccavr_source/修正版本.txt
iccavr_source
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.