要点:波特率同步
PA9接51P30
PA10接51P31
共连GND
51由于32提供的电压不足,另需独立供电
//32程序
#include "led.h"
#include "delay.h"
#include "key.h"
#include "sys.h"
#include "usart.h"
#include "beep.h"
int main(void)
{
u8 key;
delay_init();
uart_init(9600);
KEY_Init();
led();
// beep();
while(1)
{
GPIO_SetBits(GPIOB,GPIO_Pin_5);//测试按键用
delay_ms(100);
GPIO_ResetBits(GPIOB,GPIO_Pin_5);
delay_ms(100); //按下会使得指示灯频率改变
key=KEY_Scan(0);
if(key)
{ //已测试按键正常可使用
switch(key)
{
case KEY0_PRES:USART_SendData(