初级会员

- 积分
- 82
- 金钱
- 82
- 注册时间
- 2016-6-20
- 在线时间
- 30 小时
|
1金钱
#include <stm32f10x_lib.h>
#include "delay.h"
#include "1602.h"
void iocsh (void)
{
RCC->APB2ENR|=3<<2; //使能A、B端口时钟
GPIOA->CRL&=0X00000000; //A7~9管脚输出,定义了RS、RW、EN
GPIOA->CRL|=0X333FFFFF;
GPIOB->CRL&=0X00000000; //B0~7数据输出
GPIOB->CRL|=0X33333333;
}
//u8 busy ()
//{
// u8 result;
// RS=0;RW=1;EN=0;
// delay_ms (1);
// EN=1;
// result =(GPIOB->IDR>>3)&0X80;
// EN=0;
// return result;
//}
void xml (u8 cmd)
{
// while (busy());
EN=0;
RS=0;
RW=0;
GPIOB->ODR=((GPIOB->ODR&0xff00)|cmd);
EN=1;
delay_ms (5);
EN=0;
}
void xsj (u8 lcddata)
{
// while (busy());
EN=0;
RS=1;
RW=0;
GPIOB->ODR=((GPIOB->ODR&0xff00)|lcddata);
EN=1;
delay_ms (5);
EN=0;
}
void csh (void)
{
// while (busy());
xml (0X38);
delay_ms (5);
xml (0x0c);
delay_ms (5);
xml (0x06);
delay_ms (5);
xml (0x01);
delay_ms (5);
}
求大神帮忙解决问题。
|
|