What C editor to use for novice?

Go To Last Post
75 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!
I done my AVR project's before in Bascom but I wish to learn the C programming language 

to use it in my up-coming AVR project's.

I'm also an old user of the MS Visual Studio and very familiar with the VB programming language.

 

What I search for is a such of editor for C which have the ability to predict the command i type and so 

it makes easier to find the right command and avoid some misspelling errors.

 

I mean something like in MS VB, when you start to type the command you got a drop-down menu like the right click menu

of the mouse, where you have the similarly commands and you can just pres the enter or select the required command.

 

I tried the WinAVR but the editor is something very old school, like a simple notepad.

Many times when I make a typo error I need lot of time to clearly see the missing letter or so...

I mean, I think there must be some sort of software out there which was evaluated over a Notepad...

 

Any suggestion for what tool to use for novice to learn the C language for AVR would be nice.

 

Thank you very much.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I'm also an old user of the MS Visual Studio

 The current "Atmel Studio" that you can download 0 (for free) from Microchip is built on Visual Studio, so you'll probably be pretty happy with that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you don't want/need an IDE, you can download the Visual Studio Code Editor at https://code.visualstudio.com/

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

headmelted

Why we need the best tools on Chromebooks and Raspberry Pi

The case for Visual Studio Code on ARM

by Jay Rodgers

I build things and I write about it. Follow me for updates on my latest work. Visual Studio Code for Chromebooks and Raspberry Pi: https://code.headmelted.com.

Nov 15, 2016

https://headmelted.com/why-we-need-the-best-tools-on-chromebooks-and-raspberry-pi-3ab4c10a611c

(bottom of article)

...

These devices have a real opportunity to introduce a great many more young (and not-as-young) minds to our field, but let’s not have their experience be a restricted, blinkered view of technology.

I feel very strongly that the best tools should be available to everyone. This is not an original idea, and it’s this notion that is in large part the reason why most GNU software already has great support for ARM (and other architectures too).

...

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Greg_Muth wrote:
If you don't want/need an IDE, ...
Visual Studio Code can be an IDE as it has extensions for lint and debuggers.

The GDB client :

Visual Studio Marketplace

Native Debug

GDB, LLDB & Mago-MI Debugger support for VSCode

by webfreak

https://marketplace.visualstudio.com/items?itemName=webfreak.debug

https://marketplace.visualstudio.com/items?itemName=webfreak.debug#review-details

...

 

Federico Zuccardi Merli

9/4/2016

I'm using this for embedded debugging, through OpenOCD and other gdb servers.

...

 

Native Debug likely may be operational with AVaRICE (AVR GDB server)

An alternate way is to extend Morten's Visual Studio Code extension :

https://www.avrfreaks.net/forum/linux-toolchains-debugging-and-ides#comment-2160496

 


https://marketplace.visualstudio.com/VSCode

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
... from Microchip is built on Visual Studio, ...
plus Visual Assist that's a low price extension to Microsoft Visual Studio.

Atmel Studio

Features

http://www.microchip.com/webdoc/GUID-ECD8A826-B1DA-44FC-BE0B-5A53418A47BD/index.html?GUID-3E3373A8-E464-4E88-8912-B4336CD98F08

...

  • Rich code editor for C/C++ and Assembly featuring the powerful Visual Assist extension

...

Whole Tomato Software

Compare to Visual Studio

Compare Visual Assist to Microsoft Visual Studio

https://www.wholetomato.com/purchase/compareToVs.asp

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jodank wrote:
I wish to learn the C programming language 

To learn the 'C' programming language, it is probably best not to do it on a microcontroller!

 

Better to learn the language itself on something like a PC; then, once you have grasped the basics, move on to applying that on a microcontroller.

 

I'm also an old user of the MS Visual Studio

So get the 'C' version of VS and learn on that.

 

As already noted, Atmel Studio is built on MS Visual Studio - so you should feel perfectly at home there.

 

I tried the WinAVR but the editor is something very old school

That's because it is very old!

 

Any suggestion for what tool to use for novice to learn the C language for AVR would be nice.

