如何解决这些codevisionavr语法错误? [英] How can I solve these codevisionavr syntax errors?

查看:375
本文介绍了如何解决这些codevisionavr语法错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< code> hc1.c as main



 < span class =code-keyword> #include   <   io.h  >  
/ * 包含io.h头文件,其中所有输入/输出寄存器及其位都是为所有AVR微控制器定义的* /

#define F_CPU 8000000
/ * 为delay.h定义一个宏头文件。 F_CPU是delay.h头文件的微控制器频率值。 delay.h头文件中F_CPU的默认值为1000000(1MHz)* /

#include < delay.h >
/ * 包含delay.h头文件,它定义了两个函数,_delay_ms (毫秒延迟)和_delay_us(微秒延迟)* /

#include < hc05.h >
/ * 包含hc05.h头文件,该文件定义了HC-05蓝牙模块的不同功能。 HC-05头文件版本为1.1 * /


void main( void
{
delay_ms( 500 );
delay_ms( 500 );
/ * 延迟1s * /

usart_init() ;
/ * USART初始化* /

hc_05_bluetooth_transmit_string( ABLab Solutions);
/ * 将字符串传输到蓝牙模块* /

hc_05_bluetooth_transmit_byte(0X0D);
/ * 将回车转运至蓝牙模块* /

hc_05_bluetooth_transmit_byte(0X0A);
/ * 将新线路传输到蓝牙模块以获取新线路* /

hc_05_bluetooth_transmit_string( www.ablab.in);
/ * 将字符串传输到蓝牙模块* /

hc_05_bluetooth_transmit_byte(0X0D);
/ * 将回车转运至蓝牙模块* /

hc_05_bluetooth_transmit_byte(0X0A);
/ * 将新线路传输到蓝牙模块以获取新线路* /
}
/ * 程序结束* /





我尝试过:



错误: C:\ cvavr \\\\usart.h( 113 ): undefined  symbol '  unsignedchar' 
错误:C:\ cvavr \inc\usart.h( 114 ): undefined symbol ' unsignedchar'
错误:C:\ cvavr \inc\usart.h( 114 ):< span class =code-keyword> undefined symbol ' i'
错误:C:\ cvavr \\ n \\ usartart.h( 117 ): undefined symbol ' i'
错误:C:\ cvavr \\\ art.h( 120 ): undefined symbol ' temp'
错误:C:\ cvavr \\\ art.h( 122 ): undefined symbol ' temp'

解决方案

不要试图将代码分成多个问题:它使得回答更难。

并且可能不可能,因为它们都不包含完整信息。



相反,查看错误消息,考虑一下,可能会变得很明显。

没有 unsignedchar 数据类型:它有一个空格。

编辑消息所说的 usart.h 头文件,转到第113行,然后更改 unsignedchar unsigned char 并重新编译。

大部分错误的可能性都会消失。

<code>hc1.c as main

#include<io.h>
/*Includes io.h header file where all the Input/Output Registers and its Bits are defined for all AVR microcontrollers*/

#define    F_CPU    8000000
/*Defines a macro for the delay.h header file. F_CPU is the microcontroller frequency value for the delay.h header file. Default value of F_CPU in delay.h header file is 1000000(1MHz)*/

#include<delay.h>
/*Includes delay.h header file which defines two functions, _delay_ms (millisecond delay) and _delay_us (microsecond delay)*/

#include<hc05.h>
/*Includes hc05.h header file which defines different functions for HC-05 Bluetooth Module. HC-05 header file version is 1.1*/


void main(void)
{
    delay_ms(500);
    delay_ms(500);
    /*Delay of 1s*/
    
    usart_init();
    /*USART initialization*/
    
    hc_05_bluetooth_transmit_string("ABLab Solutions");
    /*Transmits a string to Bluetooth Module*/

    hc_05_bluetooth_transmit_byte(0x0d);
    /*Transmits Carriage return to Bluetooth Module*/
    
    hc_05_bluetooth_transmit_byte(0x0a);
    /*Transmits New Line to Bluetooth Module for new line*/

    hc_05_bluetooth_transmit_string("www.ablab.in");
    /*Transmits a string to Bluetooth Module*/

    hc_05_bluetooth_transmit_byte(0x0d);
    /*Transmits Carriage return to Bluetooth Module*/
    
    hc_05_bluetooth_transmit_byte(0x0a);
    /*Transmits New Line to Bluetooth Module for new line*/
}
/*End of program*/



What I have tried:

Error: C:\cvavr\inc\usart.h(113): undefined symbol 'unsignedchar'
Error: C:\cvavr\inc\usart.h(114): undefined symbol 'unsignedchar'
Error: C:\cvavr\inc\usart.h(114): undefined symbol 'i'
Error: C:\cvavr\inc\usart.h(117): undefined symbol 'i'
Error: C:\cvavr\inc\usart.h(120): undefined symbol 'temp'
Error: C:\cvavr\inc\usart.h(122): undefined symbol 'temp'

解决方案

Don't try to split your code across multiple questions: it makes it harder to answer.
And possibly impossible, since none of them contain "full" informations.

Instead, look at the error messages, think about them, and probably it becomes obvious.
There is no unsignedchar data type: it has a space in it.
Edit the usart.h header file the message talks about, go to line 113, and change unsignedchar to unsigned char and recompile.
The chances are most of your errors will disappear.


这篇关于如何解决这些codevisionavr语法错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