Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
New Application Note - Sharing Data Between Tasks

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 19 January 2006, 0:54 AM    Post subject: New Application Note - Sharing Data Between Tasks Reply with quote

There is a new application note available describing some techniques for safely sharing data between tasks.

AN210 Sharing Data Between Tasks


Last edited by dkinzer on 25 January 2007, 23:16 PM; edited 1 time in total
Back to top
spamiam



Joined: 13 Nov 2005
Posts: 664

Posted: 19 January 2006, 20:26 PM    Post subject: Re: New Application Note - Sharing Data Between Tasks Reply with quote

dkinzer wrote:
There is a new application note available describing some techniques for safely sharing data between tasks.

AN210 Sharing Data Between Tasks


This is a great note on a surprisingly non-intuitive subject.

Just yesterday this issue hit me between the eyes. I was doing some interrupt driven data transmission (over some I2C hardware). I would fill a buffer then start the transmission, then move on to the next data. I would then transmit this one.

I thought that I had told the transmission routine to be sure that the last one was done before it started the next. And I did.... But....

I was filling the buffer before I did the check. Unfotunately, this buffer was also being used to transmit the data! I had sidestepped using a buffer of my own in addition to the transmit buffer in order to save RAM. I just interracted directly with the transmit buffer.

I couldn't understand why the FIRST data write worked, and all the data reads worked, but none of the data writes that happened sequentially after the first. The read functions did reliably wait for the system to go idle.

After checking everything else, I suddenly realized that I was corrupting the data buffer!

I simply added a check of the flag showing a transmission was in progress and the problem was solved. I wasted a lot of time on that one.

Excellent Appnote.

-Tony
Back to top
mikep



Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX

Posted: 19 January 2006, 20:38 PM    Post subject: Reply with quote

Thanks for the feedback. It's always nice to get it - positive or negative.

I have wanted to write something like this for BasicX but never quite got to it. Now I have finally. I'm also in the process to doing some changes so that it can be also used by BasicX users.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group