Again, learn the language on a PC - using Visual Studio (as you're already familiar)

 

Then - and only then - move on to the AVR with Atmel Studio.

 

 

EDIT

 

Here are some 'C' learning & reference materials for you: http://blog.antronics.co.uk/2011...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Mar 7, 2018 - 08:55 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For a "stand alone" C (C++, Java, Python, XML, ...) editor I'd never consider anything but the Scintilla based Notepad++

 

But if you want "source browsing" which involves the concept of "projects" that collect together a bunch of C and H files then you really need an IDE (though "Source Insight" is brilliant, if a little expensive). For just "learning C" probably the most obvious IDEs (in no particular order) are Visual Studio, Eclipse+CDT, Netbeans, Code::Blocks. Recently I have also been impressed by IDEs from JetBrains too.

 

Of all the options the obvious one to use would appear to be Visual Studio. For one thing you are already familiar with the (VB) IDE. So just use the C/C++ variant for learning C. Also Atmel Studio 7 from Microchip is based on Visual Studio 2015 so there's a lot of commonality there too when you make the move from PC based C to AVR based C.

 

As others have said, don't make the mistake of trying to learn C on an AVR. It's far too difficult to get instant results. Apart from anything else the edit/build/burn cycle takes too long and it's not that easy to debug/see results. If you stick to writing EXEs for the PC then you get instant output as soon as you build/run the thing and the debugging is 10 times easier/better.

jodank wrote:
I tried the WinAVR but the editor is something very old school, like a simple notepad.
That's why it was called "Programmer's Notepad". The very last WinAVR now dates from the end of 2009 (released at the start of January 2010) and the PN editor it includes even then was "old and out of date". So expecting something slick in 2018 from 15+ years ago was never going to happen. Like I say. any of the C IDEs I list above will be a FAR better experience. You can even add AVR support to most of them though AS7 (on Windows) would still remain the obvious choice as Atmel just took Visual Studio 2015 and made an AVR specific environment from it. It's also the only way you will get access to their simulator.

 

But do heed the advice and learn C using PC/Exe's not trying to do it for AVR. Also you will find tons of internet tutorials, many/most are (for Windows) probably going to assume Visual Studio anyway.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As there is no way to determine which is The Best IDE™, I'm just going to share my personal opinion:

 

I fully agree that starting with Visual Studio gives you a great advantage when you want to move to Atmel MCUs later. And I absolutely love the C/C++ editor for it's great code completion and refactoring menus. The dark theme is very easy on the eyes and a joy to work with. It's my favorite IDE with no competitor.
But Visual Studio seems to have one huge drawback: As far as I know, it only works with the MSVC compiler, apparently you can't integrate MinGW or Cygwin. This means that some libraries are unavailable or different. C/C++ is more UNIX centered, so almost all tutorials assume that you are on UNIX or a compatible compiler, such MinGW or Cygwin.
For this reason, I use Code::Blocks with MinGW to write code for PC. Many use Eclipse, but I just don't like it. This is personal preference though, Eclipse is really not bad and I recommend that you have a look at it. Most other MCU vendors built their free IDEs on Eclipse (Texas Instrument, ST Micro, ...)

 

-Patrick

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

 

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pawi777 wrote:
Visual Studio seems to have one huge drawback: As far as I know, it only works with the MSVC compiler

Surely, Atmel Studio demonstrates that this cannot be true?

 

And I'm pretty sure that Atmel are not the only ones to have integrated 3rd-party tools with VS.

 

 

But maybe you're just talking about the free versions?

It might be true as  a limitation of the free versions ... ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

clawson wrote:
Of all the options the obvious one to use would appear to be Visual Studio.

Agreed - in this case - because:

  • THe OP is already familiar with VS;
  • A free version is available, and widely supported;
  • The OP is targetting AVR - where Atmel Studio is VS-based.

 

The only downside in general is that very few (if any?) other silicon manufacturers base their tools of VS - almost all use Eclipse.

Also, VS is Windows-only; which upsets some people - but is clearly not an issue here.

 

But I would certainly say that VS has to be the one to go for in this case.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The irony is that my day job is almost entirely based on the use of VS and trying to get code written for GCC to build with MSVC :-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
(though "Source Insight" is brilliant, if a little expensive)
but less expensive than SciTools Understand though Understand is multi-platform (Windows, macOS, Linux) and may analyze more computer languages.

https://www.sourceinsight.com/shop/

https://scitools.com/buy/understand/

https://scitools.com/support/what-are-the-system-requirements-for-understand/

https://scitools.com/support/languages/

 


The Ganssle Group logo

The Ganssle Group

Tools for Embedded Developers

http://www.ganssle.com/tools.htm

 

http://www.ganssle.com/tools.htm#sourcenav

...

John Paul wrote: "Understand" by SciTools. I've been using this tool for just over two years and it is excellent. Especially useful when making modifications to a code base that you have little knowledge of, it helps you get a bigger picture of the code set.

 

...

 

http://www.ganssle.com/tools.htm#Statictools

...

Dave Kellogg sent this: Understand (link) is a powerful IDE plus Static Analyzer.  It parses your code (C, C++, Java, Ada, VHDL, and several others) at a syntactic level, and builds a database.  It can then show you textual and graphical tree views of calls to, called by, included by, read or write references to variables, dozens of metrics (including McCabes Complexity, comment density, line counts, and coupling), and much more.  It has a scriptable API, multiple monitor support, and all the typical functionality of an IDE. It can generate flow charts from your code. It has an architecture feature for grouping a bunch of source files together as a unit, and then doing analysis on that unit. I'm extremely impressed with the support offered by Sci Tools.  If you write code, you need to check out this tool.  If you maintain code written by others, then you MUST check out this tool.    The price ($500) may seem high if this were just an IDE/Editor.  But with its huge range of analysis features, it is a fantastic bargain.  Very highly recommended.

Vlad Zeylikman votes for Understand, too: (link). It's not cheap. the lowest priced version supports C, C++, C#, and Java. Other variants support more languages, including VHDL. It can generate code metrics, call and called trees, cross-references, etc. The code navigation within a project is very easy. Search can be done on project files or outside. There are Windows, Linux, and Solaris versions. For a large project on which you need to come up to speed quickly, it is an invaluable tool. It is way above SourceNavigator’s capabilities but then SourceNavigator is free and Understand is not.

...

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Wed. Mar 7, 2018 - 12:47 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:

clawson wrote:

(though "Source Insight" is brilliant, if a little expensive)

You made me look:

 

Source Dynamics, Inc, wrote:

Source Insight ... can display reference trees, class inheritance diagrams, and call trees.

 

https://www.sourceinsight.com/pr...

I have always found Atmel Studio's browsing facilities rather limited - I find Eclipse far superior for that.

 

Eclipse can do the tree displays - I use them a lot.

 

(I don't tend to do OO, so I don't know about the inheritance diagrams)

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pawi777 wrote:
But Visual Studio seems to have one huge drawback: As far as I know, it only works with the MSVC compiler, apparently you can't integrate MinGW or Cygwin.
One zero price way is

Visual Studio Marketplace​

Visual C++ for Linux Development

https://marketplace.visualstudio.com/items?itemName=VisualCppDevLabs.VisualCforLinuxDevelopment

found via "tag:gdb".

 

A low price way is the Sysprogs VisualGDB extension to Microsoft Visual Studio :

https://visualgdb.com/buy/

 


https://marketplace.visualstudio.com/search?term=tag%3Agdb&target=VS&category=All%20categories&vsVersion=&sortBy=Relevance

https://visualgdb.com/w/tutorials/category/tutorials/win32/mingw/

https://visualgdb.com/tutorials/avr/

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Also, VS is Windows-only; which upsets some people - but is clearly not an issue here.

Visual Studio

Visual Studio for Mac

https://www.visualstudio.com/vs/visual-studio-mac/

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pawi777 wrote:
... apparently you can't integrate MinGW or Cygwin.
A different take though Windows 10 specific and for Linux :

Visual C++ Team Blog​

Targeting the Windows Subsystem for Linux from Visual Studio

by Marc Goodner (Microsoft)

February 8, 2017

https://blogs.msdn.microsoft.com/vcblog/2017/02/08/targeting-windows-subsystem-for-linux-from-visual-studio/

...

 

Install & configure Visual Studio

...

Be sure to select the Visual C++ for Linux workload during the installation process.

...

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

The thread title is:

What C editor to use for novice?

I would generally steer clear of stuff that has been dumbed-down "for novices" - as they can leave you ill-prepared for proper tools, and/or frustrated by missing features.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmm looks like Microsoft reacts to customer's wishes:

https://blogs.msdn.microsoft.com...

 

Note the date of the article: July 2017. So my information that Visual Studio doesn't offer good support for other compilers is old news, but not that old yet. I tried to use Visual Studio with MinGW maybe a year ago and I found very little information about it other than people saying that it's a hassle and that it won't be as good as with MSVC. I'll definitely try that again!

 

@awneil:

I don't know how Atmel created their Studio, but I suppose they had some support from Microsoft or they purchased some form of developer's license. I'm too lazy to google, does such a thing exist?

 

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

 

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pawi777 wrote:
I don't know how Atmel created their Studio

Neither do I

 

I'm too lazy to google, does such a thing exist?

I don't know - and also can't be bothered to find out

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I googled it, my curiosity was stronger than my laziness laugh

But unfortunately, I didn't find anything on how you can make your own IDE from Visual Studio. Nothing at all. You can make your own extensions, this is quite well documented. But how how you can make your own IDE based on VS, as Atmel did, seems to be a well kept secret. Microsoft's page with the prices for the different editions of VS also doesn't mention a develeoper's license.

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

 

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Visual Studio shells are to Microsoft partners one of which is Microchip.

Visual Studio

Partner Program

Visual Studio Isolated and Integrated Shells

https://vspartner.com/pages/vsshells

...

Obtaining and Using the Visual Studio Shell

The Visual Studio Shell is available to Visual Studio Partners as a benefit of the Visual Studio Partner Program.

...

https://vspartner.com/Directory#?query=Microchip

https://vspartner.com/Directory#?query=Microchip&partner=377

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pawi777 wrote:
Hmm looks like Microsoft reacts to customer's wishes:

https://blogs.msdn.microsoft.com...

Thanks for the read.

 ... this [task build-all] can call into Make or any other build tools supported by MinGW as well. 

In lieu of GNU make, can Visual Studio invoke MSBuild for GCC?

My guess is yes as Atmel Studio invokes MSBuild.

A guess is MSBuild is a part of the Visual Studio Isolated Shell.

(or by a Visual Studio extension?)

 

Microchip

Atmel Studio

Build and Run Options

http://www.microchip.com/webdoc/GUID-ECD8A826-B1DA-44FC-BE0B-5A53418A47BD/index.html?GUID-FF965275-375D-42EE-9D87-4725D0BFAAE6

...

MSBuild project build output verbosity

...

MSBuild project build log file verbosity

...

Sysprogs

10 Reasons to Try Out MSBuild for your VisualGDB Projects

by 

September 7, 2016

https://sysprogs.com/w/10-reasons-to-try-out-msbuild-for-your-visualgdb-projects/

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You may use Code::Blocks.

 

http://www.codeblocks.org/

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What advantage(s) would that have in this specific case?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!
Thank's for so much infos!
 

As you guys told, I won't start to learn C/C++ on the AVR uC but I will do it for PC.

I also downloaded that AVR Studio 7, that is what I was searching for. :-)

