Jump to content
 
  • entries
    31
  • comments
    46
  • views
    22,061

Contributors to this blog

About this blog

Over the years programming microcontrollers we have noticed that some problems keep on popping up again and again.

In this blog we will try to address these problems like floating point numbers, concurrency, pointers, interrupts, CRC calculations, sign extension etc. over time. These blogs will not aim to be a full reference, instead they will introduce the problems, explore what can go wrong, show some ways to avoid these problems and provide a load of external links which the reader can go explore for a thorough education on the topic.Although these topics are explained in the context of embedded programming they actually carry over to any kind of programming, but somehow embedded programmers have fallen prey to these more often, perhaps because there is not a lot of material published on these in Embedded Programming communities, until now!

Entries in this blog

Schedulers, Timers and RTCOUNTER

Whenever I start a new project I always start off reaching for a simple while(1) "superloop" architecture https://en.wikibooks.org/wiki/Embedded_Systems/Super_Loop_Architecture . This works well for doing the basics but more often than not I quickly end up short and looking to employ a timer to get some kind of scheduling going. MCC makes this pretty easy and convenient to set up. It contains a library called "Foundation Services" which has 2 different timer implementations, TIMEOUT and RTC

Orunmila

Orunmila

Tokenizing Keywords - Part 2

When we left off we had just built a test framework that allowed us to quickly and easily try out different ways to identify NMEA keywords.  The first method shown was a brute force string compare search.  For this week, I promised to write about an if-else decoder.  The brute force search was all about applying computing resources to solve the problem.  This approach is all about applying human resources to make life easy on the computer.  So this solution will suck.  Let us press on. The

N9WXU

N9WXU

Tokenizing Keywords - Part 1

This is the first of a 5 part article where I will explore some different ways to tokenize keywords.  This is a simple and common task that seems to crop up when you least expect it.  We have all probably done some variation of the brute force approach in this first posting, but the posts that follow should prove interesting.  Here is the sequence: Part 1 : STRCMP Brute Force and the framework Part 2 : IF-ELSE for speed Part 3 : Automating the IF-ELSE for maintenance Part 4 :

N9WXU

N9WXU

Using the MPLAB-X Simulator to debug UART code

One feature of MPLAB-X which is not nearly used enough is the Simulator. It is actually very powerful and useful for testing and debugging code which will run on your board and interact with the outside world via external stimuli. There is more information on the developer help site here http://microchipdeveloper.com/mplabx:scl This is how you can use the IDE to debug your serial command line interface code using stimulus files and the UART OUTPUT window. The first trick is to enable t

Orunmila

Orunmila

Duff's Device

What every embedded programmer should know about … Duff's Device "A trick used three times becomes a standard technique" (George Polya) C is a peculiar language and knowing the internal details of how it works can be very powerful. At the same time, when we say things like that of course we first think of the Story of Mel which we wrote about before, so be careful not to write unmaintainable code! Probably the most famous "trick" in C is something called  Duff's Device. It was d

Orunmila

Orunmila

Floating Point Numbers

What every embedded programmer should know about … Floating Point Numbers "Obvious is the most dangerous word in mathematics."  E. T. Bell “Floating Point Numbers” is one of those areas that seem obvious at first, but do not be fooled! Perhaps when we learn how to do algebra and arithmetic we are never bound in our precision in quite the same way a computer is, and when we encounter computers we are so in awe by how “smart” they are that it becomes hard to fathom how limited flo

Orunmila

Orunmila

×
×
  • Create New...