>>Sorry guys I didn't see your replay. I can't quite figure out what it's doing wrong but you have :- for(i=0;i> 11 byte counter and then later on if(i==0 && read_data == 0x42) continue >> here I am looking for i=0 and 42 but by pre incrementing i, it can never equal 0 in the second if statement. ///// // good point I will check that ///// maybe the first statement should be :- for(i=0;i> you are right Maybe a bit more info on what it's actually doing - as well as what it's supposed to do may assist? >> the only problem was that I couldn't use debugger and >> I could only program it. RP On 06/10/06, Andre Abelian wrote: > > Hi to all engineers, > > I got stock on small routine any help will appreciated. > all it suppose to do is ignore a few byte of 11 byte of array i have > and if none ignored bytes changes generate an error. > > any idea of what i am doing wrong? > > Andre > > > #define BUFFER_SIZE 11 > BYTE buffer[BUFFER_SIZE]; > BYTE next_in = 0; > BYTE next_out = 0; > > int c,i; > BYTE const target_data[BUFFER_SIZE]={0x42,0x00,0x00,0x00,0x04,0x01,0x01,0x01,0x01,0x01,0x05}; > byte read_data=~target_data[0]; > > > while(1) { > #use rs232(baud=57600,parity=N,rcv=PIN_C3,bits=8) // RS422 to RS232 > for(i=0;i { > if(i==0 && read_data == 0x42) continue; > if((i==2||i==3||i==5||i==6||i==7||i==8)) > { > read_data=getc(); > continue; > } > > > if((read_data = getc())!=target_data[i]) break; > } > if(i==BUFFER_SIZE) > { > data_ok(); > } > else data_bad(); > } > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist