??? 02/16/07 13:43 Read: times |
#133124 - a bug ! and another problem Responding to: ???'s previous message |
Russel,
Mine is track 2, 5 bit encoding. I'm masking the high 3 bits! i found a "bug"...big one. i used to stop the global interrupt (EA=0) so the interrupt function wouldn't run anymore when end sentinel was found. after i printed the readen data on the screen the EA was set back on 1. but i found out that after EA was set on 1 the inerrupt function was called! and nrb (nr of bits) was incremented! I'm not stopping the global interrupt anymore when i find end sentinel. all the code in the interrupt is executed only if we have not found the end sentinel yet. void interr (void) interrupt 2 { if (have_stop==0) { nr++; [....code] } } now it works pretty good! BUT when i change the card , the first reading with the second card is incorrect! OUTPUT: where i nr of bytes read s have start S have stop nrb number of bits char nr is number of calls of interrupt function i:4 s:1 S:1 EA:1 nrb:0 nr:45 J1@=O i:4 s:1 S:1 EA:1 nrb:0 nr:45 J1@=O i:4 s:1 S:1 EA:1 nrb:0 nr:45 J1@=O ----i change card here----- i:0 s:0 S:0 EA:1 nrb:0 nr:250 0 i:4 s:1 S:1 EA:1 nrb:0 nr:45 J1@LO i:4 s:1 S:1 EA:1 nrb:0 nr:45 J1@LO ---- first card again ---- i:0 s:0 S:0 EA:1 nrb:4 nr:254 0 i:4 s:1 S:1 EA:1 nrb:0 nr:45 J1@=O I don't understand why nr of calls of ISR is around 250 and no start sentinel is found! |