problem with receiving frame in arduino


hello,

using 2 arduinos send frame example 1 arduino using serial library
here transmitter code:
code: [select]


void setup() {
    serial.begin(9600);
}

void loop() {
    
    serial.write(0x7e);
    serial.write((byte)0x0);
    serial.write(0x10);
    serial.write(0x17);
    serial.write((byte)0x0);
    serial.write((byte)00);
    serial.write((byte)00);
    serial.write(0x48);
    serial.write(0x45);
    serial.write(0x4c);
    serial.write(0x4c);
    serial.write(0x4f);
    serial.write(0xff);
    long checksum = 0x17 + 0x48 + 0x45 + 0x4c+ 0x4c + 0x4f + 0xff ;
    serial.write(0xff - (checksum &0xff));
    
    while(serial.available());
    serial.write(serial.read());
    delay (500);
    }


and here receiver code:

code: [select]

void setup() {
  // put setup code here, run once:
 serial.begin(9600);
 
}
void loop()
{
  if (serial.available()>=13){
    if (serial.read()==0x7e){
    
        
    
    for(int i=0;i<13;i++){
      serial.print(serial.read(),hex);
      serial.print(",");
         }
         serial.println();
  
}}}


the simulation on proteus isis gave me results:

in reception want display red zone how eliminate others???
please thank

quote
in reception want display red zone how eliminate others???
the simplest way not send them. why sending them?


Arduino Forum > Using Arduino > Programming Questions > problem with receiving frame in arduino


arduino

Comments