这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界» 论坛首页» 综合技术» 基础知识» max3100,c51 那位兄台用过max3100 c51的驱动有吗,发我一个

共2条 1/1 1 跳转至

max3100,c51 那位兄台用过max3100 c51的驱动有吗,发我一个

院士
2006-09-17 18:14:16 打赏
max3100,c51 那位兄台用过max3100 c51的驱动有吗,发我一个



关键词: max3100 那位 兄台 用过 驱动 发我 一个

院士
2006-12-22 22:43:00 打赏
2楼
1: 贴一个#define uchar unsigned char
#define uint unsigned int
#define FOSC 11059200ul
#define BAUD 9600
#define SMODX 0
#define TH1_VAL (256 - (uchar)(FOSC * (1<#define TL1_VAL TH1_VAL

sbit DIN =P1^3;
sbit DOUT =P1^2;
sbit SCLK =P1^1;
sbit CS =P1^0;

void Delayus(uchar t)
{
for(; t>0; t--)
;
}

uchar Byte3100(uchar dat) reentrant
{
uchar i;

DOUT = 1;
DIN = 1;
for(i=0; i<8; i++)
{
if(dat & 0x80)
DIN = 1;
else
DIN = 0;
SCLK = 1;
dat <<= 1;
dat |= DOUT;
SCLK = 0;
}
return dat;
}

uchar Send3100(uchar tx1,uchar tx2) reentrant
{
CS = 0;
Byte3100(tx1);
tx1 = Byte3100(tx2);
CS = 1;
return tx1;
}

void Init3100(void)
{
uchar dat,i=0;
do
{
Send3100(0xc4,0x0a); //0b:4800,0a:9600
Delayus(200);
dat = Send3100(0x40,0x00);
}while((dat!= 0x01)&&(++i<5));
Send3100(0x84,0x00);
Delayus(200);
}

2: 可用模拟的,网上的一个短距离能跑到19200,11.0592M晶振 3: SC16IS752多好的东西!

共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册]