Thank you so much for this help!
 

I'm not familiar with C but I'm familiar with VB and Bascom.

I finished lot of project's in this two languages and I'm familiar with the AVR uC's but not with C.

 

As I tried the AVR Studio 7, I wrote before a simple program for the uC which was working on the uC.

But when I rewrote it into AVR Studio 7 the software was under error.

 

Here is the original code what was written in WinAVR:

#include <avr/io.h>

#include <util/delay.h>

 

int main(void)

{

DDRB |= 1 << PINB0; // Data Direction Register output PINB0

DDRB &=~(1 << PINB1); // Data Direction Register input PINB1

PORTB |= 1 << PINB1; //Set PINB1 to a high reading

while (1);

{

PORTB ^= 1 << PINB0; //XOR (^) to toggle only pin0 on port B

_delay_ms(100); //Delay between the toggling on and off 10ms

If (bit_is_cleared()PINB1, 1))

{

_delay_ms(10);

}

else

{

_delay_ms(100);

}

}

 

}

When I paste this code to AVR Studio I got some error with this comand with red underline: "if (bit_is_cleared()PINB1, 1))" .

What is actually this bit_is_cleared ?

This is actually not a C command, or?

 

In the picture is the highlighted part...

 

I can't understand if I write the same C code in two different editors why is that not working?

