在Multisim12中进行的8052单片机仿真实验,该实验为进制计数器,输入C程序源代码后,编译时显示一个错误为“fatal error C1083: 无法打开包括文件:“htc. h”: No such file or directory”,网上到处查找原因未果特来请教各位高人,还请不吝赐教,谢谢!
代码如下所示:
#include < htc. h > void delay( unsigned int i) ; unsigned char code table [ ] = { 0x40, 0x79, 0x24, 0x30, 0x19, 0x12, 0x02, 0x78, 0x00, 0x90}; unsigned char a1, a2, a3; void main ( ) { unsigned int i; while (1) { for( i = 0; i < 11; i + + ) { if ( i = = 0) {P2 = 0x40; P1 = 0x40; P0 = 0x40; } if ( i = = 1) {P2 = 0x79; P1 = 0x40; P0 = 0x40; } if ( i = = 2) {P2 = 0x24; P1 = 0x40; P0 = 0x40; } if ( i = = 3) { P2 = 0x30; P1 = 0x40; P0 = 0x40; } if ( i = = 4) { P2 = 0x19; P1 = 0x40; P0 = 0x40; } if ( i = = 5) { P2 = 0x12; P1 = 0x40; P0 = 0x40; } if ( i = = 6) { P2 = 0x02; P1 = 0x40; P0 = 0x40; } if ( i = = 7) { P2 = 0x78; P1 = 0x40; P0 = 0x40; } if ( i = = 8) { P2 = 0x00; P1 = 0x40; P0 = 0x40; } if ( i = = 9) { P2 = 0x10; P1 = 0x40; P0 = 0x40; } if ( i = = 10) { P2 = 0x40; P1 = 0x79; P0 = 0x40; i = 0; } } } } void delay( unsigned int i) { while ( i - - ) ; }
#include < htc. h > 是不是多了一个空格?
还是 htc.h 文件不存在,或 include 的目录不对
< htc. h >改为<htc.h>之后就不再提示htc.h打不开了,但是提示有8个错误,根据报错提示行,试着将 i + +改为i++ i - -改为i-- 之后再次build,提示编译及链接0个错误、0个警告
|