Mike - K8LH
Well-Known Member
Pommie said:I think you may have introduced a bug in your latest code. If an interrupt happens where I have indicated then, if the buffer is not full but contains data, the xorwf TX_RPTR,W will not restore the value as you intended. This could be recalculated just as efficiently with incf TX_WPTR,F followed by bcf TX_WPTR,4.
Mike.
Ahhhh, good point... If the 'unload buffer' code in the ISR modifies TX_RPTR at this critical point in my Put232 subroutine, I'm all messed up... Thanks for the tip...
I'm not sure your bcf TX_WPTR,4 suggestion will work... (1) My TX_WPTR variable contains values in the range of B0..BF (10110000..10111111)... (2) Even if I was using 00..0F for my RX_RPTR and RX_WPTR values, the 'unload buffer' code in the ISR might catch that momentary TX_WPTR value of 00010000 just before the bcf TX_WPTR,4 instruction in main...
Thanks again for catching my mistake...
Regards, Mike