Flowcode V3 for AVR

Any general or miscellaneous queries that do not fit into the other forum catagories

Moderators: Benj, Mods

Post Reply
iain wilkie
Posts: 97
Joined: Tue Jul 14, 2009 4:37 pm
Has thanked: 13 times
Been thanked: 9 times
Contact:

Flowcode V3 for AVR

Post by iain wilkie »

Having just bought this product, I am now finding it difficult to find information on how to use certain function. Please understand
that I am a seasoned assembly programmer in the AVR and though that this tool may be a quicker and better way forward. I have managed quite
quickly to master all the basics, and I have to say I am excited, however when I come to try more involved test programs, I keep coming up agaist very
basic "help" deficiencies, and restrictions. Here are a few observations ...

1 it seems you can have only one PWM unit even though the micro may have more.
2 There is no help file to tell you how to use the user component macro.
3 There is no help information on how to use assemble code, or more to the point what is the built-in assembler syntax and directives ?
4 Some of the help files are very basic and are not very informative.
5 Once you step away from the limited in-build functions, the simulator becomes less useful.
6 I was wanting to say generate a lookup table and as there is no function for this, I decided it could be done in assembler, but I can never get it to assemble
without errors so this could be due to simple syntax errors but I can't find anything about this. I note this has been an issue on the PICs moving from V2 to V3.



My list could go on. Although there seems to a fairly busy forum, it is dificult to find answers to these sort of questions as you need to do a bit of digging here
and there to try and formulate an answer from a host of other type related problems. What I would have thought would be available
are in depth manuals on the web-site giving in-depth detail that could be simply looked up. I realise there is information there and I have looked at most of it and it really only
covers the basics and goes no further.


Now I don't want to be unkind cause it maybe that I am missing something here, but I am not clever enough to spot it, in which case ... sorry, but all I think is needed is a concise manual for AVR if such a thing exists. If anyone could shed more light on all this I would appreciate it.

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Flowcode V3 for AVR

Post by Sean »

Hello Iain,

The two newer versions of Flowcode (AVR and ARM) are almost identical to Flowcode V3 for PIC.
The documentation, tutorials, and examples available on our website for the PIC version apply to AVR and ARM, except in very minor details, so have not been rewritten.

As an example, I have recently converted several of our solution packs from PIC to AVR by simply importing the original PIC Flowcode programs and swapping some of the port allocations, as dictated by the locations of any peripheral device connections being used.

The only significant changes to the solution manuals were the target device configuration details and port allocations.

The manuals can be downloaded via this link:
http://www.matrixmultimedia.com/abouteb ... ions-X.php
The AVR versions of the solution examples are not on the website yet. They should be available soon, or can be imported and converted from the PIC versions.

Flowcode does not directly support every peripheral function in every device, or every configuration option, but makes available a range of useful features that are supported by the majority of the potential target devices.

The C/ASM option is our usual suggestion to advanced users who want to gain access to target device features not supported by Flowcode. There are several posts on the forum detailing the use of C from within Flowcode, and the sharing of data between Flowcode and C.

The C compiler used by Flowcode is the WinAVR port of GCC, as used by AVR Studio. I have not tried to program the AVR devices in assembler, but I have found C to be a very useful option.
Code (c or asm) written in a Flowcode 'C Code' block is passed directly to the C file generated by Flowcode and used for compilation.

There is post in the Article section of the forum that demonstrates the use of lookup tables in C for all the versions of Flowcode.

Flowcode does not simulate c, asm, custom, or custom interrupt code. It does not model the target device, as some more advanced system do, but simulates the high level interraction between the flowchart and the standard component macros.

We are aware of several users who are using Flowcode in the way you seem to be suggesting - as a structure and management tool for lower level code development, and a quick source of additional functions (LCD driver, UART configuration etc.).

I will try to find out some information about the use of assembler code from within C in WinAVR, and post any findings on the forum.

iain wilkie
Posts: 97
Joined: Tue Jul 14, 2009 4:37 pm
Has thanked: 13 times
Been thanked: 9 times
Contact:

Re: Flowcode V3 for AVR

Post by iain wilkie »

Thanks for your explanation Sean.

I now understand that the Flowcode is fairly basic in its functions regarding what is available on whichever AVR is chosen. I also understand that these shortcomings
can be addressed by using the "C Block". As I mentioned I am an ASM programmer and have very little knowledge of C so was glad to see that I can use assembler
within a "C Block". However as I mentioned there seems to be very little (if no) information regarding the assembler syntax for the AVR.

Anyway I decided to have a "play" and am really getting nowhere with this. Even after looking at the assembler code that flowcode generates and relating that to
my entry in the C block, the thing still throws back errors in that block.

for example if I create a C block and enter into it a single line ..... asm ldi r16, 0x080 I get errors reported regarding brackets.... fidling about with it I cannot
for the life of me get it to complile.

Can you tell me where I am going wrong ?.

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Flowcode V3 for AVR

Post by Sean »

