- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我是新来的。我正在使用 Microchip 的 XC8 编译器和 PIC18F25K22。当我构建代码时,出现错误
xc8.exe --pass1 --errformat="Error at file %%f line %%l column %%c: (%%n) %%s" --warnformat="Warning at file %%f line %%l column %%c: (%%n) %%s" --msgformat="Message at file %%f line %%l column %%c: (%%n) %%s" -G --chip=18F25K22 -O"main.p1" "../main.c"
Microchip MPLAB XC8 C Compiler (Free Mode) V1.37
Build date: Mar 10 2016
Part Support Version: 1.37
Copyright (C) 2016 Microchip Technology Inc.
License type: Node Configuration
Warning at file line column : (1273) Omniscient Code Generation not available in Free mode
Error at file ../i2clcd.c line 11 column 8: (195) expression syntax
Error at file ../i2clcd.c line 11 column 8: (312) ";" expected
Error at file ../i2clcd.c line 11 column 12: (285) no identifier in declaration
Error at file ../i2clcd.c line 11 column 12: (314) ";" expected
Error at file ../i2clcd.c line 14 column 10: (195) expression syntax
Error at file ../i2clcd.c line 14 column 10: (312) ";" expected
Error at file ../i2clcd.c line 14 column 14: (285) no identifier in declaration
Error at file ../i2clcd.c line 14 column 14: (314) ";" expected
Warning at file ../i2clcd.c line 23 column 1: (361) function declared implicit int
Error at file ../i2clcd.c line 51 column 11: (195) expression syntax
Error at file ../i2clcd.c line 51 column 11: (312) ";" expected
Error at file ../i2clcd.c line 51 column 15: (285) no identifier in declaration
Error at file ../i2clcd.c line 51 column 15: (314) ";" expected
Error at file ../i2clcd.c line 84 column 1: (192) undefined identifier "lcddata"
Error at file ../i2c.c line 10 column 1: (1098) conflicting declarations for variable "I2C_INIT" (../i2c.c:9)
(908) exit status = 1
make: *** [main.p1] Error 1
Error code 2
如果我将此代码行注释掉,我会在下一个注册命令(在我的例子中是:SSP1CON1)中收到错误 - 我试过包含 xc.h和 htc.h 但也有同样的错误。
我在stackoverflow上发现了一个类似的问题,但是通过把这些命令放在一个函数中解决了这个问题,但是我的是在一个函数中。
这是我的代码:
#include "i2c.h"
#include <xc.h>
#include <htc.h>
/*
* subroutine: I2C_INIT()
* access from: main.c/BOOT()
* description: Initialisises MSSP port for I2C Master-Mode
*/
void I2C_INIT(0)
{
TRISCbits.TRISC3=1; //config SCL-Line as Input;
TRISCbits.TRISC4=1; //config SDA-Line as Input;
SSP1CON1 = 0b00101000;
/*
* bit 5: Enables the serial port and configures the SDA and SCL pins as the
* source of the serial port pins
*bit 0-3: 1000: I2C Master Mode, clock = FOSC/(4*(SSPASS+1))
*/
SSP1CON2 = 0x00;
SSP1ADD = 39; //clock = FOSC/(4*(SSPASS+1)) - 100 kHz @ 16MHz FOSC
SSP1STAT = 0b11000000;
/*
* bit 7: Slew rate control disabled for standard speed mode (100 kHz and 1 MHz)
* bit 6: Data transmitted on rising edge of SCK
*/
}
最佳答案
所有寄存器声明( SSP1CON1
、 TRISCbits
等,都在 xc.h
中声明(并且它是嵌套的包含)。您的问题可能是 i2c.h
中的代码包含引用出现在xc.h
尝试颠倒您的包含顺序,将系统包含放在您自己的(或第三方)包含之前。
一般来说,您应该始终将所有系统包含(即用 <>
指定文件的那些)放在您自己的(用“”)之前。
关于c - XC8 寄存器声明冲突(例如 TRIS、SSP1CON1 等),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41943430/
我有一个在 Blender 中制作的角色模型,我正在使用 OpenGL 进行渲染。模型的纹理大量使用 alpha channel ,我需要处理特殊的半透明三角形(在这种情况下对它们进行深度排序)。 这
我正在尝试对 PIC12C508A 进行编程以实现简单的 LED 学习电路。我已经阅读了一些示例,Microchip 数据表、pic12c508a.h 和 pic12c508a.inc。我尝试使用 C
我有一个随机数量的顶点列表,我想获得 2 个四边形三角形的索引。每四个顶点应构成 2 个三角形。例如: 0,1,2, 0,2,3, 4,5,6, 4,6,7, 8,9,10, 8,10,11 我确
我们有一个包含 12k tris 的 Assets (一个 cargo 容器),我们在 Unity Assets 商店中找到了一个外观更好的 Assets ,包含 3.5k tris。然而,新资源的物
我是新来的。我正在使用 Microchip 的 XC8 编译器和 PIC18F25K22。当我构建代码时,出现错误 xc8.exe --pass1 --errformat="Error at file
我是一名优秀的程序员,十分优秀!