That is the same C code actually.

 

Another think about this example:

 

DDRB |= 1 << PINB0; // Data Direction Register output PINB0

DDRB &=~(1 << PINB1); // Data Direction Register input PINB1

PORTB |= 1 << PINB1; //Set PINB1 to a high reading

 

This port-pin output/unput settings must be so "complicated" set?

Using some XOR method etc...

 

Is there in C another way to let say declare the PINB0 as an output or input pin?

Or is there a simpler way to say the PINB1 = 1  // to set that pin to a high state?

 

I know, you told I should not start learning C on AVR but I'm already done it now... smiley

 

Thank you very much.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jodank wrote:
AVR (sic) Studio 7,

Note that it's not AVR Studio; it is Atmel Studio - because it doesn't just support AVRs

 

 

jodank wrote:
I won't start to learn C/C++ on the AVR uC but I will do it for PC.

 

Excellent.

 

But then you get into a whole lot of stuff about 'C' on the microcontroller!!

 

surprise

 

Don't do that!

 

Take the time to learn and understand the language first - then you will understand what is happening with these errors!

 

Here are some 'C' learning & reference materials for you: http://blog.antronics.co.uk/2011...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Mar 7, 2018 - 10:03 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I believe you have an extra ")" and a couple of other things...

Try:

if (bit_is_clear(PINB, 1))   // Test PINB bit 1

Edit:

jodank wrote:
What is actually this bit_is_cleared ?

This is AVR specific, see the AVR Libc Reference Manual; specifically, https://www.microchip.com/webdoc/AVRLibcReferenceManual/ch20s22s02.html

 

David (aka frog_jr)

Last Edited: Wed. Mar 7, 2018 - 10:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Code::Block advantages are more simple and more lightweight.
Code::Blocks disadvantages are you should install tooolchain separately.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

But specifically in this case, we have a user who is already familiar with Visual Studio, and who will likely be using Atmel Studio  - so how would this help them?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jodank wrote:
What is actually this bit_is_cleared ? This is actually not a C command, or?
At the top of the program you wrote (as for most programs for avr-gcc) you have an include of <avr/io.h>. While the name suggests that just defines the IO addresses of the micro (that is the Special Function Registers - things like TCCR0 and PINB etc) that io.h header actually includes a whole bunch of .h files that have also been written specifically for AVR programming and one of those is sfr_defs.h. It is in that file that there is a definition of a "preprocessor macro" called bit_is_cleared(). So, no, this is not a standard command in C. It's something the AVR development team have added to make your programming of AVRs easier.

 

