Flowcode / Eblocks problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
pic-newbie

Flowcode / Eblocks problem

Post by pic-newbie »

Hi there, just trying to get my first programs working and have run into a few problems.

I am attempting to use Flowcode (latest version with the latest version of ppp installed) on Windows Vista to send a simple program to a '12F629' chip on my E-Blocks board.

For some reason, even simple programs (such as a single blinking LED) that seem to work perfectly in Flowcode, and that are supposed to execute on Port A on my board do not work correctly when they are being run on the chip. For some reason instead of Port A, they will only work on Port B, and if LED 0 is supposed to be lit, you either get LED 7 lighting instead, or no lit LED's at all.

I've definatley selected the correct chip type in PPP, but I cant seem to get anything to run correctly on the chip outside of Flowcode. The only error messages that I have recieved are...

-------------------------
Program failed

Failed to Restore

OSCCAL (0x3FFF)
-------------------------

And...

-------------------------
Failed to Restore

OSCCAL (0x2867
-------------------------

These errors seemed random and infrequent, simply sending the program to the chip a second time after recieving the errors resulted in it seeming to be sent to the chip without error.

Any ideas as to what might be going on would be much appreciated.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Post by Benj »

Hello

We have a help page for Windows Vista available here.

http://matrixmultimedia.com/support/viewtopic.php?t=507

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Post by Steve »

The programming pins PGC and PGD (i.e. GP0 and GP1 on the 12F629) are multiplexed with the RB6 and RB7 i/o lines on the E-Blocks board (because most PICmicros use these pins as programming lines).

I'm not sure why the "programming failed" errors are being reported.

pic-newbie

Post by pic-newbie »

Thanks very much for the replies. Have run in to another odd problem you might be able to solve, I suspect it's quite simple. All i'm trying to do is have a LED turn on for 100 ms, then turn off, followed by a delay, then have the LED turn on for another 100 ms; and so on. I can make this loop without problem so long as the delays between the LED going on, and going off is set with a delay event with a set number of ms. However, I am attempting to have the second delay (the one that delays the LED coming back on) be set by an integer variable.

I have got this working fine in flowcode. Rather than set the second delay to a set amount of ms, I have instead created an integer variable called 'delay1'. Then at the beginning of the program, I set the 'delay1' variable to 100.

This works fine both in flowcode and when running on the chip, however, when I set the variable 'delay1' to any number above 255, it still runs in flowcode but it stops working on the chip. Rather than delaying for the correct amount of time, 300 ms for example, the delay seems to shorten to a fraction of its correct amount.

It seems as if the fact that it is any number above 255 should make the problem obvious, but I have been unable to work it out. I have checked and the variable is definatley set as an INT. (I'm using a 12F629 chip)

Any help is much appreciated.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Post by Benj »

Hello

Yes im afraid that the delay routine requires a number between 0 and 1000. However if you are using a variable then the delay can only handle a maximum of 255. So to create your longer delay you could do the following.

while (int_var > 255)
{

delay_ms(255)

int_var = int_var - 255

}

delay_ms(int_var)

You will have to remember to initialise the int_var variable before each iteration.

pic-newbie

Post by pic-newbie »

Ah I see. That seems a little strange, is there a technical reason why when using a variable, even an integer variable as a time delay, it is limited to 255 ?

What i'm trying to accomplish is a flashing light that slows down exponentially. So it stays on for 100ms each time, but the delay between the flashes slows down on each time through the loop. I got this working fine in flowcode by using the expression "delay1 = delay1 * 2" but of course if delay1 started at 10 ms, it very quickly exceeded 255 and so even though it worked fine in the software, it didn't work on the chip.

Is there a simple way of achieving this ?

Thanks again for your quick response.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Post by Benj »

Yes you can create a main program loop with a variable that gets decremented each iteration. This variable is then copied into the int_var variable from the above example. This way the delay gets shorter and shorter each time,

The reason for a constant working when a variable doesnt is because Flowcode doees some of the processing when a constant is used. This splits the number into blocks of 255 or less. However when a variable is used Flowcode does not know what value the variable will have and therefore cannot split the value correctly.

pic-newbie

Re: Flowcode / Eblocks problem

Post by pic-newbie »

Thanks again for all the help. Having another problem i'm afraid. This time I've made a simple program that works absolutely fine in Flowcode, yet when I attempt to send it to the chip, I am recieving the following catastrophic failure when flowcode attempts to convert it in to C code. If you could take a look i'd very much apreciate it. Thanks again.

Its a 12F628 chip, the full error report is as follows.....


-----------------------------------

Launching the compiler...

C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\boostc.pic16.flowcode.exe -v -t PIC12F629 "ver 0.5.c"

BoostC Optimizing C Compiler Version 6.70 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2007 Pavel Baranov
Copyright(C) 2004-2007 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


ver 0.5.c
Starting preprocessor: "C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\pp.exe" "C:\flowcode\ver 0.5.c" -i "C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\include" -d _PIC12F629 -la -c2 -o "ver 0.5.pp" -v -d _BOOSTC -d _PIC16

C:\flowcode\ver 0.5.c(183:2): error: unknown identifier 'trisa'
C:\flowcode\ver 0.5.c(183:2): error: invalid operand 'trisa'
C:\flowcode\ver 0.5.c(183:8): error: failed to generate expression
C:\flowcode\ver 0.5.c(184:11): error: unknown identifier 'porta'
C:\flowcode\ver 0.5.c(184:11): error: invalid operand 'porta'
C:\flowcode\ver 0.5.c(184:17): error: failed to generate expression
C:\flowcode\ver 0.5.c(184:17): error: invalid operand '& '
C:\flowcode\ver 0.5.c(184:31): error: failed to generate expression
C:\flowcode\ver 0.5.c(184:2): error: error in expression
C:\flowcode\ver 0.5.c(184:2): error: failed to generate expression
C:\flowcode\ver 0.5.c(197:2): error: unknown identifier 'trisa'
C:\flowcode\ver 0.5.c(197:2): error: invalid operand 'trisa'
C:\flowcode\ver 0.5.c(197:8): error: failed to generate expression
C:\flowcode\ver 0.5.c(202:10): error: unknown identifier 'porta'
C:\flowcode\ver 0.5.c(202:10): error: invalid operand 'porta'
C:\flowcode\ver 0.5.c(202:16): error: failed to generate expression
C:\flowcode\ver 0.5.c(202:16): error: invalid operand '& '
C:\flowcode\ver 0.5.c(202:30): error: failed to generate expression
C:\flowcode\ver 0.5.c(202:30): internal error: failed to generate 'while' expression
C:\flowcode\ver 0.5.c(202:2): error: error in 'while' loop statement
C:\flowcode\ver 0.5.c(216:2): error: unknown identifier 'trisa'
C:\flowcode\ver 0.5.c(216:2): error: invalid operand 'trisa'
C:\flowcode\ver 0.5.c(216:8): error: failed to generate expression
C:\flowcode\ver 0.5.c(221:10): error: unknown identifier 'porta'
C:\flowcode\ver 0.5.c(221:10): error: invalid operand 'porta'
C:\flowcode\ver 0.5.c(221:16): error: failed to generate expression
C:\flowcode\ver 0.5.c(221:16): error: invalid operand '& '
C:\flowcode\ver 0.5.c(221:30): error: failed to generate expression
C:\flowcode\ver 0.5.c(221:30): internal error: failed to generate 'while' expression
C:\flowcode\ver 0.5.c(221:2): error: error in 'while' loop statement
ver 0.5.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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Flowcode / Eblocks problem

Post by Benj »

Hello

Please try replacing the 12F629.fcd file with the attached file. The fcd file is located inside the Flowcode V3/fcd directory.

If this does not solve the problem then try upgrading to the latest version of Flowcode. V3.2.2
Attachments
12F629.fcd
(4.36 KiB) Downloaded 427 times

pic-newbie

Re: Flowcode / Eblocks problem

Post by pic-newbie »

Hi again. I've replaced the fcd file and made sure i'm running the latest version of flowcode. I'm afraid the problem remains unchanged however.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Flowcode / Eblocks problem

Post by Benj »

Hello

Please you email me your code and I will make sure that it is not that which is causing the problems. My address is ben@matrixmultimedia.co.uk

pic-newbie

Re: Flowcode / Eblocks problem

Post by pic-newbie »

Thanks Ben, I've sent the email now, the subject line is "Dice program error check" and its coming from audrey@keystone-design.co.uk.

All the best.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Flowcode / Eblocks problem

Post by Benj »

Hello Audrey

Thanks I have received your file and found the problem.

Hopefully this should be fixed with the next release of Flowcode.

In the mean time you can add the following to your Supplementary code available from the Edit menu.

#define porta gpio
#define trisa trisio

Post Reply