simple programme for AT Tiny45 dont works

For general Flowcode discussion that does not belong in the other sections.
rapid
Posts: 8
http://meble-kuchenne.info.pl
Joined: Sat Sep 11, 2021 7:18 pm

simple programme for AT Tiny45 dont works

Post by rapid »

Hello,
I am getting acquainted with Flowcode9.2
I have written a simple program for AT Tiny45.
The function works fine in the debug simulation.
I then created a HEX file and loaded it in the processor.
Unfortunately it does not work there.
The hardware works fine with the same program (not flowcode).
I assume that it is because of the port definition. But in the debug everything is ok.
Function:
A/D converter 0-2V with delay, selection of 3 thresholds, output to 3 pin.
Where can I set the port properties of the processor?
Is it only possible via simulation?
Where can I read how big the compiled program is? (Flash, Ram, EEprom)
Thank you
Attachments
LKL1000_1-0-08.fcfx
(25.12 KiB) Downloaded 114 times

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: simple programme for AT Tiny45 dont works

Post by BenR »

Hello,

There are two potential issues I've noticed in your program,

The first is this icon.
Icon.jpg
Icon.jpg (10.27 KiB) Viewed 3361 times

It is calling a simulation only function and therefore the code will not be called on download. If you want to set the ADC configuration then it's better to do it via the ADC component properties.
Props.jpg
Props.jpg (41.27 KiB) Viewed 3361 times

The other thing I can see is the AND in your calculation icons in the SchwellePrufen macro. The AND keyword is a binary bitwise AND and you probably want a comparison type AND in which case you must use the syntax &&.

e.g.

U_summe < MIN_GRENZE_0 AND Schwelle0 = 1

becomes

U_summe < MIN_GRENZE_0 && Schwelle0 = 1


If this still isn't working as intended then let us know and we can investigate further.

stefan.erni
Valued Contributor
Posts: 738
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 170 times

Re: simple programme for AT Tiny45 dont works

Post by stefan.erni »

Hoi Rapid

Is your program working in the AT?

If you change the led_clip to TurnOn and put a delay about 2second before the while loop, are the Led lights on?


regards

Stefan


config the AT
A45_2021-09-16_10-59-58.png
A45_2021-09-16_10-59-58.png (197.6 KiB) Viewed 3356 times

rapid
Posts: 8
Joined: Sat Sep 11, 2021 7:18 pm

Re: simple programme for AT Tiny45 dont works

Post by rapid »

II have tried the changes, but it runs as before, in debug mode everything ok, in hardware not.
I noticed that one LED_chalieplexed device gohst that is no longer present on my panel. This I also can not delete because he is not there.
The properties LED_chalieplexed are present.
In picture 3 you can see that PortB is controlled correctly in the simulation.
Attachments
LED_charlieplexed ghost
LED_charlieplexed ghost
Panel1.JPG (85.29 KiB) Viewed 3351 times
Panel2.JPG
Panel2.JPG (20.32 KiB) Viewed 3351 times
Panel3.JPG
Panel3.JPG (80.76 KiB) Viewed 3351 times

rapid
Posts: 8
Joined: Sat Sep 11, 2021 7:18 pm

Re: simple programme for AT Tiny45 dont works

Post by rapid »

Hi Stefan,
yes the LED goes On/Off
The Pocessor configuration seems ok.
I'm trying with an other output method but without success.
(simulation on the panel is still ok)
Attachments
decision new.JPG
decision new.JPG (28.83 KiB) Viewed 3348 times

rapid
Posts: 8
Joined: Sat Sep 11, 2021 7:18 pm

Re: simple programme for AT Tiny45 dont works

Post by rapid »

new attempt...
i send a pulse at the end of the main loop from 1s on Channel 2.
But in the reality is 8sec on ???
Attachments
pulse 1s are 8s.JPG
pulse 1s are 8s.JPG (53.64 KiB) Viewed 3346 times

stefan.erni
Valued Contributor
Posts: 738
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 170 times

Re: simple programme for AT Tiny45 dont works

Post by stefan.erni »

Hoi Rapid

You can choose Set clock speed to 1Mhz or set the clock divider to 1


regards

Stefan
A45_2_2021-09-16_10-59-58.png
A45_2_2021-09-16_10-59-58.png (207.11 KiB) Viewed 3345 times

rapid
Posts: 8
Joined: Sat Sep 11, 2021 7:18 pm

Re: simple programme for AT Tiny45 dont works

Post by rapid »

Ok Stefan is clear!
now the time works correctly. i must set the fuse with my programmer.
I think the reading of the analog input is not working in the reality properly.
the Output seems to work.

rapid
Posts: 8
Joined: Sat Sep 11, 2021 7:18 pm

Re: simple programme for AT Tiny45 dont works

Post by rapid »

hello Matrix, :(

I have now solved my problem, but it was not easy because there are a few misunderstandings in Flocode (9.2). Of course from the point of view of a flowcode beginner.
My program could be simulated correctly but it didn't run properly in the processor because the A/D channel2 wasn't read correctly due to the missing initialization of the component "pot_panel1" ???? what's going on????

# 1 In no example I found was a component initialised, and yet you can simulate everything beautifully.

# 2 why is there no command "initialisation of ports"?
Why isn't there an analog input command?

# 3 What does a "potentiometer simulation" have to do with the port?
these are two different things, aren't they?
Obviously the simulation is part of the definition of the processor.
You don't notice that as long as it's just about creating pretty pictures on the screen, but in the real world it doesn't work like that.

# 4 Is it possible to write a program without components?

# 5 The properties of "pot_panel1" in the panel are different and incomplete compared to those in components (see pictures). Why different names? What is valid now?

Hello Matrix, you have made a very nice program from the point of view of a PC software man,...... but I want to have the function in the processor.

;)
Translated with www.DeepL.com/Translator (free version)
Attachments
Pictures.zip
(122.53 KiB) Downloaded 106 times
LKL1000_1-0-12.fcfx
(19.7 KiB) Downloaded 102 times

medelec35
Matrix Staff
Posts: 1432
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 506 times
Been thanked: 468 times

Re: simple programme for AT Tiny45 dont works

Post by medelec35 »

Hi, rapid.
I Don't use the set properties macro when setting up ADC.
What I do is add on to the panel the required pots.
So if I want to read from An0, An1 and An2 I add three posts to the panel.
It does not matter which type of pot as they all will work the same.
Next, I would select the properties of each pot in turn.
You can select the properties from either right-click on the pot that's on the 2D (or 3D ) panel and select properties, or select View ribbon and select properties.
If the latter then you will need to select the Pot from the drop-down arrow:
Select Pot.png
Select Pot.png (7.8 KiB) Viewed 3306 times
Set the required properties e.g the port pin within the Channel (An2), VREF option etc.:
Pot Properties.png
Pot Properties.png (64.04 KiB) Viewed 3306 times
The Vref voltage is for simulation only, but the VREF option, Conversion speed and Acquistion cycles are all hardware settings, so it's important for them to be correct.
Personally, I find the higher / values for conversion speed work better.
When you want to read your ADC pin, then use either of the Read options e.g:
Average Function.png
Average Function.png (163.92 KiB) Viewed 3306 times
If you have added two pots then for pot2 you will do the same but instead of selecting macros from pot_panel1 there will also be a pot_panel2 to select macros from.
Hope this helps?
Martin

Post Reply