Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:55 13 Jun 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : serial input

     Page 2 of 2    
Author Message
georgestheking
Newbie

Joined: 21/12/2021
Location: Belgium
Posts: 32
Posted: 04:30pm 11 Jun 2025
Copy link to clipboard 
Print this post

Hi,

Thanks everybody for your help and messages.

I will add a microcontroller before the Pïcomite to reduce the flux of datas.

This project is a two wheels mobile robot for my child.
It use a "PID 4 motors controller" from Yahboom.

I think BASIC is a good way to learn programming.

https://category.yahboom.net/fr/collections/a-motor/products/quad-md-module

Best regards

Georges
Edited 2025-06-12 02:31 by georgestheking
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3339
Posted: 09:22pm 11 Jun 2025
Copy link to clipboard 
Print this post

  georgestheking said  I will add a microcontroller before the Pïcomite to reduce the flux of datas.


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?
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1285
Posted: 10:50pm 11 Jun 2025
Copy link to clipboard 
Print this post

  lizby said  
  georgestheking said  I will add a microcontroller before the Pïcomite to reduce the flux of datas.


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?


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 States
Posts: 414
Posted: 11:21pm 11 Jun 2025
Copy link to clipboard 
Print this post

  mozzie said  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: Australia
Posts: 2537
Posted: 12:46am 12 Jun 2025
Copy link to clipboard 
Print this post

  Quote  INPUT$(n,#c) will wait until n characters have arrived from channel #c won't it?

  Manual, Functions said  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

Edited 2025-06-12 11:25 by phil99
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025