Do you need a truly random delay or just a jitter on the average
value? Truly random is actually tricky, and most applications are
quite happy with a pseudorandom value. You can implement a
deterministic  but randomly wandering value simply by code like this:

    static int seed = 1234;
    ...
   TACCR0= 3000+(seed%1866) ;         // values between 3000 and 4865,
average 3933 i.e. 3 seconds +- moreless 1s
    seed += 3989;                                       // should be
prime or at least not have a low LCM wrt. the module

On Tue, Jun 4, 2013 at 3:14 PM, ravim <ravi.mandl...@gmail.com> wrote:
> Hi Everyone,
>
> I am a newbie to msp430 world. I am currently working on a simple
> ez430-rf2500 project.  This is my current timer code.
>
> void initializeTimer(){
>
>     BCSCTL3 |= LFXT1S_2;
>     TACCTL0 = CCIE;
>     TACCR0= 3933 ;            //goes for 3seconds
>     TACTL = MC_1 | TASSEL_1 | ID_3;
>
>   }
>
> Everything works fine. The timer interrupt evokes every 3 seconds and a
> radio packet is sent. Now I want to introduce a 500-1000 ms second random
> delay. I already tried using TI's random generation library. For some
> reason, unfortunately I could not make the .s43 library to work on mspgcc. I
> searched forum but did not find anything which I could use of. I might have
> missed. I would really appreciate if some one could direct me to a good
> approach. I need a random delay in sending packets. I am using ez430-RF2500
> devices. I would really appreciate guidance on this.
>
> Regards
>
> Ravi
>
>
>
> --
> View this message in context: 
> http://msp430-gcc-users.1086195.n5.nabble.com/Introduce-Random-Delay-in-Timer-tp6703.html
> Sent from the MSP430 gcc - Users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> How ServiceNow helps IT people transform IT departments:
> 1. A cloud service to automate IT design, transition and operations
> 2. Dashboards that offer high-level views of enterprise services
> 3. A single system of record for all IT processes
> http://p.sf.net/sfu/servicenow-d2d-j
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to