Hey there,
I've started a project I was working on last summer again.
But my old brain sometimes jumps from here to there.
I don't know what I was doing at that time
The project I was working on did almost what I wanted, but then failed and because of other priorities I left it alone all this time.
The one thing I always struggle is the use of the circular buffer.
- My project receives via RS232 data on it's RX pin from a wireless device.
- After a while, after first receiving data, a certain pin on the wireless device pin goes low (as a sign that there is data being received) after a few ms.
- I want to store the data the Arduino receives in a variable (text) on which I can act later.
But the problem is that the CB doesn't work like I expect to.
I can't seem to get it working.
Is there anyone that can make an example that does the following?
As soon as there is data on the RX pin (interupt?) the data gets stored in a circular buffer.
As soon as the data stops, and a certain IO pin goes back high, there is time to search the CB for a string (let"s say the string "start") and returns the 15 next positions from the CB as a string.
So this is what it should do.
1- First data is received on the RX pin
2- Store data in CB
3- Meanwhile a certain pin is low on a connected device.
4- Keep reading data until the datastream stops and put this in the CB
5- A few ms after the last received data the IO pin goes high again.
6- Now the CB has to be searched for a specific search string (let's say "start")
7- The data after the first instance for this search string should be stored in a textstring (the next 15 positions in the CB)
8- This textstring should be ready to act on.
9- Maybe the buffer must be flushed after this action
Is there anyone that can make an example for me to study?
I need to find out the right structure to work with the CB and get the data in a string variable.
Thanks for your help
REQ help: circular buffer
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: REQ help: circular buffer
Hello,
How about something like this as a starting point.
How about something like this as a starting point.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
- Contact:
Re: REQ help: circular buffer
This looks great!Benj wrote:Hello,
How about something like this as a starting point.
CB_Demo.fcfx
I'm going to study it and implement it in my project!
Thanks BenJ
-
- Valued Contributor
- Posts: 618
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 184 times
- Been thanked: 195 times
- Contact:
Re: REQ help: circular buffer
Hi MJU
I'm guessing this is a follow up on the module you were using last summer? I knocked up a circuit using those modules and could pass data between without much issue, searching the CB for my target data.
Making my way back home now (rather troublesome in current climate) so if you are still needing help I can dig out the code I used with the modules, but it won't be until the middle of the week-ish. If I remember correctly there were a couple of module setup issues that caused a bit of fun, but no show stoppers.
Regards
I'm guessing this is a follow up on the module you were using last summer? I knocked up a circuit using those modules and could pass data between without much issue, searching the CB for my target data.
Making my way back home now (rather troublesome in current climate) so if you are still needing help I can dig out the code I used with the modules, but it won't be until the middle of the week-ish. If I remember correctly there were a couple of module setup issues that caused a bit of fun, but no show stoppers.
Regards
-
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
- Contact:
Re: REQ help: circular buffer
Thank you for your offer!chipfryer27 wrote:Hi MJU
I'm guessing this is a follow up on the module you were using last summer? I knocked up a circuit using those modules and could pass data between without much issue, searching the CB for my target data.
Making my way back home now (rather troublesome in current climate) so if you are still needing help I can dig out the code I used with the modules, but it won't be until the middle of the week-ish. If I remember correctly there were a couple of module setup issues that caused a bit of fun, but no show stoppers.
Regards
It's true I've started with the E32 module again.
After months of other priorities.
I've used the example BenJ posted and it works.
I'm a weird kind of Flowcode user. I can work weeks on a project and then leave FC for months.
Now I've made progression and because of the strange times we live in, I've got some time to work on it somewhat further.
I hope I still can make use from your offer if I don't succeed?
Thanks again!
-
- Valued Contributor
- Posts: 618
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 184 times
- Been thanked: 195 times
- Contact:
Re: REQ help: circular buffer
Hi
Just got back.
I know what you mean by starting and then leaving alone for a while. Due to business commitments I can be "all over" the forum for a few days or so then nothing for a month or two. I can usually drop in now and again but as I don't usually have FC with me I am limited in any response.
I get the feeling that there will be a lot of forum activity over the next few weeks due to circumstance. I have plans to familiarise and play with components / licenses I haven't yet got around to using so no doubt I'll be looking for all the help I can get
If I can be of help, just shout.
Regards
Just got back.
I know what you mean by starting and then leaving alone for a while. Due to business commitments I can be "all over" the forum for a few days or so then nothing for a month or two. I can usually drop in now and again but as I don't usually have FC with me I am limited in any response.
I get the feeling that there will be a lot of forum activity over the next few weeks due to circumstance. I have plans to familiarise and play with components / licenses I haven't yet got around to using so no doubt I'll be looking for all the help I can get
If I can be of help, just shout.
Regards