Hello Iain,

I have found some useful information regarding the use of the inline assembler for WinAVR in the 'avr-libc Reference Manual'.

You may already have a copy of this document in your current installation of WinAVR, or it can be referenced at this website:

http://www.nongnu.org/avr-libc/user-manual/pages.html

The full manual can also be downloaded via links from the site.

The manual contains an 'Inline Assembler Cookbook' section that explains the required assembler code syntax, and its interaction with the C code.

I will try to develop a worked example in the next few days. It should be possible to demonstrate the transfer of variables between Flowcode and the assembler.

As an experienced AVR assembler programmer, we would be interested to know your thoughts on this method of supporting assembler code, and whether the 3-tiered structure (Flowcode<>C<>ASM) is likely to meet your requirements.

iain wilkie
Posts: 97
Joined: Tue Jul 14, 2009 4:37 pm
Has thanked: 13 times
Been thanked: 9 times
Contact:

Re: Flowcode V3 for AVR

Post by iain wilkie »

Hi Sean,

Thanks again for the info.... I can now get a few basic statements in AVR assembler that compile ok.... such as on my example before it needs to look like this..
asm ("ldi r16,0x80");

However there is the need for labels for jumps, how to manuipulate variables set up be the C code etc etc, and I am finding that a little bit difficult to fathom out.

As far as Flowcode being a development tool .... well to an assembler programmer like me, I hoped that this could be a useful piece of kit taking into consideration the way
that some programmers (like myself) work. There is still constant debate as to wether it is better to do embedded programming in C or assembler. Both sides have there pro's and
con's and the debate will rumble on forever. Being a programmer that started back in the days of the intel 4004 (yes the 4 bit CPU) I have used assemble all my life to the point that C
becomes completly superfleos and indeed although I have tried to embrace it, but my mindset finds it too cumbersome and I really cannot get to grips with it. Now assembler can be written
to be just as understandable as C (if not more understandable) so long as it is structured properly and well commented. Also time-critical operations to be carried out in the embedded arena
really can only be done properly in assembly .... don't let anyone tell you otherwise !... its a fact thats been proven time and time again.
However these time critical programs are usually parts of much bigger non-critical programs, and of course being an assembler programmer ... these parts are in assembler also. Nowe to me thats no big deal,
but if life could be made easier, why not look for an alternative way of doing that part. Now as I have said, for me C is out ... so here is Flowcode that could do all the major stuff in an easy to understand
programming environment and gives me an ability to still so these specific assembler routines ..... problem solved !.
The other side of this ..... and this is definately where I hope Flowcode would become a major tool, a lot of embedded systems now need USB, TCP/IP, Web server, etc etc nowadays. Now .. no doubt here,
this would be a major major major challange for an assembler programmer to handle these functions in assembler. So looking at Flowcode, this would be an incredible asset to someone like me.
This would now give a seasoned assembler programmer the ability to quickly utilise these complex functions in a simple programming environment, and yes .. still to be able to maintain low level time
critical code without the need to do any C programming at all !.
Now take this to the next logical step..... moving up to a major processor like the ARM9 and be able to utilise that in the same way, and now we are really beginning to get excited.
You can therefore understand my in depth interest in this product, There have been attempts like this in the past (e.g the propellor) but these is no doubt in my mind that this could be a major seller, so long as it does not limit the programmer in any way .. especially in terms of chip peripherals and this ability to use assembler routines.
One thing I will mention at this point is that although PICs are abundant, most professionals lean towards the AVR's , 8051 derivitives, H8 and of course the ARM9 ... so you are going in the right direction. An 8051 tool would probably be the most useful, as these processors are still the main players in the embedded world.
So at long last we have an answer to your query on the usefulness of the 3 tier system..... extremely useful, beyond your imagination, and if it can be developed further to overcome some of these niggles (the assembler part for me), then there is no doubt this could become a prime embedded programming tool that you can sell out to millions of programmers throughout the world.

Sorry if I have rambled a bit, but I have been in this game for many many years (work it out from the 4004), and this is the only tool that I have come across that shows the simplicity but still the power to change the way
we create embedded programs in this day and age.

Iain

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Flowcode V3 for AVR

Post by Sean »

Hello Iain,

4004 - Mid 1970s?

Thanks for all your comments. We cover PIC assembler fully, but had not had any requests for the AVR equivalent until now.

I have attached a zip file that includes two (very simple) working Flowcode programs. Both demonstrate the use of Flowcode variables in assembler - via C.
One uses assembler code to increment a Flowcode variable, which is written to Port A by Flowcode.
The other uses assembler code to read Port B, and pass the value back to Flowcode to be displayed on Port A.
ASM_examples.zip
(6.33 KiB) Downloaded 444 times
I have also included two of the WinAVR header files as examples of larger blocks of assembler code - including the use of labels and jumps. You will already have copies of these files in your WinAVR and Flowcode installations, any might find more examples hidden in the sub-folders.

Any further comments are welcome.

Post Reply