![]() |
發布時間: 2023-4-24 14:08
正文摘要:麻煩大家幫我檢查一下C程序,運行結果是這樣的 Build target 'Target 1' Text3.c(3): warning C318: can't open file 'sfr.h' Text3.c(4): warning C318: can't open file 'os.h' TEXT3.C(7): error C129: mis ... |
angmall 發表于 2023-4-24 21:06 謝謝大神, 編譯通過了. |
給你改了一下試試 ![]()
|
angmall 發表于 2023-4-24 18:47 是的,基于C51的頻率計100兆赫頻率計,就是想編譯一下固件. |
Hephaestus 發表于 2023-4-24 18:23 我把程序放上來,大神看看能不能編譯 |
10.93 MB, 下載次數: 4
你這個是韓的頻率計 開源的基于C51的頻率計100兆赫頻率計數器/脈沖計數器 本機為使用8051的8位100MHz的頻率計數器。 8051內部16比特計數器及外部12比特(其中74F161 4比特, 74HC393 8比特)共 28 比特計數器,8位數字顯示100MHz頻率計數器。 |
51hei3.gif (25.12 KB, 下載次數: 84)
51hei1.gif (29.02 KB, 下載次數: 79)
51hei2.gif (23.44 KB, 下載次數: 87)
51hei0.gif (23.53 KB, 下載次數: 82)
你這個是韓的頻率計 8051內部16比特計數器及外部12比特(其中74F161 4比特, 74HC393 8比特)共 28 比特計數器,8位數字顯示100MHz頻率計數器。 |
hmsd 發表于 2023-4-24 17:11 版本新了可能還不好用,過期好辦,放虛擬機里面運行,給個假時間就可以了。 |
angmall 發表于 2023-4-24 18:09 os.h頭文件 //系統頭文件(os.h) #include"c8051f.h" #include"OS_INIT_SP.H" //系統初始化頭文件 #include"Init_Task.h" #define uint unsigned int #define uchar unsigned char #define ulong unsigned long #define uint unsigned int #define uchar unsigned char #define ulong unsigned long #define SYSCLK 11059200 //晶振頻率 #define SYTIMEISR 50 //系統時鐘中斷時間(ms) #define NULL (void *)0L #define OK 1 /*任務狀態*/ #define WAIT_MSG 0X00 #define WAIT_TIME 0X01 #define READY 0X02 #define TEST 1 //測試代碼條件編譯 /*任務表*/ typedef struct task_b { uchar xdata *sp_start; //任務堆棧底指針 uchar sp_size; //任務堆棧長度 uchar flg; //任務狀態 //uchar prio; //任務指針 //struct task_msg *msg ; //任務接收消息結構體指針 uchar timedal; //任務掛起延遲時間 }task_link; extern task_link xdata OSPCB[N+1]; //TASK zhuang tai link /*操作系統全局變量*/ extern uchar data Prio; //當前運行的任務優先級 extern uchar data *spend; //系統堆棧底指針 extern uchar data ISR_num; //中斷嵌套次數 extern uchar data OSRdyGrp; //任務就緒表全局變量 extern uchar data OSRdyTab[TASK_8N];//任務優先級表1 extern uchar code OSMapTab[8]; //任務優先級表2 extern uchar code OSUnMapTab[256]; //任務優先級表3 /*操作系統全局函數*/ extern void Task_Init(uchar i,void(*addr)(void),uchar xdata *Task_sta);//系統初始化函數 extern void OS_RdyTask(uchar prio); //使一個任務就緒 extern void OSTask_TimeDal(uchar TimeDal); //使一個任務時間延遲 extern void OSISR_Task_Sched(void); //切換任務函數 extern void OSInit_task(); //任務堆棧初始化 |
hmsd 發表于 2023-4-24 17:28 你貼出來,我們替你想辦法解決掉啊。 |
人中狼 發表于 2023-4-24 16:43 兩個頭文件sfr.h os.h找到了,編譯時頭文件os.h也報錯. |
Hephaestus 發表于 2023-4-24 16:59 這個編譯器是有的,不過已經過期了不能用了.也沒有新版本. |
人中狼 發表于 2023-4-24 16:43 兩個頭文件在網上找到了,但編譯時頭文件也抱錯.大神給看看頭文件有錯誤嗎. os.h頭文件 /* Copyright (c) 2001 Crossware Associates */ /* Interrupt vector numbers */ /* Definitions for _interrupt n for Cygnal chips * * For example: * * void _interrupt IVN_TIMER1 Timer1InterruptHandler() * { * } * */ #ifdef __C8051F02X #define IVN_INTERRUPT0 0 #define IVN_TIMER0 1 #define IVN_INTERRUPT1 2 #define IVN_TIMER1 3 #define IVN_SERIALPORT 4 #define IVN_SERIALPORT0 4 #define IVN_TIMER2 5 #define IVN_SPI 6 #define IVN_SMBUS 7 #define IVN_ADC0WINDOW 8 #define IVN_PCA0 9 #define IVN_CP0FALLING 10 #define IVN_CP0RISING 11 #define IVN_CP1FALLING 12 #define IVN_CP1RISING 13 #define IVN_TIMER3 14 #define IVN_ADC0CONVERSION 15 #define IVN_TIMER4 16 #define IVN_ADC1CONVERSION 17 #define IVN_INTERRUPT6 18 #define IVN_INTERRUPT7 19 #define IVN_SERIALPORT1 20 #define IVN_OSC 21 #elif defined(__C8051F0XX) #define IVN_INTERRUPT0 0 #define IVN_TIMER0 1 #define IVN_INTERRUPT1 2 #define IVN_TIMER1 3 #define IVN_SERIALPORT 4 #define IVN_SERIALPORT0 4 #define IVN_TIMER2 5 #define IVN_SPI 6 #define IVN_SMBUS 7 #define IVN_ADC0WINDOW 8 #define IVN_PCA0 9 #define IVN_CP0FALLING 10 #define IVN_CP0RISING 11 #define IVN_CP1FALLING 12 #define IVN_CP1RISING 13 #define IVN_TIMER3 14 #define IVN_ADC0CONVERSION 15 #define IVN_INTERRUPT4 16 #define IVN_INTERRUPT5 17 #define IVN_INTERRUPT6 18 #define IVN_INTERRUPT7 19 #define IVN_OSC 21 #elif defined(__C8051F2XX) #define IVN_INTERRUPT0 0 #define IVN_TIMER0 1 #define IVN_INTERRUPT1 2 #define IVN_TIMER1 3 #define IVN_SERIALPORT 4 #define IVN_SERIALPORT0 4 #define IVN_TIMER2 5 #define IVN_SPI 6 #define IVN_ADC0WINDOW 8 #define IVN_CP0FALLING 10 #define IVN_CP0RISING 11 #define IVN_CP1FALLING 12 #define IVN_CP1RISING 13 #define IVN_ADC0CONVERSION 15 #define IVN_INTERRUPT4 16 #define IVN_INTERRUPT5 17 #define IVN_INTERRUPT6 18 #define IVN_INTERRUPT7 19 #define IVN_OSC 21 #elif defined(__C8051F31X) #define IVN_INTERRUPT0 0 #define IVN_TIMER0 1 #define IVN_INTERRUPT1 2 #define IVN_TIMER1 3 #define IVN_SERIALPORT 4 #define IVN_SERIALPORT0 4 #define IVN_TIMER2 5 #define IVN_SPI 6 #define IVN_SMBUS 7 #define IVN_ADC0WINDOW 9 #define IVN_ADC0CONVERSION 10 #define IVN_PCA0 11 #define IVN_CP0 12 #define IVN_CP1 13 #define IVN_TIMER3 14 #elif defined(__C8051F32X) #define IVN_INTERRUPT0 0 #define IVN_TIMER0 1 #define IVN_INTERRUPT1 2 #define IVN_TIMER1 3 #define IVN_SERIALPORT 4 #define IVN_SERIALPORT0 4 #define IVN_TIMER2 5 #define IVN_SPI 6 #define IVN_SMBUS 7 #define IVN_USB 8 #define IVN_ADC0WINDOW 9 #define IVN_ADC0CONVERSION 10 #define IVN_PCA0 11 #define IVN_CP0 12 #define IVN_CP1 13 #define IVN_TIMER3 14 #define IVN_VBUS_LEVEL 15 #elif defined(__C8051F3XX) #define IVN_INTERRUPT0 0 #define IVN_TIMER0 1 #define IVN_INTERRUPT1 2 #define IVN_TIMER1 3 #define IVN_SERIALPORT 4 #define IVN_SERIALPORT0 4 #define IVN_TIMER2 5 #define IVN_SMBUS 6 #define IVN_ADC0WINDOW 7 #define IVN_ADC0CONVERSION 8 #define IVN_PCA0 9 #define IVN_CP0FALLING 10 #define IVN_CP0RISING 11 #else #error No appropriate variant defined #endif ------------------------------------- sfr.h頭文件 系統頭文件(sfr.h) REG51.H Header file for generic 80C51 and 80C31 microcontroller. Copyright (c) 1988-2002 Keil Elektronik GmbH and Keil Software, Inc. All rights reserved. --------------------------------------------------------------------------*/ #ifndef __REG51_H__ #define __REG51_H__ typedef unsigned char uint8; typedef unsigned short int uint16; typedef unsigned int uint32; /* BYTE Register */ sfr P0 = 0x80; sfr P1 = 0x90; sfr P2 = 0xA0; sfr P3 = 0xB0; sfr PSW = 0xD0; sfr ACC = 0xE0; sfr B = 0xF0; sfr SP = 0x81; sfr DPL = 0x82; sfr DPH = 0x83; sfr PCON = 0x87; sfr TCON = 0x88; sfr TMOD = 0x89; sfr TL0 = 0x8A; sfr TL1 = 0x8B; sfr TH0 = 0x8C; sfr TH1 = 0x8D; sfr IE = 0xA8; sfr IP = 0xB8; sfr SCON = 0x98; sfr SBUF = 0x99; /* BIT Register */ /* PSW */ sbit CY = 0xD7; sbit AC = 0xD6; sbit F0 = 0xD5; sbit RS1 = 0xD4; sbit RS0 = 0xD3; sbit OV = 0xD2; sbit P = 0xD0; /* TCON */ sbit TF1 = 0x8F; sbit TR1 = 0x8E; sbit TF0 = 0x8D; sbit TR0 = 0x8C; sbit IE1 = 0x8B; sbit IT1 = 0x8A; sbit IE0 = 0x89; sbit IT0 = 0x88; /* IE */ sbit EA = 0xAF; sbit ES = 0xAC; sbit ET1 = 0xAB; sbit EX1 = 0xAA; sbit ET0 = 0xA9; sbit EX0 = 0xA8; /* IP */ sbit PS = 0xBC; sbit PT1 = 0xBB; sbit PX1 = 0xBA; sbit PT0 = 0xB9; sbit PX0 = 0xB8; /* P3 */ sbit RD = 0xB7; sbit WR = 0xB6; sbit T1 = 0xB5; sbit T0 = 0xB4; sbit INT1 = 0xB3; sbit INT0 = 0xB2; sbit TXD = 0xB1; sbit RXD = 0xB0; /* SCON */ sbit SM0 = 0x9F; sbit SM1 = 0x9E; sbit SM2 = 0x9D; sbit REN = 0x9C; sbit TB8 = 0x9B; sbit RB8 = 0x9A; sbit TI = 0x99; sbit RI = 0x98; #endif |
hmsd 發表于 2023-4-24 16:01 那你就去找這個編譯器唄,用Keil只有死路一條。 |
還是先解決找不到頭文件的問題吧 |
Hephaestus 發表于 2023-4-24 15:48 源資料說使用Crossware 8051 C 編譯器 |
趕腳不是Keil C51,更像是SDCC或IAR8051,問提供文件的人,到底用什么編譯器。 |
xuyaqi 發表于 2023-4-24 15:29 謝謝大神, 剛試過了,還是一樣報錯. |
應該把 _sfrbit 改為 sbit |