It's probably too early to explaining/learning this kind of stuff. But if you are interested the sfr_defs.h file includes:

#define bit_is_clear(sfr, bit) (!(_SFR_BYTE(sfr) & _BV(bit)))

Actually now I look at that there is some REAL technical stuff going on in there but the "simple" bit is the _BV it. Elsewhere in the file that is defined as:

#define _BV(bit) (1 << (bit))

so the purpose of #define and preprocessor "macros" is to make something that is "easy to type (and remember)" that hides something that is a bit more complex. So when you type:

if (bit_is_clear(PINB, 1))

then in part this will expand out to be:

if ((!(_SFR_BYTE(PINB) & (1 << (1)))))

I'm not going to even try to explain _SFR_BYTE() to you as even advanced programmers have to stop and think about what that really is at the core. But already you can see that the simple "1" you passed has effectively become (1 << 1). The _BV() macro turns a bit position (0..7) into a bit mask (0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40 or 0x80). The bottom line is that it's really just another way to type:

if (PINB & (1 << 1))

and if that means nothing to you I suggest a visit to the Tutorial Forum and a read of the thread called "Bit Manipulation 101" as it's fairly key to writing C for micros.

 

But all of this comes back to "learn C on the PC first!!". A good tutorial for PC will go as far as explaining what (1 << n) achieves and other stuff like that. When you know all that you can come to the AVR where you put such stuff into practice and things like bit_is_clear() just makes it easier to type what can otherwise be quite complex syntax.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I am a bit amazed here.

