新手上路 
 
	- 积分
 - 26
 
        - 金钱
 - 26 
 
       - 注册时间
 - 2017-8-25
 
      - 在线时间
 - 1 小时
 
 
 
 | 
 
 
 楼主 |
发表于 2017-9-12 17:09:23
|
显示全部楼层
 
 
 
好像系统根本没有进入主函数运行。 
附上代码: 
#include "sys.h" 
#include "delay.h" 
#include "usart.h" 
#include "led.h" 
int main(void) 
{  
  
        delay_init(168);                  //3õê¼»ˉÑóê±oˉêy 
        LED_Init();                        //3õê¼»ˉLED¶Ë¿ú 
         
 
  while(1) 
        { 
    
        LED0=0;                           
         LED1=0;                                 
                 
        delay_ms(500); 
         
        LED0=1;                                 
                 LED1=1;                                 
                         
                 
        delay_ms(500); 
         } 
} 
 
led.c 
 
#include "led.h"  
 
void LED_Init(void) 
{              
  GPIO_InitTypeDef  GPIO_InitStructure; 
 
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE); 
         
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1; 
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; 
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; 
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; 
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; 
  GPIO_Init(GPIOG, &GPIO_InitStructure); 
         
        GPIO_ResetBits(GPIOG,GPIO_Pin_0 | GPIO_Pin_1); 
         
} 
 
 
led.h: 
 
#ifndef __LED_H 
#define __LED_H 
#include "sys.h" 
 
 
#define LED0 PGout(0)        // DS0 
#define LED1 PGout(1)        // DS1          
 
 
void LED_Init(void);                                      
#endif 
 |   
 
 
 
 |