Display Text characters stored in Bytes in the ScratchPad Ram ?

zorgloub

Member
Hello to the team,

I have a sequence of bytes, representing text characters, stored in the ScratchPad-Ram.

Example: (71,97,114,97,103,101) ----> "Garage"

So I would "just" display them on the terminal (Sertxd ...)

1) I try this but I have a syntax error because the bintoAscii command does not seem to be used here.

For ptr = 1 to 6 'indexing the ScratchPad pointer. (The text to display starts at ptr = 1)
Sertxd (bintoAscii (@ptrinc)) '---> Syntax Error!
Next ptr

In fact, it would take a trick of command like “Bin to Character” :confused:

2) Is it possible to know the number of bytes present in this ScratchPad? (To replace the value 6 by the number of characters present to be displayed)

3) Is there a command to erase the ScratchPad?

Thank you for your help.
 

hippy

Technical Support
Staff member
1) I try this but I have a syntax error

Sounds like you need to use @ptr -

For ptr = 1 To 6 : SerTxd( @ptr ) : Next


2) Is it possible to know the number of bytes present in this ScratchPad? (To replace the value 6 by the number of characters present to be displayed)

No. You either need to keep track of how many bytes are in the scratchpad, possibly by a length indicator in scratchpad, or add a terminating byte to show where the bytes end.


3) Is there a command to erase the ScratchPad?

ptr = 0 : Do : @ptrInc = 0 : Loop Until ptr = 0
 

zorgloub

Member
Hi Hippy,

I had just successfully tried this code:
For ptr = 1 to 6: sertxd (@ptr): next ptr
I had tried without much conviction because I thought that the value that was going to be displayed would be returned in DEC ou HEX and not readable character.

Thank to Texasclodhopper also.
I will read also ...

Anyway, thanks for your promptness!

This forum is a gold mine.
Long life !
 
Last edited:

lbenson

Senior Member
To clarify (if this does), in your example, 71 is the ASCII numerical value for the letter "G", which display devices which use the ASCII character set will display when they are told to display 71. See http://www.asciitable.com/

You will see that all of your numbers represent ASCII characters.

You could make it clearer if, instead of (71,97,114,97,103,101), you had ("G","a","r","a","g","e"), but the clever and useful lookup code which Texasclodhopper links to is better still.
 

Buzby

Senior Member
Is it critical that your bytes are stored in scratchpad ?

Using sertxd("Garage") takes up a little more prog space, and is less flexible, but it is so much easier to implement and understand.
 

zorgloub

Member
Hi Buzby,
Thank you for your interest in my initial question.
In fact, I needed a process of processing and displaying a text message for use in a more complex program managing 2.4Ghz RF communications with a nRF24L01 + module.
Everything is now at the point. YESS :))
But there is surely always way to improve !
If it interests the forum look at: http://www.alpmn.byethost32.com/nrf24l01p.htm
Thank you all.
 
Top