Hi there,
I've builded the circuit and till know, it all works fine. There's one thing though, I am trying to do like another DO_SUM methos. Instead of sending 2 numbers and recieving one, I am sending 4 numbers (send_buff[1], send_buff[2], send_buff[3] and send_buff[4] and using send_buff[0] for the address). The firmware method in the user.c fileI am adding this case
case DO_SUM2: dataPacket._byte[1] = dataPacket._byte[1] + dataPacket._byte[2]; dataPacket._byte[2] = dataPacket._byte[3] + dataPacket._byte[4]; counter = 0x02; break;
the wrong thing is that the first 2 values (dataPacket._byte[1] and dataPacket._byte[2]) are adding but the secong 2 values are not. I am recieving only the addition of the first two value. In the C# softwar, to get the data back, I a writing
int a = Convert.ToInt32(recieve_buff[1]); int b = Convert.ToInt32(recieve_buff[2]);
But as I said, I am getting a value back only from recieve_buff[1]. How can I get the other value.? and aother thing. What does the counter = 0x02 mean exactly?
|