找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2052|回复: 0
打印 上一主题 下一主题
收起左侧

求大佬帮我看看程序哪里出错了,用STM32F103R6做的仿真实现不了程序,程序编译没错

[复制链接]
跳转到指定楼层
楼主
10黑币

void GPIO_Configuration()
{
        
        GPIO_InitTypeDef  GPIO_InitStructure;
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB , ENABLE);
        
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3
                                                             |GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7;        
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOB, &GPIO_InitStructure);

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11| GPIO_Pin_10 | GPIO_Pin_12;                                                        
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOA, &GPIO_InitStructure);
}
void delay_us(unsigned long n)  
{
  unsigned long j;
  while(n--)        
  {
    j=8;               
        while(j--);
  }
}

/*******************************************************************************
* Function Name  : delay_nms
* Description    : delay n ms
*******************************************************************************/
void delay_ms1(unsigned long n)  
{
  while(n--)               
    delay_us(1100);  
}


void Write_Command_LCM(u8 com)
{
   GPIO_ResetBits(GPIOA,GPIO_Pin_11);
   GPIO_ResetBits(GPIOA,GPIO_Pin_12);
   GPIO_Write(GPIOB, com);
   GPIO_ResetBits(GPIOA,GPIO_Pin_10);
   delay_ms1(5);
   GPIO_SetBits(GPIOA,GPIO_Pin_10);
   delay_ms1(5);
   GPIO_ResetBits(GPIOA,GPIO_Pin_10);
}


void Write_Data_LCM(u8 info)
{
   GPIO_ResetBits(GPIOA,GPIO_Pin_11);
   GPIO_ResetBits(GPIOA,GPIO_Pin_10);
   GPIO_Write(GPIOB, info);
   GPIO_SetBits(GPIOA,GPIO_Pin_12);
   delay_ms1(5);
   GPIO_SetBits(GPIOA,GPIO_Pin_10);
   delay_ms1(5);
   GPIO_ResetBits(GPIOA,GPIO_Pin_10);
}

/*---------------------------------------------
              oˉêyÃû£oLCM_Init()
              1|  Äü£o¶ÔLCD 16023õê¼»ˉ
----------------------------------------------*/
void LCM_Init(void)
{
    Write_Command_LCM(0x38);
        
    Write_Command_LCM(0x08);
        
        Write_Command_LCM(0x06);
        
    Write_Command_LCM(0x01);
        

    Write_Command_LCM(0x0C);
        
}


void Set_xy_LCM(unsigned char x, unsigned char y)
{
    unsigned char address;
    if( x == 0 )
               address = 0x80+y;
    if( x == 1 )
               address = 0xC0+y;
    Write_Command_LCM(address);
}

void Display1(unsigned int x, unsigned int y, unsigned char *s)
{
    Set_xy_LCM(x,y);
    while(*s)
     {
        Write_Data_LCM(*s);
        s++;
     }
}
int main(void)
{
        void GPIO_Configuration();
                Display1(0, 0, "www*szopen*cn");

                        
          while(1);
}


捕获.PNG (3.42 KB, 下载次数: 42)

主程序

主程序

LCD1602显示.rar

264.09 KB, 下载次数: 11

程序

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表