Home > Back-end >  I want to be a serial port to send and receive procedures, there is an error, a great god, please he
I want to be a serial port to send and receive procedures, there is an error, a great god, please he

Time:09-25

I just want to be a serial port to send and receive, add 1 to 100, then every accumulative results to a serial port, I will send and receive serial port on the other end two ports together spontaneously from closed, but the value is very large, sending and receiving in principle should be from 0 to 5050, debugging for a long time without a result, a great god, please help to look at, appreciate

CodePudding user response:

No debug, but I think it should be like this.
 
Void MainWindow: : on_sendMsgBtn_clicked ()
{
Int a, I;
A=0;
for(i=0; i<100; I++)
{
A +=I;
This - & gt; WriteMyCom (a);
This - & gt; ReadMyCom (a);
}
}

CodePudding user response:

1
2
3
4
5
6
7
8
9
10
11.
Void MainWindow: : on_sendMsgBtn_clicked ()
{
Int a, I;
A=0;//initialize a
for(i=0; i<100; I++)
{
A +=I;
This - & gt; WriteMyCom (a);
//delay (10);//add a delay
This - & gt; ReadMyCom (a);
}
}

CodePudding user response:

Thank you, I have solved, because I didn't give the inside of the initialization parameters,

CodePudding user response:

reference 1/f, 1 CCTV reply:
no debugging, but I think it should be like this.
 
Void MainWindow: : on_sendMsgBtn_clicked ()
{
Int a, I;
A=0;
for(i=0; i<100; I++)
{
A +=I;
This - & gt; WriteMyCom (a);
This - & gt; ReadMyCom (a);
}
}

Thank you, is that really because no for a given initial value, thank you,

CodePudding user response:

refer to the second floor cptang response:
1
2
3
4
5
6
7
8
9
10
11.
Void MainWindow: : on_sendMsgBtn_clicked ()
{
Int a, I;
A=0;//initialize a
for(i=0; i<100; I++)
{
A +=I;
This - & gt; WriteMyCom (a);
//delay (10);//add a delay
This - & gt; ReadMyCom (a);
}
}

Thank you, I have solved, because I didn't give the inside of the initialization parameters,
  • Related