ATTiny2313/4313 Flowcode development board
-
LeighM
- Valued Contributor
- Posts: 548
- http://meble-kuchenne.info.pl
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 102 times
- Been thanked: 300 times
Re: ATTiny2313/4313 Flowcode development board
I can't be sure on the details without checking on my installation and I'm not at all familiar with AVR.
-
mnfisher
- Valued Contributor
- Posts: 2018
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 159 times
- Been thanked: 945 times
Re: ATTiny2313/4313 Flowcode development board
Will take some more fiddling...
I tried changing the name - it still flicks to the AVR/attiny4313 file (even when I moved to the ARD directory) Changing the device name - fails on compilation (as does changing the compilation to include (chipalt) instead of (chip:l) - although I had to change this in FC compiler options - as it didn't seem to stick from the fcdx file.
I tried changing the GUID value too - but it still transfers to the attiny4313 file - but all is well as it keeps the settings.
Outsmarted by some XML
I tried changing the name - it still flicks to the AVR/attiny4313 file (even when I moved to the ARD directory) Changing the device name - fails on compilation (as does changing the compilation to include (chipalt) instead of (chip:l) - although I had to change this in FC compiler options - as it didn't seem to stick from the fcdx file.
I tried changing the GUID value too - but it still transfers to the attiny4313 file - but all is well as it keeps the settings.
Outsmarted by some XML
-
LeighM
- Valued Contributor
- Posts: 548
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 102 times
- Been thanked: 300 times
Re: ATTiny2313/4313 Flowcode development board
Could you try adding a property
file = "ATTINY4313_dev_board"
after the name =
(I can't remember if we need the .fcdx suffix)
And delete everything above <root>
Such that it's the first line.
file = "ATTINY4313_dev_board"
after the name =
(I can't remember if we need the .fcdx suffix)
And delete everything above <root>
Such that it's the first line.
-
mnfisher
- Valued Contributor
- Posts: 2018
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 159 times
- Been thanked: 945 times
Re: ATTiny2313/4313 Flowcode development board
The fcdx file...
A fun experiment....
I often bang on about using local variables instead of globals. (In a good way of course
)
I tried a simple blinkie:
loop
pin = .on // pin is a single digital pin in properties.
.on = !.on // on is a local bool
end loop
This gives 952kHz with 20MHz clock.
loop
pin = on // same property
on = !on // now a global
end loop
Gives (only) 606kHz.
So - more readable code isn't the only benefit - locals are also faster (on AVR hardware at least)
(and less RAM usage etc etc)
A fun experiment....
I often bang on about using local variables instead of globals. (In a good way of course
I tried a simple blinkie:
loop
pin = .on // pin is a single digital pin in properties.
.on = !.on // on is a local bool
end loop
This gives 952kHz with 20MHz clock.
loop
pin = on // same property
on = !on // now a global
end loop
Gives (only) 606kHz.
So - more readable code isn't the only benefit - locals are also faster (on AVR hardware at least)
- Attachments
-
- ATTINY4313_dev_board.zip
- (2.85 KiB) Downloaded 10 times
-
mnfisher
- Valued Contributor
- Posts: 2018
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 159 times
- Been thanked: 945 times
Re: ATTiny2313/4313 Flowcode development board
Using a write to PORTD - gives 1.5MHz for a local and 800kHz for a global.
Forgetting the variable and using PIND |= (1 << PD6); // Toggle the pin - gives 2.5MHz
Assembly language?
I feel a need for speed!!!
Martin
Forgetting the variable and using PIND |= (1 << PD6); // Toggle the pin - gives 2.5MHz
Assembly language?
I feel a need for speed!!!
Martin
-
Steve-Matrix
- Matrix Staff
- Posts: 1902
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 281 times
- Been thanked: 445 times
Re: ATTiny2313/4313 Flowcode development board
The in-built port i/o functions in Flowcode have many compromises to account for all the different family and sub-family types and so are not necessarily optimised for speed. For example, I think TRIS is always set even though this may be unnecessary.
Flowcode's focus is mainly to make things easier for the user and that does come with some trade-offs in the generated code.
That said, Flowcode commands can be replace or customised with C / Assembly code, so optimisations can easily be made to time-sensitive parts of the project once it is up and running.