Announcing the development of LIBSTOCK - Your place for code

Here you can find latest news on mikroElektronika products.
Author
Message
Vladimir_C
Posts: 89
Joined: 06 Dec 2009 11:10
Location: Moscow

Re: Announcing the development of LIBSTOCK - Your place for

#46 Post by Vladimir_C » 20 May 2011 08:25

Hello
When your site is working?

henock
Posts: 2
Joined: 20 May 2011 09:39

i have very many question

#47 Post by henock » 20 May 2011 09:55

anikolic wrote:
SesechXP wrote:Great idea!

I've some questions:
- what license?
- only projects or libraries compiled whith Mikroelektronika compilers?
No. Not only with our compilers. We are going to have a better support for our compilers, because it will be much easier to deliver your projects as a package made with our Package manager. But, we will enable people to post whatever they want: projects built with other compilers will be allowed, of course.

henock
Posts: 2
Joined: 20 May 2011 09:39

Re: Announcing the development of LIBSTOCK - Your place for

#48 Post by henock » 20 May 2011 09:59

/******************************************************************************\
* *
* P R E P R O C E S S O R D I R E C T I V E S *
* *
\******************************************************************************/

#include <16F877A.h> // PIC Model: 16F877A

#device *=16 ADC=10 // Use 16-bit pointers, use 10-bit ADC

#fuses HS // Set the configuration bits for the PIC
#fuses NOWDT
#fuses NOPROTECT
#fuses NOLVP
#fuses NODEBUG
#fuses NOPUT
#fuses NOBROWNOUT

#use delay(clock=20000000) // Clock Speed = 20 MHz

// These require use of Set_Tris_x()
#use fast_io(B)
#use fast_io(D)
#use fast_io(A)
#use fast_io(C)

// End Preprocessor Directives

#include "Include\Compiler.h"
#include "Include\Globals.h"

/******************************************************************************\
* *
* F U N C T I O N P R O T O T Y P E S *
* *
\******************************************************************************/

void buzzerOn( void); // activates the buzzer
void buzzerOff( void); // deactivates the buzzer
void lightOn( void); // turns lights on
void lightOff( void); // turns lights off
void vibrOn( void); // turns vibrator on
void vibrOff( void); // turns vibrator off
void deactivate( void); // deactivate all alarms
int32 setDanger( int32 eye_plus_head); // function to set the danger level

/******************************************************************************\
* *
* M A I N R O U T I N E *
* *
\******************************************************************************/

#pragma zero_ram // clears memory not used by the program
void main( void)
{

eye_close = 0; // These are globals defined in globals.h
head_tilt = 0;
danger_level = 0;
event_log = 0;
eye_blink = 0;
i = 0;
compare = 0;
rate_1 = 0;
rate_2 = 0;
rate_total = 0;
first = 0;
total = 0;
caution = 0;
alarm = 0;

disable_interrupts(GLOBAL); // disable the interrupt

delay_ms(500); // wait for voltages to stablize

Set_Tris_A(MY_TRISA); // Port A's I/O
Set_Tris_B(MY_TRISB); // Port B's I/O
Set_Tris_C(MY_TRISC); // Port C's I/O
Set_Tris_D(MY_TRISD); // Port D's I/O

output_low(DANGER_0);
output_low(DANGER_1);

while(FOREVER)
{

// turn off the alarms
buzzerOff();
vibrOff();
lightOff();

// ********************* Calibration **********************

if(input(DATA_EYE))
{
output_high(EYE_TEST);
}
else
{
output_low(EYE_TEST);
}

while (input(ACTIVE)) // Do not run if user is alert
{
// Set the danger level

if (event_log > 200)
event_log = 200;

danger_level = setDanger(event_log);

// ******************* Danger Level Outputs ***********************

if (danger_level == 0)
{
output_low(DANGER_0);
output_low(DANGER_1);
}
else if (danger_level == 1)
{
output_high(DANGER_0);
output_low(DANGER_1);
}
else if (danger_level == 2)
{
output_low(DANGER_0);
output_high(DANGER_1);
}
else if (danger_level == 3)
{
output_high(DANGER_0);
output_high(DANGER_1);
}


// ************************ Data Input ****************************

if (input(DATA_EYE))
{
eye_blink++; // blink rate counter
if (alarm == 0)
event_log+= 2; // event logger, does not get reset
eye_close++; // local logger, resets after user responds
}
else
eye_close = 0;
if (input(DATA_TILT))
{
if (alarm == 0)
event_log+= 2; // event logger, does not get reset
head_tilt++; // local logger, resets after user responds
}
else
head_tilt = 0;

// reset i if an even occurs or increment if no events occur
if (input(DATA_TILT) || input(DATA_EYE))
i = 0;
else
i++;
if (i == 2 && danger_level != 0)
{
event_log-=2;
i = 0;
}


// ****************** Alarm Activation Controls *******************

if (input(RESPONSE))
{
deactivate();
delay_ms(100); // software debounce
}
else
{
if (total % 40 == 0 && total >= 40) // 10 seconds
{
first++;
rate_1 = eye_blink;
eye_blink = 0;
rate_2 = rate_1 + rate_2;
rate_total = rate_2 / first;
caution = 1;
}
if (2 * rate_1 > 3 * rate_total && caution == 1)
{
vibrOn();
delay_ms(3000);
vibrOff();
caution = 0;
}

// total the number of events occuring in this cycle
eye_plus_head = eye_close + head_tilt;
eye_plus_head = eye_plus_head/4;

if (eye_plus_head <= (4 - danger_level))
{
vibrOff();
buzzerOff();
lightOff();
}
else if (eye_plus_head > (4 - danger_level) && eye_plus_head < (7 - danger_level))
{
vibrOn();
}

else if (eye_plus_head >= (7 - danger_level) && eye_plus_head < (10 - danger_level)) // head and eye sensors high for 3 seconds
{
vibrOn();
buzzerOn();
}

else
{
vibrOn();
buzzerOn();
lightOn();
}
total++;
}


// delay 1 second
delay_ms(250);
// delay_ms(250);
// delay_ms(250);
// delay_ms(250);
}
}
}