I put quite some time (maybe an hour or so) into writing an extensive post (back researched some URL's and 2 code examples)

After posting I discovered I posted to the wrong thread. Went back hear, clicked "edit" and pasted the code where it belongs.

It all works, including the green code boxes and blue url's.

https://www.avrfreaks.net/forum/software-development-general#comment-2415876

 

For OP:

A long time ago I figured out a part of the obscure make syntax. Because of it's flexibility it let you do a lot of amazing things (and has so for 40 years or so).

I started with AVR's with WinAvr and PN, which I quite liked for its simplicity.

Because I always used make files (there was no alternative i think back then) it was pretty easy to switch from a windows system to Linux, which I have been using exclusively for several years now.

 

As others have said before, Atmel's Studio is (as far as I know) just the same software as Visual Studio, but a bit modified to support the GCC toolchain from AtChip. (Or Is MicroMel better ?).

So if you already know Visual studio, and are happy with the way it works then it should be easy to use it for you (But I don't touch microsoft's stuff if I can avoid it).

 

As you probably know there are a lot of IDE's out there which range from the most horrible and limiting "arduino" thingie to very big and bloating IDE's.

Wikipedia has a few different articles on IDE's. They are quite well written and objective:

https://en.wikipedia.org/wiki/Integrated_development_environment

https://en.wikipedia.org/wiki/Comparison_of_integrated_development_environments

 

I was very happy with  WinAvr & PN for several years. The only thing I had before that was a PIC16F84 and a bare assembler.

If I remember well PN even had syntax coloring. (but no code completion).

 

Over the years I've used quite a lot of different IDE's. I think I tried & discarded more than 10 before I settled on Qt Creator.

It's certainly not the most advanced IDE out there, but it has a quite nice balance of functionality for my needs & wishes. It also has the code completion feature and it lets you jump around from file to file to follow the execution path of your programs through the function calls.

Figuering out how all the "arduino" libraries fit together behind the scenes is doable in an IDE like that, but horrible in a more old fashioned IDE. (and in the "arduino" ide itself, ... I think I'd rather kill myself...).

 

Another package worth mentioning might be platformio, even though I still do not quite know what to think of that.

The good thing about platformio is that it is very easy to get started with.

Another good thing is that it takes a lot of configuering out of your hands. For example it just pulls a recent C++ compiler from the Internet if it thinks it needs it.

Another good thing is that it uses scons as a way to build your code. No more make files.

Yet another good thing is that it's platform independent. You can take your code from one machine to another and don't have to think much about setting up a new environment.

 

The bad thing about platformio is that I seem to be missing being able to write simple code in a simple way. You seem to have to use one of the many integraded "frameworks". It supports "arduino" "mbed" and quite a bunch of other "frameworks" https://platformio.org/frameworks/arduino but what I seem to be missing here is to be able to simply thow a bunch of my self written files and libraries at it without it having pull in some framework with unwanted overhead I do not need nor want. But that might be my error, I have not yet spend very much time with platformio.

 

Platformio itself comes with "Atom" as IDE and that seems to be a quite capable IDE. I have not used it though, I only use the command line version ( platformio core) and integrated it in Qt Creator as I did not have a need nor desire to get used to yet another IDE.

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

Last Edited: Thu. Mar 8, 2018 - 12:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paulvdh wrote:
Template's let you do things like this:
I doubt it - you have un-matched angle brackets !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am a bit amazed here.

I put quite some time (maybe an hour or so) into writing an extensive post (back researched some URL's and 2 code examples)

So maybe I'm not crazy!

https://www.avrfreaks.net/comment/2413676#comment-2413676

https://www.avrfreaks.net/comment/2413696#comment-2413696

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

joeymorin wrote:
So maybe I'm not crazy!
Your are not - my comment about <> was in reply to what Paul posted but now I just found his post in a different thread (and thought my reply had gone missing). There is something strange afoot!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HuH!
Guys you are absolutely pro's!

 

I'm sitting here and read all your post's, you really got effort to do that and I appreciate that really.

Thank you very mush for all the words here.

 

I'm in programming stuff more than 30 years.

I learned in school Pascal, Cobol and we had at that time a bit contact with C language.

I can remember as a child I wrote several programs in so called GW basic, it was integrated in my 286 BIOS.

 

Somehow I finished in the wold of MS Visual Basic, it was at that time when Win 3.0 or so was released.

Later I grow up beside of MS Visual Basic, I actually realized my big mistake later but it was to late to go back and starting again with C.

Actually, I never had any need for C or other programming language than VB.

So, I didn't switch back to any other language.
I focused to finish my project's in my best knowing language which is today the VB .NET - Visual Studio 2017.

 

I come to ATMEL maybe 5 years back from now.

I found very interesting to make some gadgets and complex electronic's too with a very comfortable architecture uC like the AVR's are.

Most of my projects are based on several Attiny2313 and Atmega16.

The programming language what I started to studying was of course for me the nearest, the Bascom.

Very quickly I realized does this is a language which is very limited by users, and the most pros are out here C programmers,

and when I need some advice and help I stumbling in problems because I'm restricted to get help only from DIY-er Bascom users.

They helped me lot and I helped also to others when I was in a such of situation, but  the real stuff begins here.

I think as a fan of MS Visual Studio, does the key to make progress in developing and have fanwith peoples until 

we create our project's on uC's is to know the C language.

 

Most of you are high skilled pro's in uC developping and why should you waste your time to learn Bascom?

But you would help as to understand trivial thinks and could give as nice path in how to do something but we are out 

of the way, because we know Bascom and don't know C, we are not compatible with you.

That makes me crazy, I wish to be also on the right path and this is why I wish to learn C to use on uC's.

 

SO, I will say, I know C on very basic level, I know how functions works, how the code is organized, 

I wrote programs like "phone book" some drawing programs on a basic level when I was at school.

But today I'm out of the box. smiley
I have to remember again all the syntax's and I have syntax error's and have to remember the command's etc. etc..

This is why I call myself a novice in C language.

 

My question:

1. I will learn again C on PC, what is a good editor for C ?

2. Is my Visual Studio 2017 simple enough to learn C?

3. Should I maybe switch to another editor? which is more oriented to write codes in C for uC?

4. Is it enough to learn C or should I better go to learn C++?

 

 

Where would you start if you are a pro VB developer and had some contact with C but on a basis like I described

and you wish to write your Attiny2313 code in C.

What would be the best start?

 

Oh!
I almost forgot!

the mayor think why I was not interested in C is all that "|=" , "<<", "=~" etc. syntax's, but now I know, I should it accept... smiley

Thank you very much.

Last Edited: Thu. Mar 8, 2018 - 03:47 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

jodank wrote:
1. I will learn again C on PC, what is a good editor for C ?

2. Is my Visual Studio 2017 simple enough to learn C?

Yes, Visual Studio is perfectly fine.

 

It would be pointless - even counterproductive - to complicate the issue by also having to learn a different IDE!!

 

3. Should I maybe switch to another editor? which is more oriented to write codes in C for uC?

MSVC = MS Visual C - of course it is perfectly well oriented to write C !!

 

 

Where would you start if you are a pro VB developer and had some contact with C but on a basis like I described

K&R:

https://www.amazon.co.uk/C-Progr...

 

 

 

 

 

 

and you wish to write your Attiny2313 code in C.

Again, forget the microcontroller for now.

 

What would be the best start?

Definitely K&R.

 

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil:

Thank's for the quick replay, I got the the book several days before and use it right not  what you mentioned above. :-)

 

Thank you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jodank wrote:
My question:

1. I will learn again C on PC, what is a good editor for C ?

2. Is my Visual Studio 2017 simple enough to learn C?

3. Should I maybe switch to another editor? which is more oriented to write codes in C for uC?

4. Is it enough to learn C or should I better go to learn C++?

1) I think everyone here is agreed that given what you know and what you intend to do then Visual Studio from Microsoft is the best tool to learn C right now

 

2) Yes

 

3) Visual Studio started out as a C/C++ development system. Later they added Basic and C# and "web" and others but it's core is a C/C++ development system

 

