Page 1 of 1

idea of a function, please

Posted: 19 Jan 2024 16:01
by HyperUniverse
Hi,

I need help with a function.

I have DATA incoming in such format:

Code: Select all

&11 99EA37E2637A11A2720B99184C2683D607104EC7B6165300180124;
start character is always &
end character is always ;
in between everything can change, including its length

I want to save this DATA in SPI_RAM, but only the last 12 strings received.
As the transmissions keep coming I need a function to delete the older recorded string in SPI_RAM and replace it with the new incoming one.

I know that this string has always got a unique number at location[2] in a hex format, between 1 and C (12 numbers in total),
And I know there is always time and date stamped into the string at its end, for the above example: time = 16:53:00, and date = 18/01/24

Code: Select all

165300180124
Can someone give me an idea on how to do it?

So I need to keep all 12 strings in memory at all times, but update and delete just one (the oldest) and replace it with the new incoming one.

thanks,
Regards

Re: idea of a function, please

Posted: 24 Jan 2024 14:06
by IvanJeremic
Hi,

Sorry for the delay.

You can try using strchr function from the compiler.
image.png
image.png (14.36 KiB) Viewed 384 times
Regards,

Ivan.

Re: idea of a function, please

Posted: 24 Jan 2024 16:45
by HyperUniverse
I'm sorry, but how's that strchr going to help me achieve what I want?

Re: idea of a function, please

Posted: 25 Jan 2024 12:12
by IvanJeremic
Hi,

This function will help you get the data that you want if you know what to look for.

We do not have a function that does all that you specified, so all the rest needs to be written.

Note that our support does not include us writing custom projects for our customers.

Regards,

Ivan.

Re: idea of a function, please

Posted: 25 Jan 2024 14:24
by HyperUniverse
If you could re-read my original post,
I didn't ask anyone to write any code for me.

All I asked is someone to give me an idea on how to do it.


You pointing me to strchr , is prety lame, as this function is NEVER going to do what I asked in my original post.