C语言串口透传程序,软串口通信——SoftwareSerial库的使用

Arduino:1.8.1 (Windows 7), 开发板:"ATmega8-noxtal @8MHz"

D:\softwareinstallation\arduino\arduino-builder -dump-prefs -logger=machine -hardware D:\softwareinstallation\arduino\hardware -tools D:\softwareinstallation\arduino\tools-builder -tools D:\softwareinstallation\arduino\hardware\tools\avr -built-in-libraries D:\softwareinstallation\arduino\libraries -libraries C:\Users\jack\Documents\Arduino\libraries -fqbn=arduino:avr:atmega8noxtal -ide-version=10801 -build-path C:\Users\jack\AppData\Local\Temp\arduino_build_7708 -warnings=all -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=D:\softwareinstallation\arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=D:\softwareinstallation\arduino\hardware\tools\avr -verbose D:\桌面\项目\Arduino--add\softuart0.04\softuart0.04.ino

D:\softwareinstallation\arduino\arduino-builder -compile -logger=machine -hardware D:\softwareinstallation\arduino\hardware -tools D:\softwareinstallation\arduino\tools-builder -tools D:\softwareinstallation\arduino\hardware\tools\avr -built-in-libraries D:\softwareinstallation\arduino\libraries -libraries C:\Users\jack\Documents\Arduino\libraries -fqbn=arduino:avr:atmega8noxtal -ide-version=10801 -build-path C:\Users\jack\AppData\Local\Temp\arduino_build_7708 -warnings=all -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=D:\softwareinstallation\arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=D:\softwareinstallation\arduino\hardware\tools\avr -verbose D:\桌面\项目\Arduino--add\softuart0.04\softuart0.04.ino

Using board 'atmega8noxtal' from platform in folder: D:\softwareinstallation\arduino\hardware\arduino\avr

Using core 'arduino' from platform in folder: D:\softwareinstallation\arduino\hardware\arduino\avr

Warning: Board arduino:avr:atmega8noxtal doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA8NOXTAL

Detecting libraries used...

"D:\softwareinstallation\arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega8 -DF_CPU=8000000L -DARDUINO=10801 -DARDUINO_AVR_ATMEGA8NOXTAL -DARDUINO_ARCH_AVR   "-ID:\softwareinstallation\arduino\hardware\arduino\avr\cores\arduino" "-ID:\softwareinstallation\arduino\hardware\arduino\avr\variants\standard" "C:\Users\jack\AppData\Local\Temp\arduino_build_7708\sketch\softuart0.04.ino.cpp" -o "nul"

"D:\softwareinstallation\arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega8 -DF_CPU=8000000L -DARDUINO=10801 -DARDUINO_AVR_ATMEGA8NOXTAL -DARDUINO_ARCH_AVR   "-ID:\softwareinstallation\arduino\hardware\arduino\avr\cores\arduino" "-ID:\softwareinstallation\arduino\hardware\arduino\avr\variants\standard" "-ID:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src" "C:\Users\jack\AppData\Local\Temp\arduino_build_7708\sketch\softuart0.04.ino.cpp" -o "nul"

"D:\softwareinstallation\arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega8 -DF_CPU=8000000L -DARDUINO=10801 -DARDUINO_AVR_ATMEGA8NOXTAL -DARDUINO_ARCH_AVR   "-ID:\softwareinstallation\arduino\hardware\arduino\avr\cores\arduino" "-ID:\softwareinstallation\arduino\hardware\arduino\avr\variants\standard" "-ID:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src" "D:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp" -o "nul"

Generating function prototypes...

"D:\softwareinstallation\arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega8 -DF_CPU=8000000L -DARDUINO=10801 -DARDUINO_AVR_ATMEGA8NOXTAL -DARDUINO_ARCH_AVR   "-ID:\softwareinstallation\arduino\hardware\arduino\avr\cores\arduino" "-ID:\softwareinstallation\arduino\hardware\arduino\avr\variants\standard" "-ID:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src" "C:\Users\jack\AppData\Local\Temp\arduino_build_7708\sketch\softuart0.04.ino.cpp" -o "C:\Users\jack\AppData\Local\Temp\arduino_build_7708\preproc\ctags_target_for_gcc_minus_e.cpp"

"D:\softwareinstallation\arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\jack\AppData\Local\Temp\arduino_build_7708\preproc\ctags_target_for_gcc_minus_e.cpp"

