Page 1 of 1

RXD last character received

Posted: Mon Sep 30, 2013 12:34 pm
by AMDlloydsp
Bruce,
Is there a memory location for BASIC to sample holding each Uart's last-character-received (so, also, to be able clear it) WITHOUT fetching characters from the RX buffer?

I'd like to be able to ignore messages coming in until a terminating character is received.
Of course, I can fetch them into a local buffer as received, but that's just more overhead code I'd like to avoid.

something like:
If (UART1Lastchr = LF) then
gosub fetch_the_Uart1_buffer
UART1Lastchr = -1
endif
...
go onward
...

Thanks,
Lloyd

Re: RXD last character received

Posted: Mon Sep 30, 2013 9:33 pm
by basicchip
No, there is no equivalent of ungetc to a serial channel.

While in theory all that is in memory, there is no standard way to do that between boards, and firmware revisions (though I doubt there will be any firmware versions any time soon).

I've often done the equivalent of gets, and it is not really that much overhead.

Re: RXD last character received

Posted: Mon Sep 30, 2013 10:00 pm
by AMDlloydsp
Thanks,
You're right that it's not a lot of additional overhead, but it's some, and although I have tons of code space left, arrays and matrices are bumping me up against my variables limits. I guess I'll have to start storing those in flash, rather than as variables.

I have not looked at all the memory maps of all your processors. If there is any common memory across models, a pointer in common RAM would allow such to be done across all firmware revisions and models of the board (but you knew that <G>). Just a thought for future revs. No big issue.

Lloyd

Re: RXD last character received

Posted: Mon Sep 30, 2013 10:15 pm
by basicchip
On the SuperPRO there is a 16K bank of SRAM at &H2007C000 that is not used by BASIC, mainly because it is not contiguous with the SRAM at &H10000000. You can access that through pointers.

One fault I have with NXP is that there is almost no consistency of memory maps between parts.