Oliver, that is just because else it does not work properly. How to use the usb serial to send a single ascii command to the picmicro, in return the microcontroller will send a burst of data and stop. Sending again the same command, returning another burst of data. This is not working for me. I can presume there is an interrupt issue which interfere with my code.
The serial int_cts does work much better (and faster) by "abusing it".:) The usb serial unfortunately does not. As long you have a pointer and a circular buffer, I think is not a sacrilege trying to work directly with them. On Wed, Aug 6, 2025 at 8:30 AM 'Oliver Seitz' via jallib < [email protected]> wrote: > Hi Rob, > > we also had discussions about serial_int_cts in the past, it was mainly > due to people abusing the circular receive buffer as linear input buffer. > Instead of using the library's designated functions to read one character > from the circular buffer, they try to read directly from the circular > buffer, which is meant to be internal to the library only. > > This might be a similar issue. > > Greets, > Kiste > > Am Dienstag, 5. August 2025 um 19:11:04 MESZ hat Rob CJ < > [email protected]> Folgendes geschrieben: > > > Hi vsurducan, > > I do not understand the problem. I never had issues with the USB library > that a character is reloaded again from the receive buffer. > > Is it not a problem of the PIC you are using? Have you checked the errata > document? > > Kind regards, > > Rob > > ------------------------------ > *Van:* [email protected] <[email protected]> namens vsurducan > <[email protected]> > *Verzonden:* dinsdag 5 augustus 2025 11:09 > *Aan:* [email protected] <[email protected]> > *Onderwerp:* [jallib] Re: clear CDC buffer > > Ok, here is one solution. If I do no clear the CDC rx buffer, after the > first press of "D" or "d"character the chr value remains the same. > To clear the CDC RX buffer, the pointer must be first decremented, than > the value stored in the buffer cleared. > A new press on "D" or "d" works ok now. > > forever loop > if (chr == "d") | (chr == "D") then > for 8 using i loop > format_word_dec (usb_serial_data, some_data[i], 4, 0) > print_crlf (usb_serial_data) > end loop > print_crlf (usb_serial_data) > ; chr = 0 ; chr "D" or "d" is not cleared with this > cdc_rx_rd = cdc_rx_rd - 1 ; decrement pointer cdc_rx_rd > cdc_rx_buffer[cdc_rx_rd] = 0 ; chr is now 0 > > end if > end loop > > > On Mon, Aug 4, 2025 at 9:24 PM vsurducan <[email protected]> wrote: > > Hi, > I'm trying to clear the last received character through USB communication, > however it seems that last char is reloaded from the receiving buffer. > How can be cleared the last position of the CDC buffer? > > thank you, > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/jallib/CAM%2Bj4qsM9KHOmFegcU0GjWeRxvSggDbVz84pCeddjQbGsbj5Zw%40mail.gmail.com > <https://groups.google.com/d/msgid/jallib/CAM%2Bj4qsM9KHOmFegcU0GjWeRxvSggDbVz84pCeddjQbGsbj5Zw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/jallib/AM7PR02MB6098DEAE25DE7EA9BA4E1CFAE622A%40AM7PR02MB6098.eurprd02.prod.outlook.com > <https://groups.google.com/d/msgid/jallib/AM7PR02MB6098DEAE25DE7EA9BA4E1CFAE622A%40AM7PR02MB6098.eurprd02.prod.outlook.com?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/jallib/103127088.1309355.1754458194447%40mail.yahoo.com > <https://groups.google.com/d/msgid/jallib/103127088.1309355.1754458194447%40mail.yahoo.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/jallib/CAM%2Bj4qsC45omMCX4Hs5Vc0htZYjNb5M4-LKQkKS9-Xgb5TcBMQ%40mail.gmail.com.