正在编译项目...

"D:\softwareinstallation\arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega8 -DF_CPU=8000000L -DARDUINO=10801 -DARDUINO_AVR_ATMEGA8NOXTAL -DARDUINO_ARCH_AVR   "-ID:\softwareinstallation\arduino\hardware\arduino\avr\cores\arduino" "-ID:\softwareinstallation\arduino\hardware\arduino\avr\variants\standard" "-ID:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src" "C:\Users\jack\AppData\Local\Temp\arduino_build_7708\sketch\softuart0.04.ino.cpp" -o "C:\Users\jack\AppData\Local\Temp\arduino_build_7708\sketch\softuart0.04.ino.cpp.o"

Compiling libraries...

Compiling library "SoftwareSerial"

"D:\softwareinstallation\arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega8 -DF_CPU=8000000L -DARDUINO=10801 -DARDUINO_AVR_ATMEGA8NOXTAL -DARDUINO_ARCH_AVR   "-ID:\softwareinstallation\arduino\hardware\arduino\avr\cores\arduino" "-ID:\softwareinstallation\arduino\hardware\arduino\avr\variants\standard" "-ID:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src" "D:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp" -o "C:\Users\jack\AppData\Local\Temp\arduino_build_7708\libraries\SoftwareSerial\SoftwareSerial.cpp.o"

In file included from D:\softwareinstallation\arduino\hardware\arduino\avr\cores\arduino/Arduino.h:249:0,

from D:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp:43:

D:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)':

D:\softwareinstallation\arduino\hardware\arduino\avr\variants\standard/pins_arduino.h:56:42: warning: comparison is always true due to limited range of data type [-Wtype-limits]

#define digitalPinToPCICR(p)    (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0))

^

D:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp:319:7: note: in expansion of macro 'digitalPinToPCICR'

if (digitalPinToPCICR(_receivePin)) {

^

D:\softwareinstallation\arduino\hardware\arduino\avr\variants\standard/pins_arduino.h:56:62: error: 'PCICR' was not declared in this scope

#define digitalPinToPCICR(p)    (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0))

^

D:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp:319:7: note: in expansion of macro 'digitalPinToPCICR'

if (digitalPinToPCICR(_receivePin)) {

^

D:\softwareinstallation\arduino\hardware\arduino\avr\variants\standard/pins_arduino.h:56:42: warning: comparison is always true due to limited range of data type [-Wtype-limits]

#define digitalPinToPCICR(p)    (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0))

^

D:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp:360:6: note: in expansion of macro 'digitalPinToPCICR'

*digitalPinToPCICR(_receivePin) |= _BV(digitalPinToPCICRbit(_receivePin));

^

D:\softwareinstallation\arduino\hardware\arduino\avr\variants\standard/pins_arduino.h:58:49: error: 'PCMSK2' was not declared in this scope

#define digitalPinToPCMSK(p)    (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))

^

D:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp:363:22: note: in expansion of macro 'digitalPinToPCMSK'

_pcint_maskreg = digitalPinToPCMSK(_receivePin);

^

D:\softwareinstallation\arduino\hardware\arduino\avr\variants\standard/pins_arduino.h:58:76: error: 'PCMSK0' was not declared in this scope

#define digitalPinToPCMSK(p)    (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))

^

D:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp:363:22: note: in expansion of macro 'digitalPinToPCMSK'

_pcint_maskreg = digitalPinToPCMSK(_receivePin);

^

D:\softwareinstallation\arduino\hardware\arduino\avr\variants\standard/pins_arduino.h:58:103: error: 'PCMSK1' was not declared in this scope

#define digitalPinToPCMSK(p)    (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))

^

D:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp:363:22: note: in expansion of macro 'digitalPinToPCMSK'

_pcint_maskreg = digitalPinToPCMSK(_receivePin);

^

使用 1.0  版本的库 SoftwareSerial 在文件夹: D:\softwareinstallation\arduino\hardware\arduino\avr\libraries\SoftwareSerial

exit status 1

为开发板 ATmega8-noxtal @8MHz 编译时出错。

2323.png

(29.27 KB, 下载次数: 125)

2017-9-28 10:11 上传

b8f828579a79e4e60bc07a897289c9b1.gif

cb75b38b09f5f5c79b30824a2baac88f.gif

只包含了一个头文件

70d8077d25d7c32fb2a7a7cb2bbf0996.gif

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值