I tryng to understand the example code for the xmit and recv interrupt service routines. Two questions #1 to someone that understands it .are my comments correct for this piece of code?
#2 I need some help with the "%" operator. The line of code marked with the '>' (not in actual code). the middle part increments the pointer but help with the front and back. Does the modulus of buffer sign set the next out as the remainder of that compairison. i.e. roll over counter when it reaches the end.
Sounds dumb but it's been a while
BYTE bgetc() {
BYTE c;
// while in&out are equal-nothing in buffer
while(!bkbhit) ; // wait till somethng is in there
c=r_buffer[r_next_out]; // get next char from buffer
> r_next_out=(r_next_out+1) % BUFFER_SIZE[/b]; // inc buffer position
return(c); // send char to calling routine
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum