[AVR单片机] 电脑绕线机程序代码

[复制链接]
 楼主| asiaschain 发表于 2013-1-13 12:29 | 显示全部楼层 |阅读模式
本帖最后由 asiaschain 于 2013-1-19 23:35 编辑



struct save
{
unsigned char code;
unsigned int  d;
unsigned int  n;
unsigned int  w;
}str[50];
struct save str[50]__attribute__((section(".eeprom")));
extern struct style style_buffer;
//********************************************************************
void save(void)
{eeprom_write_block(style_buffer,str[style_buffer.code],6);}
//*******************
我这里定义的全局变量style_buffer怎么提示错误
../sxj009.c:497: error: 'style_buffer' has an incomplete type
请大哥大姐指点一下GCC编译有12个错误这个定义不了,兄弟我想diy电脑绕线机这读写eeprom时编译不过,
要是解决了请邮件asiaschain@yahoo.com.cn

下面是全部源代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
 楼主| asiaschain 发表于 2013-2-12 14:10 | 显示全部楼层
本帖最后由 asiaschain 于 2013-2-12 14:14 编辑

不顶自己顶,这个程序这eeprom问题不解决就没啥意义:L.
Build started 12.2.2013 at 14:05:52
avr-gcc  -mmcu=atmega16 -Wall -gdwarf-2 -std=gnu99       -DF_CPU=800000UL -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT type.o -MF dep/type.o.d  -c  ../type.c
In file included from ../type.c:2:
c:/winavr-20100110/lib/gcc/../../avr/include/util/delay.h:90:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed"
../type.c: In function 'save':
../type.c:19: warning: value computed is not used
../type.c:21: error: incompatible type for argument 2 of '__eewr_block_m16'
make: *** [type.o] Error 1
Build failed with 1 errors and 2 warnings...
 楼主| asiaschain 发表于 2013-2-12 14:11 | 显示全部楼层
新年快乐!
 楼主| asiaschain 发表于 2013-2-12 20:13 | 显示全部楼层
Build started 12.2.2013 at 20:08:01
avr-gcc -mmcu=atmega16 -Wl,-Map=ssss.map type.o pwm.o key.o main.o lcd.o     -o ssss.elf
main.o:(.eeprom+0x0): multiple definition of `save'
type.o:F:\avr\ssss\default/../type.c:19: first defined here
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/bin/ld.exe: Warning: size of symbol `save' changed from 36 in type.o to 300 in main.o
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/bin/ld.exe: Warning: type of symbol `save' changed from 2 to 1 in main.o
make: *** [ssss.elf] Error 1
Build failed with 2 errors and 0 warnings...
john_lee 发表于 2013-2-12 20:42 | 显示全部楼层
save被多次定义。

评论

希望多多支持  发表于 2013-2-13 17:38
 楼主| asiaschain 发表于 2013-2-12 22:41 | 显示全部楼层
大师啊大师,正是这个问题,现在可以生成hex文件,可是那pc输出lcd是不是不行啊,
我用其他程序试了,pc段做12864的数据口不显示,用pb口就可以显示,是我设置有问题还是,atmega16的pc口不能用作lcd数据口呢
 楼主| asiaschain 发表于 2013-2-12 22:44 | 显示全部楼层
本帖最后由 asiaschain 于 2013-2-13 17:35 编辑

:):):);P呵呵呵
john_lee 发表于 2013-2-13 21:53 | 显示全部楼层
贴出完整的编译出错信息和相关的程序行
Swallow_0322 发表于 2013-2-15 15:12 | 显示全部楼层
Lee老师新年好!使能了JTAG?
 楼主| asiaschain 发表于 2013-2-27 15:37 | 显示全部楼层
这个是个基础问题,因为我是非专业的 ,据说要关闭JTAG,可是我还不敢,是不是关闭后就不能用便宜的烧写,李老师,我c语言能自学,可是这单片的基础,网上找不到教材,能指点么,:)
swg897570 发表于 2013-2-27 20:56 | 显示全部楼层
Glory分享 发表于 2017-1-6 09:36 | 显示全部楼层
楼主你的错误改正了没?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

15

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部

1

主题

15

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部