/******************************************************************************\
* *
* F U N C T I O N S *
* *
\******************************************************************************/

// Alarm activation functions

void buzzerOn( void)
{
output_high(OUT_AUD);
alarm = 1;
}

void buzzerOff( void)
{
output_low(OUT_AUD);
alarm = 0;

}

void lightOn( void)
{
output_high(OUT_VIS);
alarm = 1;
}

void lightOff( void)
{
output_low(OUT_VIS);
alarm = 0;
}

void vibrOn( void)
{
output_high(OUT_VIB);
alarm = 1;
}

void vibrOff( void)
{
output_low(OUT_VIB);
alarm = 0;

}

void deactivate( void)
{
output_low(OUT_VIB);
output_low(OUT_VIS);
output_low(OUT_AUD);

eye_close = 0;
head_tilt = 0;
}

int32 setDanger( int32 events)
{
if (events < 50)
return 0;
else if (events > 49 && events < 100)
return 1;
else if (events > 99 && events < 150)
return 2;
else
return 3;
}

// End of alarm activation functions

johnti
Posts: 1
Joined: 23 May 2011 11:08

Re: Announcing the development of LIBSTOCK - Your place for

#49 Post by johnti » 23 May 2011 16:52

Is libstock already online?

Will it be a free source for code?
How to unlock wii - play free homebrew games

CVMichael
Posts: 239
Joined: 30 Apr 2009 02:36
Location: Canada, Toronto

Re: Announcing the development of LIBSTOCK - Your place for

#50 Post by CVMichael » 24 May 2011 13:57

henock,

Just "dumping" your code here won't do anything.

First of all, this is not LIBSTOCK, but let's say it was.
You also have to provide more information about the code. Like what is it used for? A schematic would also be very useful.
Also, the code you posted is not for mikroC, so you should convert it first, before you post it.

I think one of the reasons why we would need LIBSTOCK, is to prevent things like this. (to be more organized)

The_PinkFloyd_67
Posts: 110
Joined: 26 Mar 2011 10:45

Re: Announcing the development of LIBSTOCK - Your place for

#51 Post by The_PinkFloyd_67 » 26 May 2011 07:27

I agree with other users about only providing libraries that are directly usable with MikroElektronica development compilers. This would be much less confusing, and much more useful to MikroElektronika customers.
I keep checking the website daily, hoping to see a "We are now open" message. :wink:

Muphy
Posts: 318
Joined: 24 Feb 2008 14:05
Location: Stonehaven Scotland

Re: Announcing the development of LIBSTOCK - Your place for

#52 Post by Muphy » 01 Jun 2011 11:59

Still pretty new around here but wanted to think out loud (and get some comments please) about my thoughts regarding LIBSTOCK.

