| ??? 08/19/02 21:57 Read: times |
#27531 - RE: For Loop Question |
I think that I should expand on the example with a bit of background.
I am sending a ring buffer via a synchronous FSK modem, the RxRdIdx is where I start reading from in the buffer the WrRdIdx is where I stop reading in the buffer (all available data will then be sent) The function call is a call to the "getCharFromBuffer" which returns the character (obviously) but also increments the RxRdIdx by 1 so that it approaches the WrRdIdx. After I receive the char from the function, I clock it out a bit at a time. I have thought about just making a copy of RxRdIdx as I enter the function and then using this as a variable that I can do what I want with in the for loop, but it adds some dgree of uncertainty to the process (what if I Rx another byte from the serial port while I am clocking this data out, I would like to sent that new byte as well) A while loop would probably not work, (nor would the >= clause in the for loop) as I am using a circular buffer which means that RxWrIdx may infact be less than the RxRdIdx. Or could I do something like: while(RxRdIdx != RxWrIdx) { } Thanks for all the suggestions Regards Marshall |
| Topic | Author | Date |
| For Loop Question | 01/01/70 00:00 | |
| RE: For Loop Question | 01/01/70 00:00 | |
| RE: For Loop Question | 01/01/70 00:00 | |
| RE: For Loop Question | 01/01/70 00:00 | |
| RE: For Loop Question | 01/01/70 00:00 | |
| RE: For Loop Question | 01/01/70 00:00 | |
| RE: For Loop Question | 01/01/70 00:00 | |
| RE: For Loop Question | 01/01/70 00:00 | |
| RE: For Loop Question | 01/01/70 00:00 | |
| RE: For Loop Question | 01/01/70 00:00 | |
| RE: For Loop Question | 01/01/70 00:00 | |
RE: For Loop Question | 01/01/70 00:00 |



