Подскажите пожалуйста, чтото застрял на пустом месте
Есть main:
Код: Выделить всё
#include "uart.h"
#include <stdlib.h>
#include <string.h>
//#pragma CCB 0xCE
volatile unsigned char temp;
extern unsigned char ByteReceived;
extern unsigned char status_uart ;
volatile unsigned char sts, cntb, cmd, tr_s,i, cntglob;
volatile char* data1 = 0;
volatile char* data2 = 0;
volatile char* data3 = 0;
volatile char* data4 = 0;
volatile char* data5 = 0;
volatile unsigned int adr = 0x8000;
volatile char* strres ;
volatile char cmd1[] = "!01-SPU-1000\r";
volatile char cmd2[] = "!02-SPU-1000\r";
volatile char reccmd1[] = "$01M\0";
volatile char reccmd2[] = "$02M\0";
volatile char toend[] = ">AA\0";
volatile unsigned char pref=0, aa=0,b=0,dd=0,n=0,d=0;
//volatile char reccmd3[] = "$01M\0";
//volatile char reccmd4[] = "$02M\0";
//extern unsigned char ByteReceived;
void main()
{
unsigned char c;
///
IOPORT1 = 0x00;
IOPORT2 = 0x00;
IOPORT3 = 0x00;
IOPORT4 = 0x00;
//
IOPORT1 = 0xFF;
IOPORT2 = 0xFF;
IOPORT3 = 0xFF;
IOPORT4 = 0xFF;
///*(volatile short*)(adr) = 0x00;
///
IOPORT2 &= ~0x80;
IOPORT1 &= ~0xFF;
USART0_Init(SP_MODE_1);
IOPORT2 &= ~0x80;
_ei_();
ByteReceived = 0;
temp = 0;
status_uart =0;
IOPORT1 = 0xFF;
cntglob = 0;
data1 = malloc(sizeof("$AAM\r\0"));
data2 = malloc(sizeof("#AABDD\r\0"));
data3 = malloc(sizeof("@AABND\r\0"));
data4 = malloc(sizeof("@AA1\r\0"));
data5 = malloc(sizeof("@AA2\r\0"));
while(1)
{
if(temp == 1)
{
if((ByteReceived == 0x24) && (ByteReceived != 0x0D))
{
IOPORT1 = 0x0F;
sts = 1;
*(data1+ cntb) = ByteReceived;
cntb++ ;
}
else
{
if((sts==1) && (ByteReceived == 0x0D))
{
*(data1 + cntb) = '\0';
IOPORT1 &= ~0x08;
if(strcmp((const char *)data1,(const char *) reccmd1) == 0 )
{
IOPORT2 |= 0x80;
tr_s = sizeof(cmd1) - 1;
i = 0;
do
{
SBUF_TX0 = cmd1[i];//ByteReceived;//0x01;
do{status_uart = SP_STAT0;}
while(!(status_uart & 0x08));
tr_s --;
i++;
}
while(tr_s);
sts = 0;
cntb = 0;
IOPORT2 &= ~0x80;
}
if(strcmp((const char *)data1,(const char *) reccmd2) == 0 )
{
IOPORT2 |= 0x80;
tr_s = sizeof(cmd2) - 1;
i = 0;
do
{
//if(cmd&0x01)
SBUF_TX0 = cmd2[i];//ByteReceived;//0x01;
do{status_uart = SP_STAT0;}
while(!(status_uart & 0x08));
tr_s --;
i++;
}
while(tr_s);
sts = 0;
cntb = 0;
IOPORT2 &= ~0x80;
}
}
else
{
if((sts==1) && (ByteReceived != 0x0D))
{
*(data1+ cntb) = ByteReceived;
cntb++ ;
}
}
}
if((ByteReceived == 0x23) && (ByteReceived != 0x0D))
{
IOPORT1 = 0xF0;
sts = 2;
*(data2+ cntb) = ByteReceived;
cntb++ ;
tr_s = sizeof(toend) - 1;
i = 0;
do
{
SBUF_TX0 = toend[i];//ByteReceived;//0x01;
do{status_uart = SP_STAT0;}
while(!(status_uart & 0x08));
tr_s --;
i++;
}
while(tr_s);
}
else
{
if((sts==2) && (ByteReceived == 0x0D))
{
*(data2 + cntb) = '\0';
sscanf( data2, "%1u%2u%1u%1u",&pref, &aa, &b, &dd );
if((aa==0x31) || (aa == 0x32))
{
IOPORT2 |= 0x80;
tr_s = sizeof(toend) - 1;
i = 0;
do
{
SBUF_TX0 = toend[i];//ByteReceived;//0x01;
do{status_uart = SP_STAT0;}
while(!(status_uart & 0x08));
tr_s --;
i++;
}
while(tr_s);
sts = 0;
cntb = 0;
SBUF_TX0 = pref;//ByteReceived;//0x01;
do{status_uart = SP_STAT0;
while(!(status_uart & 0x08));
SBUF_TX0 = aa;//ByteReceived;//0x01;
do{status_uart = SP_STAT0;}
while(!(status_uart & 0x08));
SBUF_TX0 = b;//ByteReceived;//0x01;
do{status_uart = SP_STAT0;}
while(!(status_uart & 0x08));
SBUF_TX0 = dd;//ByteReceived;//0x01;
do{status_uart = SP_STAT0;}
while(!(status_uart & 0x08));
}
else
{
IOPORT2 |= 0x80;
SBUF_TX0 = pref;//ByteReceived;//0x01;
do{status_uart = SP_STAT0;}
while(!(status_uart & 0x08));
SBUF_TX0 = aa;//ByteReceived;//0x01;
do{status_uart = SP_STAT0;}
while(!(status_uart & 0x08));
SBUF_TX0 = b;//ByteReceived;//0x01;
do{status_uart = SP_STAT0;}
while(!(status_uart & 0x08));
SBUF_TX0 = dd;//ByteReceived;//0x01;
do{status_uart = SP_STAT0;}
while(!(status_uart & 0x08));
}
sts = 0;
cntb = 0;
IOPORT2 &= ~0x80;
}
else
{
if((sts==2) && (ByteReceived != 0x0D))
{
*(data2+ cntb) = ByteReceived;
cntb++ ;
}
}
///
}
if((ByteReceived == 0x40) && (ByteReceived != 0x0D))
{
sts = 3;
*(data3+ cntb) = ByteReceived;
cntb++ ;
}
else
{
if((sts==3) && (ByteReceived == 0x0D))
{
*(data3 + cntb) = '\0';
sscanf( data3, "%1u%2u%1u%1u", &pref, &aa, &b, &n, &d );
if((aa==0x31) || (aa == 0x32))
{
IOPORT2 |= 0x80;
tr_s = sizeof(toend) - 1;
i = 0;
do
{
SBUF_TX0 = toend[i];//ByteReceived;//0x01;
do{status_uart = SP_STAT0;}
while(!(status_uart & 0x08));
tr_s --;
i++;
}
while(tr_s);
sts = 0;
cntb = 0;
IOPORT2 &= ~0x80;
}
}
else
{
if((sts==3) && (ByteReceived != 0x0D))
{
*(data3+ cntb) = ByteReceived;
cntb++ ;
}
}
}
}
else
{
IOPORT2 &= ~0x80;
IOPORT2 &= ~0x80;
temp = 0;
}
}
}
Error[C119] C:\Program Files (x86)\CodeMaster-96\1_32_00\CMC-96\Inc\string.h(454,43): (CPP) Unclosed comment started in line 409
Ранее все работало, я просто добавил фукнционал и поменял весь main
Не могу отыскать следы этой ошибки, потому что в string.h я не лазил, и в main все вроде закрывается