研究生
最后登录1970-1-1
在线时间 小时
注册时间2016-6-14
|
不知道为什么 电路没问题 这个初始化程序就是不显示 请大家看看什么问题 附件是程序
#include "stm32f10x.h"
//#include "B61509V.h"
//#include "shuzi.h"
unsigned int temp=0,Lowarm=100,an_cnt=0,t_cnt=0,cnt=0,cnt1=0,cnt2=0;
unsigned char intens=1,m_intens=0,f_intens=0,ff_intens=0,in=7,et=0x44,flag_1=0,zb_flag=0;
unsigned int shuzhi=0,f_shuzhi=0,ff_shuzhi=0,m_shuzhi=0;
unsigned int speakTime=0;//xujj
unsigned char lowArmFlag=0;//ÏÔê¾oˉêy±êÖ¾
void Delay(__IO u32 nCount);
#define White 0xFFFF
#define Black 0x0000
#define Blue 0x001F
#define Red 0xF800
#define Magenta 0xF81F
#define Green 0x07E0
#define Cyan 0x7FFF
#define Yellow 0xFFE0
extern unsigned ch16[];
extern unsigned Font8x16[];
extern unsigned Fon112x200[];
extern unsigned int a,a1,b,b1,c,c1,d;
void USART3_Config(void);
void GPIO_Config(void);
void init_usart(void);
void intensity(unsigned char tt);
void dl_display(unsigned char ee);
void LowArm_display(unsigned int aa);
void TFT_Initial(void);//3õê¼»ˉÇy¶ˉD¾Æ¬
void intdisplay(void);//3õê¼»ˉ½çÃæ
void Write_Cmd(unsigned int DA);//D′Ãüáî
void Write_Data(unsigned int DA);//D′êy¾Y
void Write_Cmd_Data (unsigned int x,unsigned int y);
void CLR_Screen(unsigned int bColor);
void delay(unsigned int t);
//D′×Ö·û
void LCD_PutChar(unsigned short x, unsigned short y, unsigned char c, unsigned int fColor, unsigned int bColor);
//D′êyÖμ
void LCD_PutString_shuzi(unsigned int s, unsigned int fColor, unsigned int bColor) ;
//D′oo×Ö
void Put_hanzi(unsigned short x, unsigned short y, unsigned char c, unsigned int fColor,unsigned int bColor);
//D′êyÖμ
void LCD_putshuzi(unsigned short x, unsigned short y, unsigned int d, unsigned int fColor, unsigned int bColor);
//·Ö¿éD′ÑÕé«
void Show_RGB (unsigned int x0,unsigned int x1,unsigned int y0,unsigned int y1,unsigned int Color);
//Ñ¡ÔñÇøóò×ø±ê
void LCD_SetPos(unsigned int x0,unsigned int x1,unsigned int y0,unsigned int y1);
void writeOneChar(unsigned short x, unsigned short y,const unsigned char temp[],unsigned int col, unsigned int fColor,unsigned int bColor);
void Put_hanzi(unsigned short x, unsigned short y, unsigned char c, unsigned int fColor,unsigned int bColor);
int main(void)
{
GPIO_Config();
USART3_Config();
init_usart();
TFT_Initial();
intdisplay();
while(1)
{
if(flag_1==1)
{
flag_1=0;
// LATB=1;
if(shuzhi>=Lowarm)
{
GPIO_SetBits(GPIOA,GPIO_Pin_1);
}
else
GPIO_ResetBits(GPIOA,GPIO_Pin_1);
LCD_PutString_shuzi(shuzhi,White,Black);
LowArm_display(Lowarm);
delay(200);
}
}
// LCD_PutString_shuzi(shuzhi,White,Black);
// LowArm_display(Lowarm);
// delay(200);
//
}
void GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB, ENABLE); /*¿aÆôGPIOBoíGPIOFμÄíaéèê±Öó*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All; /*Ñ¡Ôñòa¿ØÖÆμÄGPIOBòy½Å*/
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; /*éèÖÃòy½ÅÄ£ê½Îaí¨óÃíÆíìêä3ö*/
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; /*éèÖÃòy½ÅËùÂêÎa50MHz */
GPIO_Init(GPIOB, &GPIO_InitStructure); /*μ÷óÿaoˉêy£¬3õê¼»ˉGPIOB0*/
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOC, ENABLE); /*¿aÆôGPIOBoíGPIOFμÄíaéèê±Öó*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;/*Ñ¡Ôñòa¿ØÖÆμÄGPIOFòy½Å*/
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; /*éèÖÃòy½ÅÄ£ê½Îaí¨óÃíÆíìêä3ö*/
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; /*éèÖÃòy½ÅËùÂêÎa50MHz */
GPIO_Init(GPIOC, &GPIO_InitStructure);/*μ÷óÿaoˉêy£¬3õê¼»ˉGPIOF7*/
GPIO_SetBits(GPIOB, GPIO_Pin_8);
GPIO_ResetBits(GPIOB,GPIO_Pin_7);
}
void init_usart(void)
{
SystemInit();
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_AFIO|RCC_APB2Periph_GPIOB|RCC_APB2Periph_USART1|RCC_APB2Periph_GPIOC,ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2|RCC_APB1Periph_USART3,ENABLE);
}
//void Delay(__IO uint32_t nCount) //¼òμ¥μÄÑóê±oˉêy
//{
// for(; nCount != 0; nCount--);
//}
void USART3_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
/* config USART1 clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
/* USART3 GPIO config */
/* Configure USART1 Tx (PB.10) as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Configure USART3 Rx (PB.11) as input floating */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure);
//
/* USART1 mode config */
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No ;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Tx|USART_Mode_Rx;
USART_Init(USART3, &USART_InitStructure);
USART_ITConfig(USART3, USART_IT_TXE, ENABLE);
USART_Cmd(USART3, ENABLE);
}
|
|