How use Random; CALCULATION: A0 = RANDOM()
Simulation is Ok, but when copile, is error (support technical)
RANDOM
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: RANDOM
Hello.
We need a bit more information to help you with this. Which software product are you using (and which version)?
Also, please attach a program to this forum which exhibits this problem.
We need a bit more information to help you with this. Which software product are you using (and which version)?
Also, please attach a program to this forum which exhibits this problem.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: RANDOM
Steve.
You can replicate the issue using latest version of Flowcode V4 (not tried with other versions). Use the Random() function within a calculation box.
You can replicate the issue using latest version of Flowcode V4 (not tried with other versions). Use the Random() function within a calculation box.
Code: Select all
Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F88 "Random Number Error.c"
BoostC Optimizing C Compiler Version 6.95 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday
Licensed to FlowCode User under Single user Pro License for 1 node(s)
Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited
Random Number Error.c
Starting preprocessor: C:\PROGRA~1\MATRIX~1\FLOWCO~2\BoostC\pp.exe "m:\Random Number Error.c" -i C:\PROGRA~1\MATRIX~1\FLOWCO~2\BoostC\include -d _PIC16F88 -la -c2 -o "m:\Random Number Error.pp" -v -d _BOOSTC -d _PIC16
..............
m:\Random Number Error.c(80:19): error: unknown identifier 'rand'
m:\Random Number Error.c(80:19): error: failed to generate expression
m:\Random Number Error.c(80:19): error: invalid operand 'rand()'
m:\Random Number Error.c(80:17): error: failed to generate expression
Random Number Error.c success
failure
Return code = 1
Flowcode was unable to compile the flowchart's C code due to the following errors:
If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.
FINISHED
- Attachments
-
- Random Number Error.fcf
- (3 KiB) Downloaded 337 times
Martin
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: RANDOM
I see the problem. To use the random number function, you will need to add the following line to the "defines" section of the supplementary code:
Code: Select all
#include <rand.h>
-
- Posts: 323
- Joined: Sat Jan 12, 2008 2:08 am
- Has thanked: 106 times
- Been thanked: 48 times
Re: RANDOM

In the future, I write in spanish

Tank you