hushenghong 发表于 2008-6-23 11:16:30

10位数模转换器TLC5615程序

#include <ioavr.h>
#include <avr_macros.h>
#include <MCU_C_Macro_Data_Define.h>
#include "void_main.h"
// AVR驱动程序:
//接口定义
#defineDA_0 CLR_BIT(PORTF,PF5)
#defineDA_1 SET_BIT(PORTF,PF5)
#defineCK_0 CLR_BIT(PORTF,PF6)
#defineCK_1 SET_BIT(PORTF,PF6)
#defineCS_0 CLR_BIT(PORTF,PF7)
#defineCS_1 SET_BIT(PORTF,PF7)

//数据写入
void da5615(unsigned int da)
{
unsigned char i;
da <<= 6;//10有效数据左对齐
CS_0;
CK_0;
for (i=0;i<12;i++)
{
    if(da &0x8000)
    DA_1;
    else
    DA_0;
    CK_1;
    da <<= 1;
    CK_0;
}
   CS_1;
   CK_0;
}

hushenghong 发表于 2008-6-23 11:59:40

自己顶一下

rubin0513 发表于 2009-8-27 20:42:41

呵呵呵呵顶了啊

kaixinlaohe 发表于 2009-11-27 23:39:05

好好,简洁

pettit2009 发表于 2010-1-28 09:48:44

顶顶!

yunlong 发表于 2010-8-25 20:15:00

记号

yuyan 发表于 2010-9-9 18:08:30

看看…

yuan90826 发表于 2011-3-13 20:34:18

讲讲10位有效数据……为什么要左移六位

elunlang2000 发表于 2011-10-19 09:37:11

回复【7楼】yuan90826
-----------------------------------------------------------------------

If the daisy chain (cascading) function (see daisy-chaining devices section) is not used, a 12-bit input data
sequence with the MSB first can be used
高位优先

maozi4779 发表于 2011-12-12 19:33:19

liycobl 发表于 2011-12-12 19:43:53

mark

vala 发表于 2012-7-26 21:20:37

谢谢你的点拨,我这个程序搞了一天了,哎,相见恨晚!

mxfly 发表于 2012-12-8 16:50:50

学习中,

sweet_136 发表于 2015-3-15 20:09:45

标记,51上面已经用了.效果很好
页: [1]
查看完整版本: 10位数模转换器TLC5615程序