lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3853
Posted: 09:22pm 11 Jun 2025
This seems counter to all of the suggestions made. Have you tried any of the code examples provided? What have the results been?
What is your baud rate and what amount of data?
You've seen testimony of successful receipt at a baud rate approaching a million bits per second. What convinces you that you will not achieve similar success in your circumstances?
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 2050
Posted: 10:50pm 11 Jun 2025
Yeah,I checked out the Yahboom product and fail to see a problem for the PioMite.
Could even outperform the Yahboom servo controller. We can handle eight PIDs and read eight encoders, even on the RP2040.
toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 699
Posted: 11:21pm 11 Jun 2025
G'day Georges, The following might explain the situation.
OPEN "COM1:115200" as #1 When the serial port is opened, the receive buffer is cleared.
IF LOC(#1) > 10 THEN data$ = INPUT$(256, #1) Now we check the buffer, which is empty, so data$ is also empty.
So we need to wait for the data to arrive:
OPEN "COM1:115200" as #1 Do while LOC(#1)<10 ' loop here until 10 chars in input buffer Loop data$ = INPUT$(255, #1) print data$
You can also use interrupts but hopefully this will help.
Regards, Lyle.
INPUT$(n,#c) will wait until n characters have arrived from channel #c won't it?
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3348
Posted: 12:46am 12 Jun 2025
INPUT$(n,#c) will wait until n characters have arrived from channel #c won't it?
INPUT$(nbr, [#]fnbr) Will return a string composed of ‘nbr’ characters read from a file or serial communications port opened as 'fnbr'. This function will return as many characters as are in the file or receive buffer up to ‘nbr’. If there are no characters available it will immediately return with an empty string. #0 can be used which refers to the console's input buffer. The # is optional. Also see the OPEN command.
So no it won't wait. The manual could be changed to read " This function will return as many characters as are in the file or receive buffer up to ‘nbr’, removing them from the buffer." If there are more than n characters in the buffer the rest remain and Loc(#x) is adjusted. In my previous program changing 255 to 11 (g$ = Input$(11,#1)) shows this.
> LIST ' Serial Rx test program on Pico B SetPin gp1,gp0, com1 : Open "COM1:115200" As #1 g$ = Input$(255,#1) : g$="" 'purge the Rx buffer Do Do While Loc(#1) = 0 : Loop 'wait for data to start arriving
Pause 2 'allow time for the rest if the message to arrive 'increase for longer message or lower baud rate Print Loc(#1); " Bytes in Rx buffer", g$ = Input$(11,#1) Print g$; Loop > > RUN 21 Bytes in Rx buffer 12-06-2025 10 Bytes in Rx buffer 11:02:15 21 Bytes in Rx buffer 12-06-2025 10 Bytes in Rx buffer 11:02:16 21 Bytes in Rx buffer 12-06-2025 10 Bytes in Rx buffer 11:02:17 21 Bytes in Rx buffer 12-06-2025 10 Bytes in Rx buffer 11:02:18 21 Bytes in Rx buffer 12-06-2025 10 Bytes in Rx buffer 11:02:19