#include<reg52.h>
#include<intrins.h>
typedef unsigned charuchar ;
typedef unsigned intuint ;
//初始化
void Com_Init(void)
{
TMOD = 0x20;
PCON = 0x00;
SCON = 0x50;
TH1 = 0xFd;
TL1 = 0xFd;
TR1 = 1;
}
void Main()
{
unsigned long ReadCount(void)
uchar i = 0;
uchar code Buffer[] = "Welcome To The MCU World. http://dianzidasai.taobao.com/ TEL:13954067903 "; //所要发送的数据
uchar *p;
Com_Init();
p = Buffer;
while(1)
{
SBUF = *p;
while(!TI) //如果发送完毕,硬件会置位TI
{
_nop_();
}
p++;
if(*p == '\0') break;//在每个字符串的最后,会有一个'\0'
TI = 0; //TI清零
}
while(1);
}
//HX711驱动程序
sbit ADDO = P1^5;
sbit ADSK = P0^0;
unsigned long ReadCount(void){
unsinged long Count;
unsinged char i;
ADSK=0;
Count=0;
while(ADDO);
for(i=0;i<24;i++){
ADSK=1;
Count=Count<<1;
ADSK=0;
if(ADDO) Count++;
}
ADSK=1;
Count=Count^0x800000;
ADSK=0;
return(Count);
}
我用的是51的stc89c52rc 我想在hx711接一个半桥压感,将压感的模拟信号通过hx711放大,通过mcu的串口发给飞控
结果程序报了一大堆错误 有那位大神能帮我看看吗
错误如下:
Build target 'Target 1'
compiling 串口发送试验.c...
串口发送试验.C(22): error C141: syntax error near 'uchar'
串口发送试验.C(48): error C202: 'unsinged': undefined identifier
串口发送试验.C(48): error C141: syntax error near 'long'
串口发送试验.C(49): error C202: 'unsinged': undefined identifier
串口发送试验.C(49): error C141: syntax error near 'char'
串口发送试验.C(51): error C202: 'Count': undefined identifier
串口发送试验.C(53): error C202: 'i': undefined identifier
串口发送试验.C(55): error C202: 'Count': undefined identifier
串口发送试验.C(57): error C202: 'Count': undefined identifier
串口发送试验.C(60): error C202: 'Count': undefined identifier
串口发送试验.C(62): error C202: 'Count': undefined identifier
Target not created
#include<intrins.h>
typedef unsigned charuchar ;
typedef unsigned intuint ;
//初始化
void Com_Init(void)
{
TMOD = 0x20;
PCON = 0x00;
SCON = 0x50;
TH1 = 0xFd;
TL1 = 0xFd;
TR1 = 1;
}
void Main()
{
unsigned long ReadCount(void)
uchar i = 0;
uchar code Buffer[] = "Welcome To The MCU World. http://dianzidasai.taobao.com/ TEL:13954067903 "; //所要发送的数据
uchar *p;
Com_Init();
p = Buffer;
while(1)
{
SBUF = *p;
while(!TI) //如果发送完毕,硬件会置位TI
{
_nop_();
}
p++;
if(*p == '\0') break;//在每个字符串的最后,会有一个'\0'
TI = 0; //TI清零
}
while(1);
}
//HX711驱动程序
sbit ADDO = P1^5;
sbit ADSK = P0^0;
unsigned long ReadCount(void){
unsinged long Count;
unsinged char i;
ADSK=0;
Count=0;
while(ADDO);
for(i=0;i<24;i++){
ADSK=1;
Count=Count<<1;
ADSK=0;
if(ADDO) Count++;
}
ADSK=1;
Count=Count^0x800000;
ADSK=0;
return(Count);
}
我用的是51的stc89c52rc 我想在hx711接一个半桥压感,将压感的模拟信号通过hx711放大,通过mcu的串口发给飞控
结果程序报了一大堆错误 有那位大神能帮我看看吗
错误如下:
Build target 'Target 1'
compiling 串口发送试验.c...
串口发送试验.C(22): error C141: syntax error near 'uchar'
串口发送试验.C(48): error C202: 'unsinged': undefined identifier
串口发送试验.C(48): error C141: syntax error near 'long'
串口发送试验.C(49): error C202: 'unsinged': undefined identifier
串口发送试验.C(49): error C141: syntax error near 'char'
串口发送试验.C(51): error C202: 'Count': undefined identifier
串口发送试验.C(53): error C202: 'i': undefined identifier
串口发送试验.C(55): error C202: 'Count': undefined identifier
串口发送试验.C(57): error C202: 'Count': undefined identifier
串口发送试验.C(60): error C202: 'Count': undefined identifier
串口发送试验.C(62): error C202: 'Count': undefined identifier
Target not created