Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:52 29 Nov 2024 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 : Picomite-read serial buffer contents without inputing the data?

Author Message
k2backhoe
Regular Member

Joined: 04/12/2021
Location: United States
Posts: 46
Posted: 09:24pm 24 Apr 2023
Copy link to clipboard 
Print this post

I am currently running Picomite Ver 5.07.06, but I can switch to another version if that enables my request.

Can I read contents of the serial port receive buffer without using an INPUT$ command?  I would like to read a line at a time, so only use the INPUT$ command when I know that there is a termination character (CR/LF) in the buffer.  I understand I can learn the number of characters in the buffer with LOC(), but the only way I see to get the data is to destructively read it into a string.

I could do this with a software buffer where I INPUT$ every character as it arrives, but this seems wasteful.  I would be buffering the buffer.  I would like some function like INBUF$(37, #3) to return the byte value of the 37th byte in the input buffer associated with the COM port opened as #3.

Tell me if I am missing something obvious please?

Ken
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3152
Posted: 11:58pm 24 Apr 2023
Copy link to clipboard 
Print this post

The PicoMite manual does not mention this feature, but for the MX170, the manual says this: "For example, if the following was used "COM1: 300, 256, MyInt, =13" the interrupt subroutine will be called when carriage return character (ASCII value of 13 decimal) was received."

It might be worth a try--maybe it's an undocumented feature (and just in time to be documented in the new release).

Otherwise, buffering the buffer would seem to be the obvious thing to do. This seems like the kind of goal better achieved in the user program than in the firmware (although Geoff apparently felt otherwise earlier--I seem to recall that Grogster made this request).
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2140
Posted: 01:03am 25 Apr 2023
Copy link to clipboard 
Print this post

"The PicoMite manual does not mention this feature,"

The ArmMiteF4 manual also does not mention that so perhaps it is only PIC32s that can do that.
The bulk of the Serial Comms section is copied from the MM2 manual so its removal is probably for a reason.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3196
Posted: 01:50am 25 Apr 2023
Copy link to clipboard 
Print this post

From what I remember, setting an interrupt character did not make it into the PicoMite.  It was a little used feature anyway.

But what is wrong reading the serial stream a character at a time?  How is that wasteful?  The PicoMite is not doing anything useful anyway - most of the time it is just spinning in a loop.  Servicing an interrupt and inserting the character in a buffer would take a few tens of microseconds and there is plenty of RAM for the buffer.  Your main program would never notice it.

Geoff
Geoff Graham - http://geoffg.net
 
k2backhoe
Regular Member

Joined: 04/12/2021
Location: United States
Posts: 46
Posted: 02:00am 25 Apr 2023
Copy link to clipboard 
Print this post

'Nuff said, thanks.  I will make a software buffer routine.

k2
 
Print this page


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

© JAQ Software 2024