找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3041|回復: 0
打印 上一主題 下一主題
收起左側

求大佬幫我看看程序哪里出錯了,用STM32F103R6做的仿真實現(xiàn)不了程序,程序編譯沒錯

[復制鏈接]
跳轉到指定樓層
樓主
ID:306028 發(fā)表于 2018-12-26 20:18 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
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, 下載次數(shù): 63)

主程序

主程序

LCD1602顯示.rar

264.09 KB, 下載次數(shù): 11

程序

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復 返回頂部 返回列表