4) In 2018 I personally would recommend everyone start with C++ rather than C but as C is just a "subset" of C++ anyway you can start with the simple C syntax for starters but the paradigm (idea behind) C++ is actually quite different to the ancient mechanism of C and it makes you THINK about the structure of code writing in quite a different way (modular, isolated blocks that are easily reused - in other words "object oriented") so part of learning C++ is about keeping code in neat, isolated, easily manageable chunks. C just lets you write big amorphous lumps of code too easily.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
 In 2018 I personally would recommend everyone start with C++ rather than C

The downside of that always used to be that C++ is still a "minority interest" at this level - so the vast majority of examples, tutorials, etc, are C - not C++

 

However, as Arduino is C++, I guess that is no longer (so much) the case ... ?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jodank wrote:
which is more oriented to write codes in C for uC?
Relative to Microsoft, it's a toss-up.

Visual Studio's uC C extensions are not zero price and the one zero price extension is no longer maintained; Atmel Studio really stands out in a good way.

Visual Studio Code's uC C extensions are being maintained.

 

P.S.

jodank wrote:
Most of you are high skilled pro's in uC developping and why should you waste your time to learn Bascom?

  • Because one can
  • "waste" (eyes roll)

The AVR ecosystem is deep due to it being by a near plethora of computer languages.

fyi, DocJC has his creations by BASIC on AVR; likewise by a relative few here.

 


https://marketplace.visualstudio.com/search?term=tag%3Amcu&target=VS&category=All%20categories&vsVersion=&sortBy=Relevance

Visual Studio

tag:mcu

  • C#, nanoFramework
  • C++, Visual Micro
  • C++, Visual C++ for IoT Development

https://nanoframework.net/

http://www.visualmicro.com/page/What-features-are-included-in-Visual-Micro-Pro.aspx

https://marketplace.visualstudio.com/search?term=tag%3Agdb&target=VS&category=All%20categories&vsVersion=&sortBy=Relevance

Visual Studio

tag:gdb

  • Visual Micro
  • VisualGDB
  • Visual C++ for IoT Development

https://visualgdb.com/

https://marketplace.visualstudio.com/search?term=tag%3Amcu&target=VSCode&category=All%20categories&sortBy=Relevance

Visual Studio Code

tag:mcu

PlatformIO

https://platformio.org/ (GDB is inherent)

http://docs.platformio.org/en/latest/plus/debugging.html (PlatformIO value-added, OpenOCD, Texas Instruments MSPDebug)

http://openocd.org/

MSPDebug

https://dlbeer.co.nz/mspdebug/

MSPDebug is a free debugger for use with MSP430 MCUs. It supports FET430UIF, eZ430, RF2500 and Olimex MSP430-JTAG-TINY programmers, as well as many other compatible devices. It can be used as a proxy for gdb or as an independent debugger with support for programming, disassembly and reverse engineering.

...

Texas Instruments

TI.com

MSPDS MSP Debug Stack

http://www.ti.com/tool/MSPDS

...

Description

 

The MSP debug stack (MSPDS) for all MSP430™ microcontrollers (MCUs) and SimpleLink™ MSP432™ devices consists of a static library on the host system side as well as an embedded firmware that runs on debug tools including the MSP-FET, MSP-FET430UIF or on-board eZ debuggers. It is the bridging element between all PC software and all MSP430 and SimpleLink MSP432 microcontroller derivatives and handles tasks such as code download, stepping through code or break points. The MSP Debug Stack is used in integrated development environments such as Code Composer Studio™ (CCS), IAR's Embedded Workbench or tools like Smart RF Studio and Elprotronic's FlashPro430.

...

https://marketplace.visualstudio.com/search?term=tag%3Agdb&target=VSCode&category=All%20categories&sortBy=Relevance

Visual Studio Code

tag:gdb

  • D Language utility extension pack
  • Cortex-Debug
  • Native Debug

Native Debug

https://marketplace.visualstudio.com/items?itemName=webfreak.debug

https://github.com/WebFreak001/code-debug

Native debugging for VSCode

 

Edit: target

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Thu. Mar 8, 2018 - 05:50 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, I think in this way:

 

All the programming languages have it's field of use.

The programming language should be chosen by the task what has to be programmed.

So, I assume C or C++ or C# or ASM is the most worse combination to take if a web developping

situation is in game.

I never heard does somebody wrote a web page in C or whatever language in this category.

 

My usage of C should be on the field of uC and not to write supper fast programs on PC.
That I would do in my well known area, in VB.Net.

 

I assume if I start and make progress in C language that should be good enough to write my 

own code instructions for my AVR uC's and a much better way to do all this than in Bascom.

 

I won't blame Bascom, actually I'm also a Bascom programmer, but C is developed to be more 

hardware oriented I think. And that is the main reason why C is in game on uC's programming.

 

