Mplab软件和PICC编译器,PIC12F509单片机,程序如下
#include<htc.h>
//#include "main.h"
__CONFIG(MCLRDIS&WDTDIS&UNPROTECT&INTRC); //设置配置位(MCLR脚复位禁止,看门狗关,无代码保护,内部RC振荡)
void DelayUS(unsigned char delay)
{
//while(--delay);
NOP();NOP();NOP();NOP();NOP();
}
void main()
{
while(1)
{
DelayUS(100);
}
}
#ifndef __MAIN_H__
#define __MAIN_H__
#endif
很奇怪的问题,main函数中去掉延时函数,就正常了,只要有一处调用延时函数,就增加200%,10处调用延时函数,就2000%,目前还不知道怎么解决此问题。
另外,烧写进去的程序,20%的程序正常,其余均出现数据混乱程序运行时间不对,但是程序流程还是对的。
另外,同样的Mpalb和PICC编译器,打开别的工程,程序调用延时函数,一切正常,未出现这种提示。
程序编译后:
Clean: Deleting intermediary and output files.
Clean: Deleted file "E:\PIC_12F508\main.obj".
Clean: Deleted file "E:\PIC_12F508\main.cce".
Clean: Deleted file "PIC_12F508.cof".
Clean: Done.
Executing: "D:\Project_soft\Mplab\setup\PICC950\bin\picc.exe" -C -E"main.cce" "main.c" -O"main.obj" -Zg9 -O -ASMLIST -Q -MPLAB -12F509
Advisory[1209] : An old MPLAB tool suite plug-in was detected. Some options may not work correctly
Advisory[1210] : Visit www.htsoft.com or contact support@htsoft.com for an update
Executing: "D:\Project_soft\Mplab\setup\PICC950\bin\picc.exe" -E"PIC_12F508.lde" "E:\PIC_12F508\main.obj" -M"PIC_12F508.map" -O"PIC_12F508.cof" -O"PIC_12F508.hex" -Q -MPLAB -12F509
Memory Usage Map:
Program space:
CODE used Fh ( 15) of 400h words ( 1.5%)
ENTRY used 15h ( 21) of 400h words ( 2.1%)
Data space:
BANK0 used 4h ( 4) of 19h bytes ( 16.0%)
BANK1 used 0h ( 0) of 10h bytes ( 0.0%)
COMBANK used 0h ( 0) of 10h bytes ( 0.0%)
EEPROM space:
None available
ID Location space:
IDLOC used 0h ( 0) of 4h bytes ( 0.0%)
Configuration bits:
CONFIG used 1h ( 1) of 1h word (100.0%)
Extra space:
STRING used 2h ( 2) of 1h unit (200.0%)
Summary:
Program space used 24h ( 36) of 400h words ( 3.5%)
Data space used 4h ( 4) of 30h bytes ( 8.3%)
EEPROM space None available
ID Location space used 0h ( 0) of 4h bytes ( 0.0%)
Configuration bits used 1h ( 1) of 1h word (100.0%)
used 2h ( 2) of 1h unit (200.0%)
Advisory[1209] : An old MPLAB tool suite plug-in was detected. Some options may not work correctly
Advisory[1210] : Visit www.htsoft.com or contact support@htsoft.com for an update
Loaded E:\PIC_12F508\PIC_12F508.cof.
BUILD SUCCEEDED: Thu Sep 06 14:07:18 2012 |