As both a software and hardware engineer, I have hoardes of cool bits and often I want a way to dispose of them at the same time earning some money to buy new cool bits. For instance, I have a small number (circa 100) of a pretty nice mono graphic LCD with backlight. I've written a Library to control the LCD and I've used it a few times to build prototypes for prospective customers.

My thinking is that I could offer the library for free and provide a link to my website where the display could be purchased should the user wish to do so. That way I realise something for the effort I have put into the library, the user gets a nifty library and if they want to, an LCD however they are still free to source the LCD elsewhere should they wish to.

The "contract" for the purchase is then with me and the purchasor, mE is not involved in the transaction and provided they have a simple disclaimer on their website, mE have no legal encumbrance.

I'm fortunate to have a close friend who is a partner in a corporate law firm and her informal opinion is that within the EU, this is correct. With recent events in Serbia/The Hague accession to the EU for Serbia may happen as soon as December 2011 however the SAA agreed a couple of years ago can suffice until accession.

Lastly, any update as to when LIBSTOCK will be live???


Rgds,

M

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Announcing the development of LIBSTOCK - Your place for

#53 Post by janni » 02 Jun 2011 17:24

Muphy wrote:Lastly, any update as to when LIBSTOCK will be live???
Yeah, I'm sure everyone is interested and some, apparently, cannot wait any longer and post code :wink: .
My thinking is that I could offer the library for free and provide a link to my website where the display could be purchased should the user wish to do so. That way I realise something for the effort I have put into the library, the user gets a nifty library and if they want to, an LCD however they are still free to source the LCD elsewhere should they wish to.
It'd be up to mE to decide, but I don't see a reason it could be viewed as something endangering mE's interests in the long run - anything attracting people to mE products should be acceptable. Naturally, competetive products' adds will most probably not be welcomed.

Contrary to some opinions expressed here, I do not see anything wrong in letting somebody, that develped a project useful to many others, to earn some virtual or real money to be able to buy hardware for next useful projects.

Libstock is supposed to be a place where people share partly or fully develped projects - their projects, frequently results of many hours of work. Whether for free or for a small fee, these projects will still in practice be given away for others to use - if they want them. One can hardly compare it to asking for payment in response to a plea for help :roll: . Even small rewards are motivating - projects that could otherwise never be finished or seen by others, may surface here because their developers will feel appreciated.

Certainly, some form or other of monitoring what's offered should be implemented - it may be community judgement, or moderators, or both. Like everywhere, abuse may happen also to Libstock. Still, that's no reason to abandon any form of project offering.

lewis.michel
Posts: 1
Joined: 14 May 2011 22:50

Re: Announcing the development of LIBSTOCK - Your place for

#54 Post by lewis.michel » 04 Jun 2011 17:40

compiler creates a bug? it creates a problem. right?

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

Re: Announcing the development of LIBSTOCK - Your place for

#55 Post by Mince-n-Tatties » 07 Jun 2011 10:37

Muphy wrote: As both a software and hardware engineer, I have hoardes of cool bits and often I want a way to dispose of them at the same time earning some money to buy new cool bits. For instance, I have a small number (circa 100) of a pretty nice mono graphic LCD with backlight. I've written a Library to control the LCD and I've used it a few times to build prototypes for prospective customers.

My thinking is that I could offer the library for free and provide a link to my website where the display could be purchased should the user wish to do so. That way I realise something for the effort I have put into the library, the user gets a nifty library and if they want to, an LCD however they are still free to source the LCD elsewhere should they wish to.
I feel this is at the heart of the libstock ethos. I interpreted one of the comments made by mE as,
the idea is to provide a mechanism to expand the compilers coverage with ready to run code targeted at specific IC’s / controllers / LCD’s etc (the list is possibly inexhaustible) which mE would not have individual exposure nor reason to provide example for.

I feel that a fee for both the library and allowing a link to the individual’s external website for sales would be acceptable for this specific type of offering.

I do still feel there needs to be a subdivision on libstock, closed libraries for sale and open source libraries for sale/donation.
Best Regards

Mince

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

Re: Announcing the development of LIBSTOCK - Your place for

#56 Post by Mince-n-Tatties » 07 Jun 2011 11:19

this is a concern i have had with libstock. It is completely possible that by genuine honest mistake authors will include the work of others in a library in part or full and potentially receive financial reward for the efforts of others.

http://www.mikroe.com/forum/viewtopic.p ... 17#p153517
Best Regards

Mince

Muphy
Posts: 318
Joined: 24 Feb 2008 14:05
Location: Stonehaven Scotland

Re: Announcing the development of LIBSTOCK - Your place for

