Can't get program to run

For general Flowcode discussion that does not belong in the other sections.
chipfryer27
Valued Contributor
Posts: 1147
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: Can't get program to run

Post by chipfryer27 »

Hi

When I first started with FC all "C" was scary...... However by following examples and with the help of contributors such as Kersing I learned a lot. I'm not a programmer I'm a Flowcoder is my description of my limited abilities :)

The chip you are using is a bit more complicated than others regarding oscillator features and functions and as I don't have one to hand, I can't test the attached but hopefully it should flash at one-second intervals.

In the configuration I set the oscillator to be internal and you will notice that I set the speed to 8MHz too. As Kersing mentions this doesn't actually configure the oscillator for 8MHz, it only tells FC what the clock speed is so that it can then calculate based on such. We still need to actually configure it to run at 8MHz

Capture.JPG
Capture.JPG (54.75 KiB) Viewed 179 times

As we are using the internal oscillator we need to configure the chip to run at our desired speed and we do that by including a piece of "C" right at the beginning of our program.

In the chart I have two components, an LED that with luck will flash, and the Internal Oscillator Helper (found under components > runtime). The helper will assist in creating the required "C"

Under properties you can choose the available options and the helper will generate the required code for you, and also warn of any mismatch issues (you choose 8MHz but Project Options thinks it's 4MHz or the like).

Simply copy this code and place it in a C-Code Block at the very start of your chart.


Capture2.JPG
Capture2.JPG (85.39 KiB) Viewed 179 times

All being well your chip will now run at 8MHz and all timing delays etc will be as expected.

Flash_25K50.fcfx
(10.23 KiB) Downloaded 22 times
Hope this helps.

Regards

Post Reply