This is my first road test for Element 14 and I am reviewing Udemy course: Microcontrollers and the C Programming Language. I going to try to document my progress through this course as I move through the each of the sections. My personal goal is pass my experiences with the course to help others decide if this format will help them in their learning.
My initial view of the training concept is great. I am a self taught maker and I have been using Element14, blog posts and YouTube to figure out how things work. I never would have gotten this far in electronics without these sites. I love the fact that people take the time to post videos on Arduino and electronics but some people are better than others as with anything. Udemy has created a set a tools to format the material so all the videos are same in structure. What appears to be the strongest point with Udemy is the course materials that can go with course. With YouTube I would watch the video then hope there is a link to a website with documentation. Udemy appears to have cracked the code to this problem and my hopes are there are enough quality instructors to make this format work. The coolest part of Udemy is the cost. I looked at some of the other courses they offer and the cost is very reasonable. From my initial review of the site this looks like it will become a goto for me when I need to figure something out.
Registration and Setup.
The registration process was very easy. The account creation process too about five minutes and my course was up and running. The menu navigation is very easy to use. I really like that the documentation for the each lecture is listed right below the video link. I am looking forward to going through this course. It is time for me to start working on the course and I will check back very soon to let everyone know how everything is going.
My expectations from the course:
- Learn to interact with microcontrollers - Timers/Interrupts/Serial/ADC. I have some experience with PIC and ATMEL chips and I am looking forward to working with TI chips. I am eager to learn about the MSP430FR family of microcontrollers from TI. The nice thing about microcontrollers is they all work very similarly. My take away here is I want to learn the basics of interacting with the microcontrollers. Programming is my strong suit and I have learned that once you learn what a for loop is, it is the same in every other language. The only difference between languages is the syntax, so the only thing I need to do to switch between languages is to figure out the syntax. Microcontrollers from my expierences are the same. The principles of how the ADC works is the same across microcontrollers but how to interact with the ADC is a little different from chip to chip.
- Learn the MSP430FR family of chips. Looking at the datasheet and the cost of these chips make this a very good solution for my projects. I have out grown Arduino and I am looking for more speed and peripherals and the MSP430FR family appears to be a solution for this. I have played with PIC and ATMEL chips and my personal experiences are I like ATMEL a little better. ATMEL's IDE is easy to use and is based on Visual Studio so the learning curve for me was very easy. I am hoping that the TI family of chips will open up new opportunities for me. My take away here is to increase my tool set so I can choose the best hardware for the problem.
Section 1: Introduction
Not a lot to say here. Covered the basics of a microcontroller and how to setup Code Composer Studio. The documentation was great and the hardest part was downloading and setting up CSS. I ran into no issues in setting up CCS and I was able to run the "Hello World" of microcontrollers, blinking a LED my first try. I was surprised how easy it was to get everything working. I would compare the ease of this to Arduino. I really like to course format and the documentation was very easy to follow and read. For beginners I would still recommend starting with Arduino just because of the size of the community but when you start looking for more the ease of getting started with the MSP430 family of microcontrollers is looking to be very promising. Compared to the issues I have had with PIC and ATMEL this was a breeze to setup and get running. This may be due to the fact that I have learned alot since I started playing with chips but as of now I may change my goto chip the MSP430 family. TI has done a really good job of making things easy.
Section 2: Binary Numbers and Digital Logic
This section was a review for me. The material covered did a good job of explaining binary, hexadecimal and digital logic. The methods used to explain the information where the same as I was formally taught in college. The best part of how of the course was using CCS to show how everything worked. Copying the code from the handout to into a CCS program then using the debugger to show how the variables changed is a very cool tool to show how CSS debugger works and what happens in the code. When I was taught this in college we just did a lot of practice problems on paper. Integrating CCS into the process will help new programmers to understand what is happening in the code because it shows them. I really like the idea of using the IDE to explain what is happening. Seeing results in front of you really helps. I really like this format for teaching. Traditional teaching is still needed but this format is great for continuing education or just learning something new without breaking the bank.
Section 3: What's inside a Microcontroller
Learned something new in this section. It was short and to the point but did a very good job explaining all the parts of a microcontroller. I have taken a traditional a college class on microcontrollers (PIC) and this course did a much better job of explaining the parts than the course I took. Up to this point I have had a hard time pulling myself away from the course. The structure is perfect for learning mixing videos with hand outs. The way the material is presented is very interesting. It has taking me about 3 hours to go through everything up to this point and I had no clue I have sitting here this long until I looked at the clock. I am really enjoying the course so far. Comparing this to course to the "Intro to Microcontrollers" college course I took two years ago this course blows away the college course. This format is great for learning and I wish the college I earned my degree at used this format. Udemy really found a good market and I will definitely be looking at more course from them.
Section 4: Loops in the C Programming Language
This section was review for me so I skimmed through it. The information was well documented and liked the challenge example. I did try the challenge section in order to become more fimialar with the IDE. This section does a very good job of explaining Loops.
Section 5: Digital Inputs, the P1.1 Button, and the IF Statement
I took my time here as I needed to learn the syntax. The concepts here are very easy but my experience with other microcontrollers made this section a little harder to understand because things are done a little different. My experience with PIC used assembly to program the chip, so I dealt with the registers using hex. I would convert the binary number of the register to hex than set the register to this. The code from this section started with BIT Logic, which threw me for a loop. The instructor did not call a mask what it was. It took me a little time to figure out that variable he was using was a mask. Once I worked through those minor bugs everything fell into place. The second coding exercise started using BIT shifting. The syntax for this is different than how AVR does it but the concept is the same. Again the hardest part was figuring out the syntax. A new programmer should have little trouble as they should just accept what they see and not question because they will not have anything to compare it too. I wanted to figure out what was happening so I spent some time testing different things until I understood.
Now for the material. It was presented in an easy to understand format and was great. My PIC microcontroller class did not cover the material anything like this. I had to figure it all my own. The method I ended up using to teach myself how to manuipulate the registers was the same method taught in this class. I started by using excel and configuring it to display 8 blocks, one for each bit. I would then turn on or off the bit(s) I wanted, convert to hex and use that. This is how this instructor started teaching then referenced this method through out the rest of section. I think this method is a great way to teach this topic. Start by working the hex numbers, then move to binary logic to turn on or off the bits then end up with bit shifting. I enjoyed this section and I learned some new things while debugging the code.
Note for new programmers, comment your work in great detail. If you take a break, a day or two or more and come back to it the comments will help you to remember what you where trying to do. As a programmer the comments in the code examples are not detailed enough. If the instructor added what he was trying to change in the registers it would have made my life easier working through the syntax. I spend almost as much time ensuring my comments are as clean as my code. It takes time but in the long run it will save time when bugs appear. If you are going to do this professionally your code will be given to other people and if your comments are clean and easy to read it will save them time trying to figure out what you are trying to do. Start commenting your code now so it becomes a habit.
Section 6: Timers
Nothing big here, just a very short intro on timers.
Section 7: Introduction to the Watchdog Timer Peripheral
I was little disappointed here. I was hoping to cover the math behind setting up the watchdog timer. No big deal and I understand why it was not covered. An oscilloscope is used to to see how the watchdog timer works and show that it is faster than we can see. The instructor has nice screenshots from their lab oscilloscope. If you are lucky enough to have one use it if not the screenshots show the point.
Section 8: Introduction to the General Purpose Timer
This section did a very good job of covering the timers. Covered the basic math for the timers and then went into how to use the timers to reset the watchdog timer. The math for the timers on the MSP430FR6989 is soooooo much easier than ATMEL and PIC. This section did not cover changing the frequency of the timers it just used the default setting of 25 microseconds. I sure once I dive into the data sheet of the MSP setting the pre-scaler for the timers gets a little more complicated but so far this course is not covering the timers that in depth. Up to this point I really like the MSP430FR family of chips. The IDE is not as clean as would like, but I am coming from computer programming side. I am still working through the debugging features of the IDE, but what I have figured out so far is very nice.
Section 9: Advanced Features of General Purpose Timers
Nothing really new presented here. More practice with the timers. This section focuses on using more than one timer. This section helps to re-enforce how to use the timers by showing the most common use of the timers. The lab here is using one timer to reset the watchdog timer while using another timer for something else. Running through the code is helping me transition from computer programming logic to microcontroller logic. This has been the hardest part of my transitioning from computer program to microcontroller programming. The logic is completely different. This course is what I needed. I just need to keep doing the examples and the challenge code then compare my logic to the instructor's logic and see where I am going wrong. I am slowing decreasing the lines of code as the logic starts to make more sense. My wife thinks I am going crazy because I spend so much time working on this, but as move through each section I find this stuff so interesting I want to work on the next section. I have to force my self to take breaks.
I have said this before but I can not say it enough. Start with Arduino to learn the basics but as soon as you grasp the concept, take this course it will help you to better understand what is going behind the Arduino code. I started this course thinking I would not learn too much until later on in the course because of what I have done in the past. I was wrong, I have learned so much on working with the registers and the logic even though the material up to this point has been mostly a review for me. I started this course with a firm understanding of working with the pins as input and output. I actually like working in assembly for the simple tasks of pin manipulation but as soon as you start using serial or I2C assembly becomes very cumbersome. As I said in the beginning of this blog my main focus is learning more about serial communication and the ADC. Once I get a firm understand of those basics I want to move into I2C. So far this course has taught so much more. I should have a good understand of the logic used in microcontroller by the end of the course.
Section 10: Using Functions to Improve Your Microcontroller Program
This section was a review for me. I did go over the handout and the instructor did a very good explaining how functions work. Be warned this sections lab is very long but take your time here, you will use functions in most of your programs. It makes things so much easier. You can place detailed comments in the function declaration to help you and other figure what you were trying to do. This will keep the main() very clean. My computer programing days I used functions for everything and my main loop was very clean and easy to follow. My small Arduino projects normally did not use functions but as my programs got bigger I off loaded the heavy lifting to functions.
Section 11: Introduction to Interrupt Service Routines
Another very good section. Covered the basics of how the Interrupts Service Routines (ISR) works. Examples where plenty and easy to follow. The challenge code tied back into previous code to help re-enforce other material. The more I work with code the easier the bit logic is becoming. Based on my experience do the work to learn the logic before using shortcuts. The Debugger is nice but it is a little difficult to look at multiple registers at the same time. All the registers can be seen but there is a lot of scrolling to see the different registers. PIC IDE is a little easier here but as with any IDE they have strengths and weaknesses. It is hard not to use the shortcuts, but each time I draw out the bit logic it becomes easier. I am trying to stick to the intent of the course so I only use what is being taught in that section, which is hard but it is nice programming refresher for me. It is very nice to have functions finally. Off loading my code to functions makes re-use easier. The next section is low-power mode. Looking forward to this as I am working a low power sensor project and I have done extensive testing on battery discharge rates and decided to power a 3.3V ATMEGA 328-PU straight from 2ea AA batteries. I want to switch from ARDUINO C to AVR C to better optimize power which what lead me to this course. The concepts are not that different from Atmel microcontrollers - will just have to re-learn the syntax but the theory is the same.
NOTE: Sorry had some work issues and I did not have the time to work on the class. I am back on track and I hope to finish in the next couple of weeks.
Section: 12 - Introduction to Low Power Modes
A high level overview of the low power modes. This section does not go into great detail about the low power modes but it does a very good job of explain of what the low power modes are used for and how to program the microcontroller to use them. This section took me longer to remember the syntax for the TI family of chips than actually using the low power mode. The comments I have used on previous examples is the only reason I did not have to relearn everything. Take away - ALWAYS comment you code it will save you time in the future.
Section: 13 - Interrupt Service Routines for Digital Inputs
This section is another high level overview. It builds upon the timer interrupts and shows a basic example of using the digital pins to trigger the interrupt. This section does not cover switch debounce in any detail other than using a simple delay. The instructor does provide a link to an in-depth article on how to deal with switch debounce which is helpful. Using the digital pins to trigger an interrupt is straight forward and very easy to implement but in order to use this method the user needs to be familiar with switch debounce, so I suggest reading the recommended article.
Section: 14 - Serial Communication Interfaces
This section covers UART communication. This section does a good job of explaining how to configure the microcontroller to send and receive data. To cover how to configure the microcontroller in detail the MSP430FR6989 Family User’s Guide is needed. There is a small section in the handout explaining what the sample program configurations are doing inside the microcontroller which is very helpful in understanding the user guide. I am using an analog oscilloscope so I had to modify the code repeatedly send the message out the TXD pin so I could see if everything was working. As you move through the sample program you will set up the microcontroller to look for a message on the RXD pin then turn on the red LED to validate that everything is working if you do not have an oscilloscope. This section was helpful in understanding UART but I would like to see a more advanced section on this. The documentation was very helpful though in translating the User Guide and I will most definitely reference the sample code again.
Section: 15 - Analog to Digital Converter
This section did a very good job of explaining the basics of how an analog to digital converter works. Be prepared when starting this section, it is long but it was the level of detail I was expecting. The first portion is an Ohm's law review. If you already understand how Ohm's law works this part will be straight forward. If you are not comfortable with Ohm's Law I would refresh your memory on how everything works somewhere else. The instructor provides enough supporting information to support how the analog to digital converter works but nothing more. My opinion is you should have a firm understand of analog electronics before trying to play with analog to digital converter. Without that base background you will not completely understand what is happening, which will make debugging your code difficult. Example, I setup my code but I had a typo and forgot to call my function to initialize the ADC. Using Ohm's law I was able to figure out what voltages where expected at each point of the circuit to test that my circuit was hooked up correctly. I put an Ohm meter at each point and confirmed that everything was working correctly. This took about 5 minutes of work. This told me the only place I could have made a mistake was in the code or the ADC was not working correctly. I then spent 5 minutes tracing out the code and figured out that the function to initialize the ADC was not called.
You do not have to be an electrical engineer to understand this. With circuit simulators today you do not even need to understand the math. You do need to understand that each component in a circuit effects that circuit and should have a rough idea of what those effects are. If you take the time to understand Ohm's Law before you start this section it will go fast and you will be able to understand what is happening in the background.
Section: 16 - Introduction to the Liquid Crystal Display
A decent overview of using the LCD. I would have liked to seen more hardware discussion here but I completely understand why it was done this way. The hardware parts of interacting with the LCD where done in a library and the course focused on using the functions to display the data on the screen. I skimmed through this section has using functions is pretty straight forward. I plan on going to into the library files later to see what is really happening in the background but that is outside the scope of this course.
Section: 17 - Final Project
Use your imagination here and have fun, that is how we learn.
Summary of what I learned:
Going back to my initial exceptions:
1. I did learn some here, not as much as I hoped as the course was geared to a little lower level. The piece I did learn from the instructor is microcontroller logic. I am transition from computer code and the logic is completely different. As I completed each challenge I would compare my logic to the instructors logic and by the third or fourth project I saw my logic shifting resulting in few lines of code. This piece was nice and something that will stick with me the rest of my career. I hope to see more advance courses in this subject area from the this instructor, I will definitely take those courses.
2. If you want to learn the basics of the MSP430 family of microcontrollers this course will be a great help by providing simple well documented examples. With the price drop it is well worth paying for the course just for the documentation to use as learn how to the MSP430 family of chips.
It is well worth the novice taking this course and for the advance users I would avoid the course unless you need to learn the specifics for the MSP430 family of chips.