在原来:实验26 RS485通信实验 ,基础上修改程序,目的:把rs485buf=0x1500 发送到串口
int main(void)
{
//u8 key;
u8 i=0;
//t=0;
//u8 cnt=0;
u16 rs485buf[100];
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
delay_init(168);
uart_init(115200);
LED_Init();
LCD_Init();
KEY_Init();
RS485_Init(9600);
while(1)
{
rs485buf=0x1500;
RS485_Send_Data(rs485buf,2);
GPIO_SetBits(GPIOF,GPIO_Pin_10 );
delay_ms(500);
GPIO_ResetBits(GPIOF,GPIO_Pin_10 );
delay_ms(500);
}
}
extern u16 RS485_RX_BUF[64];
extern u16 RS485_RX_CNT;
#define RS485_TX_EN PGout(8)
#define EN_USART2_RX 1
void RS485_Init(u32 bound);
void RS485_Send_Data(u16 *buf,u16 len);
void RS485_Receive_Data(u16 *buf,u16 *len);
#endif |