max532 driver

Publisher:SparklingBeautyLatest update time:2016-10-28 Source: eefocusKeywords:max532  driver Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
/* DA MAX532 debug */

//Note: Vref and Vout should be connected together when debugging
#include "reg51.h"

sbit MAX532_CS=P1^0;
sbit MAX532_DIN=P1^1;
sbit MAX532_SCLK=P1^2;

void MAX532_OUT(unsigned char daout1,unsigned char daout2,unsigned char daout3);
void delay()
{
 unsigned int i,j;
 for(i=0;i<1000;i++)
  for(j=100;j>0;j--)
  ;
}

void main(void)

 while(1)
 {
  MAX532_OUT(0x80,0x08,0x00); // 1/2 Vref
  MAX532_OUT(0x80,0x08,0x00); // 1/2 Vref
  MAX532_OUT(0x80,0x08,0x00); // 1/2 Vref

 }
}
// In order to ensure the DA output speed, the method of sending data directly is adopted
void MAX532_OUT(unsigned char daout1,unsigned char daout2,unsigned char daout3)
{
 //MAX532_CS=1;
 //MAX532_DIN
 =1 ; //
 
 MAX532_SCLK=1; MAX532_CS
 
 =0; MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout1&0x80);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout1&0x40);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout1&0x20);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout1&0x10);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout1&0x08);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout1&0x04);
 MAX532_SCLK=1 ;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout1&0x02);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout1&0x01);
 MAX532_SCLK=1;
 
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout2&0x80) ;
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout2&0x40);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout2&0x20);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout2&0x10);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout2&0x08);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout2&0x04);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout2&0x02);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout2&0x01);
 MAX532_SCLK=1;
 
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout3&0x80);
 MAX532_SCLK=1 ;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout3&0x40);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout3&0x20);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout3&0x10) ;
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout3&0x08);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout3&0x04);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit )(daout3&0x02);
 MAX532_SCLK=1;
 MAX532_SCLK=0;
 MAX532_DIN=(bit)(daout3&0x01);
 MAX532_SCLK=1;
 
 MAX532_CS=1;
}

Keywords:max532  driver Reference address:max532 driver

Previous article:DS12887 (clock calendar chip) C language driver
Next article:X25045 Driver

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号