微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > MCU和单片机设计讨论 > 大家帮忙找下错

大家帮忙找下错

时间:10-02 整理:3721RD 点击:
#include <string.h>
#include <stdio.h>
#define         F_CPU        7372800                /* 单片机主频为7.3728MHz,用于延时子程序 */
#include <util/delay.h>
#include <avr/io.h>
#include <avr/iom128.h>
//***********************************************************************
//        定义变量区
//***********************************************************************
#define uchar unsigned char
#define uint  unsigned int
#define hang        PORTE
#define data        PORTE.0
#define yiwei       PORTE.1
#define reset       PORTE.2
#define shuchu      PORTE.3
#define dir        DDRE
#define delay_us(x)     _delay_us(x)        //AVR GCC延时函数 x(us)
#define delay_ms(x)     _delay_ms(x)        //AVR GCC延时函数 x(ms)
uchar shuzi[]={0x66,0x3f};
uchar table[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07};
void xianshi(uchar byte)
{
uint i;
for(i=0;i<8;i++)
{
  data=byte&1<<i;
  yiwei=0;
  yiwei=1;
}
shuchu=0;
shuchu=1;
}

void main()
{
uint j;
dir=0xff;
while(1)
{
   for(j=0;j<8;j++)
   {
     hang=table[j];
     xianshi(shuzi[0]);
         delay_us(1000);
    }
  }
}

把你的错误提示贴出来,没人给你猜谜语找问题

看看那错了

错误


把箭头指的那个  换成  data = (byte&1)<<1;试试

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top