Microcontroller Systems Engineering with Flowcode

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

Moderators: Benj, Mods

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:

Microcontroller Systems Engineering with Flowcode

Post by Benj »

Microcontroller Systems Engineering with Flowcode
Bert van Dam

Microcontroller Systems Engineering with Flowcode is about a state of the art tool, FlowcodeΒ®, and how you can use Flowcode to develop microcontroller applications. The book starts very simply with a tutorial project and step-by-step instructions. As you go along the projects increase in difficulty and the new concepts are explained. Each project has a clear description of both hardware and software with pictures and diagrams, which explain not just how things are done but also why. All sources are available for free download.

Since Flowcode is a high level language the intricacies of microcontroller programming are hidden from view. For that reason it doesn't make much difference whether the program is meant for a PIC, AVR or ARM microcontroller. On a high level the programs for these microcontrollers, although vastly different in internal structure, are identical. For that reason this book is on microcontroller application design in general, not just for one type of microcontroller. If you don't own the microcontroller described in a project you can usually convert it to another microcontroller quite easily.

E-blocksΒ® will be used as hardware for the projects in this book. This way the hardware can be put together quickly and reliably. Fully tested units simply connect together using connectors or short flat ribbon cables to form completed projects.

This book covers 45 exciting and fun projects for beginners and experts such as:

Β· timer
Β· secret doorbell
Β· cell phone remote control
Β· youth deterrent
Β· GPS tracking
Β· pulse width modulated motor control
Β· persistence of vision
Β· sound activated switch
Β· CAN bus
Β· Internet webserver.
Β· and much more

You can use it as a projects book, and build the projects for your own use. Or you can use it as a study guide to learn more about microcontroller systems engineering and the PIC, AVR and ARM microcontrollers.

Content
Prologue
1 What you will need
2 Tutorial
2.1 Concept
2.2 Hardware
2.3 Software
2.4 Simulation
2.5 Downloading
2.6 Operational
3 Basic
3.1 LCD display
3.2 Running light
3.3 Secret doorbell
3.4 Serial communication
3.4.1 RS232
3.4.2 USB
3.5 Analog to Digital Conversion
3.6 Dark activated switch
3.7 Youth deterrent
3.8 Sound activated switch
3.9 Air to fuel ratio
3.10 Digital clock
3.11 Debugging
3.11.1 Simulation
3.11.2 Serial connection
3.12 Bootloade
4 Advanced
4.1 Vref+
4.2 Record short sounds
4.3 Cricket
4.3.1 High quality version
4.3.2 Low cost version
4.4 Custom Characters
4.5 Animation
4.6 Random
4.7 A fan on PWM
4.8 Persistence of vision
4.9 Flash memory
4.10 USART connection
4.11 GPS tracking
4.12 Use PPP to access EEPROM
4.13 Poetry box
4.14 Voice command
5 Sensors
5.1 Infrared object detection
5.2 Photometer
5.3 Ultrasonic range finder
5.4 Digital thermometer
5.5 Data sampling the fridge
5.6 Heat loss in a residential building
5.7 Capture sound frequency
5.8 Tow away alarm
6 Cell phone
6.1 Send a text message
6.2 Receive a text message
6.3 Remote control
7 CAN bus
7.1 Remote LEDs
7.2 Monitor
8 Internet
8.1 Ping (Are you there?)
8.2 Webserver
8.3 Send an alarm e-mail
8.4 UDP remote control
9 Design your own E-block
9.1 Analog test signal
9.2 Microphone pre-amplifier
10 Migration between PIC, AVR and ARM
10.1 Software
10.2 Hardware
10.3 Example
11 Going into production
11.1 Youth deterrent (continued)
12 Appendix
12.1 ASCII table
12.2 Visual Basic communications
12.3 Tips and tricks
12.4 Microcontroller Mathematics
12.5 E-block connections
Index

winnik
Flowcode V4 User
Posts: 3
Joined: Tue Jan 27, 2009 2:59 pm
Contact:

Re: Microcontroller Systems Engineering with Flowcode

Post by winnik »