#57 Post by Muphy » 07 Jun 2011 13:14

I guess Mince it's not just a problem for libstock but anywhere that libraries/linkable files are offered. I was horrified this morning when I got a PM from JPC and checking back I can see that he published the code as mPascal back in 2005, I must have changed to C and lost authorship details, In my defence, should I have wanted to obfuscate ownership then I would not have published source.

Back to the matter at hand, I think it inevitable that code from different authors could be combined and offered as a library and it will be up to the individual offering their library to police their own integrity and get the necessary permissions and where appropriate, share the profits but no doubt there will be a very small minority who will attempt to pass the work of others as their own . Funny enough I had another set of USART Interrupt routines written by a cool guy in Hong Kong called John Leung who owns TechToys (I ported from CCS C) and I wrote and asked his permission to publish (and he agreed) but then I found the other code in my SVN repository and it was easier to tidy :(

I think the bottom line is that any code repository offering access to the world must be agnostic of copyright or authorship unless all sales are routed through that organisation. One alternative would be that anyone who wants to sell a library must provide the source to mE to be held in escrow in case there be any question of authorship or copyright. This then puts a big load on mE and may be a disincentive for them to offer libstock.

There is no easy answer I fear!

M

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Announcing the development of LIBSTOCK - Your place for

#58 Post by janni » 07 Jun 2011 14:06

Mince-n-Tatties wrote:this is a concern i have had with libstock. It is completely possible that by genuine honest mistake authors will include the work of others in a library in part or full and potentially receive financial reward for the efforts of others.

http://www.mikroe.com/forum/viewtopic.p ... 17#p153517
Yes, such things as in the example may and will happen as people frequently save code snippets without storing references to authors or simply learn on examples presented on web sites, in books, or wherever. When they later share they knowledge on other or same forums the original authors either feel pride or are unnerved, depending on their disposition or the way their code was presented. Still, the authors may always protest or point to the original post so the harm is not that big.

Using free code for commercial purposes is a different matter. It would be naive to think that freely distributed code is not used in commercial products and authors of free code rarely know where their code was used. At least some on mE forums, while admiting doing it, express their thanks to code authors - and the latter do not protest as they are fully aware of such possibility. Libstock will be least worry in this respect being controllable to some extend. This specific kind of abuse, when free code without much alteration is offered for sale, when discovered will put an odium on the offerent that will be very hard to discard. It may happen, there are enough both evil-minded and stupid people in this world, but I doubt it's a significant danger.

joseLB
Posts: 444
Joined: 02 Apr 2006 05:56
Location: Riode Janeiro, Brasil

Re: Announcing the development of LIBSTOCK - Your place for

#59 Post by joseLB » 09 Jun 2011 03:00

janni wrote:[es, such things as in the example may and will happen as people frequently save code snippets ....
Hi Janni
You are one of the best examples on this forum of such giving. Besides your "replacement routines" you always gave much more than received. To us directly (users) and to us indirectly (hard work helping ME improve MP). I fact you and Danny are my "idols"...

In my specific case, when I was starting with PICs, some years ago, I was fighting with sometime writes/no writes in 16F628A EEPROM.... Maybe you do not remember, but you helped me in 2 ways:
1- made a 16F EEPROM write routine for me
2- advised me about decoupling capacitors and cares with Vcc/GND track designs.
After that, that project and all others didn't gave anymore this kind of problem (of course, I could not live without problems, so I create others :lol: ) This to not mention other helps you gave me and to othes.
In resume, I think all this discussion is very positive, BUT, at the end, the ones that would like to give will give, and others will use. This balance never will be equal for everyone.

So, if ME is ready to put it to work (as a free and SIMPLE place for code), why not to do it asap? Later, if the case, think about other issues.
Jose

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Announcing the development of LIBSTOCK - Your place for

#60 Post by janni » 09 Jun 2011 13:46

joseLB wrote:... at the end, the ones that would like to give will give, and others will use. This balance never will be equal for everyone.
Exactly :) . There are many people ready to help and share on mE forums (including you, Jose, as well as many of those contributing to this discussion :) ) so Libstock's future looks bright.
So, if ME is ready to put it to work (as a free and SIMPLE place for code), why not to do it asap? Later, if the case, think about other issues.
Again, my thoughts exactly :) .

BTW, I feel touched by your memory. I also remember that we tried once with a code repository (mikrolib?) - pity it was maintained by a single person and thus didn't survive for long. Libstock, with mE's backing will certainly be kept alive.

Post Reply

Return to “Product Announcements”