system
June 20, 2013, 3:04pm
1
Hello, I have problem with sending data through serial with Arduino.
When I try send data with WinAplication, I have following Sniffer LOG(Free Serial Monitor), see attachment. (there string is sent as entire data)
When I sending using Arduino, it seems that it sends like each byte apart, see attachment.
PS:
Serial Ports are virtual, I'm using Virtual Serial Ports Driver for XP
With combination WinApp(server) + WinApp(Clinet) - works fine.
I'm using Proteus to emulate Arduino.
void setup() {
Serial.begin(9600);
}
void loop() {
//20051010BB
byte cmd[]={0x20,0x05,0x10,0x10,0xBB};
Serial.write(cmd,sizeof(cmd));
delay(3000) ;
}
Try this, should loop thru all of the array cmd[]
//20051010BB
byte cmd[]={0x20,0x05,0x10,0x10,0xBB};
byte x;
void setup() {
Serial.begin(9600);
}
void loop() {
for (x =0; x<sizeof(cmd); x=x+1){
Serial.write(cmd[x]);
}
delay(3000) ; // why need this?
}
system
June 23, 2013, 7:13pm
3
Unfortunately, this didn't work.....
I attached new screens...
So How you see Win app sends entire buffer, those 5 bytes cmd[] = {0x20, 0x05, 0x00, 0x10, 0xCB};
On other side, arduino also send those bytes, but separately.
Marked with red screens.
http://siggiorn.com/arduino-serial-manager/ didn't solved problem.
Got me then - there's no line feed/carriage return being sent, don't know why it's repeating.
Also,
where is the 2nd occurrence of 0x10 that have in the array?
{0x20,0x05,0x10,0x10,0xBB}
system
June 23, 2013, 9:05pm
5
Sorry, my bad - {0x20,0x05,0x00,0x10,0xCB} - as in Screenshot.
Mean that no data lost or corrupt.
So the problem that I can't send entire buffer(5 byte)as one command.
Already googling 2-3 days.... if it is needed to use a low level libraries, mean AVR libraries to solve - let me know. Just point me, please.
So try straight "inline" code vs a loop:
void loop() {
Serial.write(cmd[0]);
Serial.write(cmd[1]);
Serial.write(cmd[2]);
Serial.write(cmd[3]);
Serial.write(cmd[4]);
delay(3000) ; // why need this?
}
system
June 23, 2013, 9:17pm
7
same stuff
code:
byte cmd[5]={0x20,0x05,0x00,0x10,0xCB};
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.write(cmd[0]);
Serial.write(cmd[1]);
Serial.write(cmd[2]);
Serial.write(cmd[3]);
Serial.write(cmd[4]);
delay(200);
}