Where can I get this book very quickly (location Germany)? Didn`t find it in any bookstore (internet) yet.

Thanks for your reply
w.k.

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: Microcontroller Systems Engineering with Flowcode

Post by Benj »

Hello

Elektor are selling the book and you can also find it for sale in the Flowcode section of our website.

DonFL
Posts: 19
Joined: Mon Sep 29, 2008 3:39 am
Contact:

Re: Microcontroller Systems Engineering with Flowcode

Post by DonFL »

How useful is the book if you don't use e-blocks? I do have the HP-488 training board, just bought Flowcode (still searching for time from the real job to dig in and enjoy..:)..).

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: Microcontroller Systems Engineering with Flowcode

Post by Benj »

Hello

If you dont have E-Blocks then you should still be able to get a great deal of helpful information from the Book. Also most of the projects used in the book can be used with the V3 Dev board although some may require the addition of an E-Block and a larger target device eg RS232 via PortC using a 16F877A.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Microcontroller Systems Engineering with Flowcode

Post by JohnCrow »

Hi Benj

I'm considering buying this book in the near future, but with Flowcode 4 being bue for release, which I'm waiting for before buying a licence.
My question is, will the differences in Flowcode between V3 and V4 cause any problems with the projects in this book.
Thanks
1 in 10 people understand binary, the other one doesn't !

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

Re: Microcontroller Systems Engineering with Flowcode

Post by Steve »

All Flowcode V3 programs will be compatible with Flowcode V4. And if there are any problems with V3 programs not working as they should in V4, we'll deal with these as a priority.

RobOnk
Posts: 37
Joined: Mon Jan 11, 2010 12:16 am
Been thanked: 1 time
Contact:

Re: Microcontroller Systems Engineering with Flowcode

Post by RobOnk »

I'm trying to get the "air to fuel" project working with no luck so far. (project 3.9)
Even though I use the already written program from the books web site, it still isn't working.
Returning zeros for any torque input. Anyone try this? I have no problems with the other programs so far, so?? :roll:

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: Microcontroller Systems Engineering with Flowcode

Post by Benj »

Hello

The program will not simulate correctly due to the use of C code to store the look up table values. It should run correctly on hardware though.

RobOnk
Posts: 37
Joined: Mon Jan 11, 2010 12:16 am
Been thanked: 1 time
Contact:

Re: Microcontroller Systems Engineering with Flowcode

Post by RobOnk »

No luck using the hardware either...
I get an error regarding the C-code.
I'm still using the program as written by the author so I'm suspecting I have something configured incorrectly or ??

Thanks, Rob

the C file is enclosed
Attachments
ATF ratio.c
(17.75 KiB) Downloaded 872 times

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

Re: Microcontroller Systems Engineering with Flowcode

Post by Steve »

Please post the FCF, C and the MSG.TXT files and we'll have a look.

RobOnk
Posts: 37
Joined: Mon Jan 11, 2010 12:16 am
Been thanked: 1 time
Contact:

Re: Microcontroller Systems Engineering with Flowcode

Post by RobOnk »

Here you go.
Thanks.


File name: C:\Documents and Settings\Rob\Desktop\Flowagain\FlowBook\chapter 3\section 3-9\ATF ratio.c
Generated by: Flowcode v4.2.3.58
Date: Wednesday, March 24, 2010 18:35:44
Licence: Student
Registered to: Rob Onkenhout


NOT FOR COMMERCIAL USE

http://www.matrixmultimedia.com


Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F877A "ATF ratio.c"
BoostC Optimizing C Compiler Version 6.95 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to FlowCode User under Single user Standard License for 1 node(s)
Limitations: PIC12,PIC16 max code size:4096 words, max RAM banks:Unlimited, Non commercial use only


ATF ratio.c
Starting preprocessor: C:\PROGRA~1\MATRIX~1\FLOWCO~2\BoostC\pp.exe "C:\Documents and Settings\Rob\Desktop\Flowagain\FlowBook\chapter 3\section 3-9\ATF ratio.c" -i C:\PROGRA~1\MATRIX~1\FLOWCO~2\BoostC\include -d _PIC16F877A -la -c2 -o "C:\Documents and Settings\Rob\Desktop\Flowagain\FlowBook\chapter 3\section 3-9\ATF ratio.pp" -v -d _BOOSTC -d _PIC16


.............................

C:\Documents and Settings\Rob\Desktop\Flowagain\FlowBook\chapter 3\section 3-9\ATF ratio.c(836:37): error: unknown identifier 'FCI_TMP_STR'
C:\Documents and Settings\Rob\Desktop\Flowagain\FlowBook\chapter 3\section 3-9\ATF ratio.c(836:17): error: arguments of 'FCI_CONCATENATE' don't match the parameters of call
C:\Documents and Settings\Rob\Desktop\Flowagain\FlowBook\chapter 3\section 3-9\ATF ratio.c(836:2): error: failed to generate expression
C:\Documents and Settings\Rob\Desktop\Flowagain\FlowBook\chapter 3\section 3-9\ATF ratio.c(837:18): error: unknown identifier 'FCI_TMP_STR'
C:\Documents and Settings\Rob\Desktop\Flowagain\FlowBook\chapter 3\section 3-9\ATF ratio.c(837:17): error: arguments of 'FCI_CONCATENATE' don't match the parameters of call
C:\Documents and Settings\Rob\Desktop\Flowagain\FlowBook\chapter 3\section 3-9\ATF ratio.c(837:2): error: failed to generate expression
ATF ratio.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
Attachments
ATF ratio.fcf
(9.5 KiB) Downloaded 774 times

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: Microcontroller Systems Engineering with Flowcode

Post by Benj »

Hello Rob,

Flowcode version 4.3 should fix the compile error you are having. It is related to strings that were removed to allow the 10F devices to work. Unfortunatley it had this knock on effect.

RobOnk
Posts: 37
Joined: Mon Jan 11, 2010 12:16 am
Been thanked: 1 time
Contact:

Re: Microcontroller Systems Engineering with Flowcode

Post by RobOnk »

I upgraded to the 4.3version. I am now having different, bigger problems. I can now not use any of the components (leds, switches), none of them. I get a run-time error, "problem loading the component". Could this be due to the fact that I also just upgraded to the pro version from the student version?
It seems like a registration problem. I never got these error messages before. Please help.

I am currently waiting for my new (pro) registration key via e-mail.

Rob

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: Microcontroller Systems Engineering with Flowcode

Post by Benj »

Hello Rob,

Ok that shouldn't have happened. Did you use the patch or did you uninstall and install the complete version? If you used the patch then maybe try uninstalling and using the full installer version. You should not have to re-enter your new CD key and your registration details should still work correctly as is.

Let me know how you get on.

RobOnk
Posts: 37
Joined: Mon Jan 11, 2010 12:16 am
Been thanked: 1 time
Contact:

Re: Microcontroller Systems Engineering with Flowcode

Post by RobOnk »

Thanks for the quick response.

I first tried the patch, since it started giving me these errors I then tried the full version.
For the patch I didn't need the registration key, but I entered it with the full version re-install.
Same errors with both (patch and full).
Not sure what else to try.

Rob

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: Microcontroller Systems Engineering with Flowcode

Post by Benj »

Hello Rob,

Please can you try to run the following file located inside the "Flowcode v4/Components" directory.

Reg_V4_Comps.bat

You should get a lot of messages saying installed correctly. Simply click OK to each message until the script finishes.

Hopefully this will allow your components to load correctly.
Let me know how you get on.

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

Re: Microcontroller Systems Engineering with Flowcode

Post by Steve »

You'll probably need to run this with elevated privileges. For a BAT file, this is a pain - you need to "Run as administrator..." the CMD.exe command line utility, navigate to the correct directory (CD ....), and then run the BAT file (just type it's name).

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

Re: Microcontroller Systems Engineering with Flowcode

Post by Steve »

Another thing to try is to uninstall, then right-click the full installer exe and select "run as administrator...".

If this also fails, please get the installer to produce a log file and post this file onto the forum. The instructions on how to do this are here:
http://www.matrixmultimedia.com/mmforum ... +log#p9837

RobOnk
Posts: 37
Joined: Mon Jan 11, 2010 12:16 am
Been thanked: 1 time
Contact:

Re: Microcontroller Systems Engineering with Flowcode

Post by RobOnk »

Ok here is what I tried, it's still not working:

I found the .bat file and ran it, it opened a "dos like" window for about 5 seconds, ran through about 20 or so lines and then closed.
Same error messages.

Right clicking the installed.exe file I do not see a "install as administrator option. I am the admin on this computer though.

I added the log.txt bit to the end of the shortcut target. It seemed to except the change, but I could not find a log.txt file after installing again.
And I looked everywhere.

I also tried re-installing using the temporary registration key that came with the software package,,,same messages.

As you can probably imagine, I'm starting to loose my patience. Please help, Rob

RobOnk
Posts: 37
Joined: Mon Jan 11, 2010 12:16 am
Been thanked: 1 time
Contact:

Re: Microcontroller Systems Engineering with Flowcode

Post by RobOnk »

"C:\Documents and Settings\Rob\Desktop\FlowcodeV4.exe" "/log c:\log.txt"

this is what the target line looked like after I added the end bit.
Seems to be the same.

Rob

RobOnk
Posts: 37
Joined: Mon Jan 11, 2010 12:16 am
Been thanked: 1 time
Contact:

Re: Microcontroller Systems Engineering with Flowcode

Post by RobOnk »

another clue to the puzzle;
when I install the hard copy I received 4.0.0.53, (no upgrade) it places different components than what I'm choosing.
For instances if I select a switch it gives me a lcd display, and when I select a 7 segment display it places the formula flowcode box.
Really weird.

Rob

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

Re: Microcontroller Systems Engineering with Flowcode

Post by Steve »

Are you running XP?

The issue with the component icons on V4.0 is a known issue and nothing to do with your current problem.

You should now have a "c:\log.txt" file - please post that here so we can see what is going on.

RobOnk
Posts: 37
Joined: Mon Jan 11, 2010 12:16 am
Been thanked: 1 time
Contact:

Re: Microcontroller Systems Engineering with Flowcode

Post by RobOnk »

Yes, I am running XP.

So the log file should be a text file named "log" located at the C:/ root directory? Sounds pretty simple, but....
I don't see it, and tried it twice.
Is there another way to do this?

Thanks,
Rob

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

Re: Microcontroller Systems Engineering with Flowcode

Post by Steve »

Don't do this:

Code: Select all

"C:\Documents and Settings\Rob\Desktop\FlowcodeV4.exe" "/log c:\log.txt"
Try this instead (no quotes around the last bit):

Code: Select all

"C:\Documents and Settings\Rob\Desktop\FlowcodeV4.exe" /log c:\log.txt

Post Reply