idea of a function, please

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
HyperUniverse
Posts: 282
Joined: 17 Jun 2009 10:42

idea of a function, please

#1 Post by HyperUniverse » 19 Jan 2024 16:01

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

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: idea of a function, please

#2 Post by IvanJeremic » 24 Jan 2024 14:06

Hi,

Sorry for the delay.

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

Ivan.

HyperUniverse
Posts: 282
Joined: 17 Jun 2009 10:42

Re: idea of a function, please

#3 Post by HyperUniverse » 24 Jan 2024 16:45

I'm sorry, but how's that strchr going to help me achieve what I want?

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: idea of a function, please

#4 Post by IvanJeremic » 25 Jan 2024 12:12

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.

HyperUniverse
Posts: 282
Joined: 17 Jun 2009 10:42

Re: idea of a function, please

#5 Post by HyperUniverse » 25 Jan 2024 14:24

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.

Post Reply

Return to “mikroC PRO for PIC General”