Of course, C sources can be compiled on other OS platforms too but this is not the case when it comes in 

role with a program from a uC.

Even if the program is written in C for a lets say Attiny2313 you can't make it cross-platform app.

That specific app will work only on the Attiny2313.

 

At this point I ask me, how far should I go with learning C on a PC ?

 

- I don't need database manipulation on a PC if I wish to program a uC

- Even the commands are different on a uC and a PC C source code written in C

- On a PC I don't have to address a pin number or specially use a memory region or r/w to an eeprom

  from this point of view I think there should be a line between C learning for PC app development and uC app development.

 

Then only think what are the same in both code are the structure of the writing and maybe the editor.

 

I don't know if I could present good enough my thinking because of language barrier but I hope so.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jodank wrote:
At this point I ask me, how far should I go with learning C on a PC ?

As has already been said, what you need to learn is the language - that is, its syntax & semantics.

 

ie, the stuff in a book like K&R.

 

That is the same irrespective of what application you end up using it in.

 

- I don't need database manipulation

That is nothing to do with the language.

 

 

- Even the commands are different on a uC and a PC C source code written in C

No, they aren't.

 

Apart from a very few extensions, the language is the same irrespective of the target platform.

 

- On a PC I don't have to address a pin number or specially use a memory region or r/w to an eeprom

Again, that is nothing specifically to do with the language.

 

 

  from this point of view I think there should be a line between C learning for PC app development and uC app development.

You use the same language for each - you just apply it in somewhat different ways.

 

 

Then only think what are the same in both code are the structure of the writing

That is the language; ie, the syntax & semantics.

 

and maybe the editor.

The editor is irrelevant.

 

Maybe you're thinking of the rest of the toolchain - compiler, linker, etc ?

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jodank wrote:
At this point I ask me, how far should I go with learning C on a PC ?
Jump when you feel you are ready.

What worked for me -

  • Worked through most of the examples "problems" in a computer language textbook on a minicomputer
  • Transitioned to that computer language's cross-compiler on same minicomputer
  • on-the-job training (iow self learning) of the embedded system's debugger

jodank wrote:
I don't know if I could present good enough my thinking because of language barrier but I hope so.
Your messages are getting through.

Communication is two-way; if you do not comprehend then please state that.

Welcome!

 

Edit: strikethru

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Thu. Mar 8, 2018 - 06:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No no!
I will go through the book from K&R.

I really like it and even if it is written in English (which is not my major language) I clearly understand it.

 

You are guys really the best, I wish we could sit down together and drink a beer or coffee or whatever and chat around... smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

 In 2018 I personally would recommend everyone start with C++ rather than C

 

awneil wrote:
The downside of that always used to be that C++ is still a "minority interest" at this level

 

Survey quoted at https://www.avrfreaks.net/commen... suggests 70% C; 20% C++

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jodank wrote:
- On a PC I don't have to address a pin number or specially use a memory region or r/w to an eeprom

 

Yes, direct access to memory mapped registers is something you won't be able to do in a PC. A protected mode OS (that is anything in use today) would never allow it, just scream "access violation" when you try to execute such a program. On AVR you will not have an OS most of the time.

 

So you will never find (rather advanced) constructs like:

*(volatile uint8_t *) 0x10

in a PC program.

 

But other than that I think you can test every aspect of C in a PC.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Survey
most of which is legacy. No serious software developer is going to start out with C rather than C++ these days. This is 2018 not 1988!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
In 2018 I personally would recommend everyone start with C++ rather than C

 

Your argument about code structuring is very good, but let me tell you that the whole class thing can create enormous confusion, especially when inheritance comes into play.

I'm in the last year at a university of applied sciences, studying electrical engineering. We learned programming in four modules:
Programming in C in the first semester, programming in C++ in the second semester, "general software engineering and project management" in the third semester and "object oriented analysis and design" in the fourth.

I personally struggled only very little with that, as I had prior experience. But my classmates who saw this stuff for the first time, they were overwhelmed.

After half a year with C, people still had trouble understanding the most basic concepts of programming: things like pointers were magic to some of them. And then came classes, inheritance, references, templates, ...

So I guess starting with C++ could go very wrong. As long as procedural programming isn't fully understood, you should not confuse the mind with objects.

C++ is however the next logical step once someone comfortable with C. One should definitely learn it. But learning C++ also involves learning about object oriented design, otherwise one can hardly use the concept to it's full potential.

 

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

 

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
most of which is legacy. 

Accepted - see #40

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pawi777 wrote:
my classmates who saw this stuff for the first time, they were overwhelmed.

But the OP is familiar with VB which, AIUI, does OO ?

 

 people still had trouble understanding the most basic concepts of programming

Again, the OP already has programming experience

 

 

EDIT

 

Someone posted a video here a couple of months back about why starting with 'C' is a Bad Idea ...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Mar 8, 2018 - 11:19 PM

Pages