AD7705模块设计(附源码)

本文详细介绍了基于AD7705的模块设计过程,结合STM32单片机进行操作。内容涵盖模块的原理图设计,以及在STM32上的源码实现,为单片机应用提供了实用的参考资料。
摘要由CSDN通过智能技术生成

原理图
在这里插入图片描述

      void SPIx_Init(void)
     {
   
		 SPI_InitTypeDef  SPI_InitStructure; 
		 GPIO_InitTypeDef GPIO_InitStructure;
		 
         RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_SPI1 | RCC_APB2Periph_AFIO, ENABLE );
		 
         GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;// AdDrdy 
         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //PA8配置成上拉输入
         GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
		 GPIO_Init(GPIOA, &GPIO_InitStructure); 
		 GPIO_SetBits(GPIOA,GPIO_Pin_8);
		 
		 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;//SPI CS DAC8554  AD7705 
		 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//推挽输出 
		 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
         GPIO_Init(GPIOA, &GPIO_InitStructure);
		 GPIO_SetBits(GPIOA,GPIO_Pin_4);

         GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;
         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;   //复用推挽输出
         GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 
		 GPIO_Init(GPIOA, &GPIO_InitStructure); 

         SPI_Cmd(SPI1, DISABLE); //使能SPI外设
		 SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;//SPI设置为双线双向全双工
		 SPI_InitStructure.SPI_Mode = SPI_Mode_Master; //设置为主SPI
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

炼金怪z

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值