/* 这个值需要修正 根据实际 */
#define GapValue 0.38755
#define HX711DT GPIO_ReadInputDataBit( GPIOA, GPIO_Pin_7 )
#define HX711SCK PAout( 6 )
unsigned long Weight_Maopi;
unsigned long HX711_Buffer;
unsigned long Weight_Shiwu;
u8 Flag_Error = 0;
void InitioHX711( void )
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA, ENABLE ); /* 使能PB,PE端口时钟 */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; /* 推挽输出 */
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; /* IO口速度为50MHz */
/* hx711 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; /* 设置成上拉输入 */
GPIO_Init( GPIOA, &GPIO_InitStructure ); /* 初始化GPIOE7 */
/* HX711 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; /* LED1-->PE.6 端口配置, 推挽输出 */
GPIO_Init( GPIOA, &GPIO_InitStructure ); /* 推挽输出 ,IO口速度为50MHz */
GPIO_ResetBits( GPIOA, GPIO_Pin_6 ); /* PE.2 输出低 */
}
|