Page 1 of 1

Random doesn't work.

Posted: Thu Jul 15, 2010 3:42 pm
by wtulp
Hello,

I have the following question:
- the random-function doesn't work in my program
- in the attachment (random.fcf) is a loop that waits for a press of switch SW0
- while the switch is not pressed a random number is generated (variable rnd)
- when the switch is pressed the variable rnd is displayd on the lcd-display

In the Supplementary Code i have set:
#include <rand.h>

The parameters in Linker: (Compiler Options)
-ld "C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\lib" libc.pic16.lib flowcode.pic16.lib float.pic16.lib rand.pic16.lib "%f.obj" -t PIC%p -d "%d" -p "%f"

I have the E-Blocks Multiprogrammer EB-006-00-7 with Flowcode4
My processor is PIC16F877a

Can somenone help me please!!


W. Tulp
random.fcf
random
(6 KiB) Downloaded 276 times

Re: Random doesn't work.

Posted: Fri Jul 16, 2010 8:32 am
by Benj
Hello,

I have changed your C code for the Flowcode supported random function and this is now working correctly.

Re: Random doesn't work.

Posted: Fri Jul 16, 2010 10:26 am
by wtulp
Thanks,

It works very fine now.