HOME  |  NEWS  |  BLOGS  |  MESSAGES  |  FEATURES  |  VIDEOS  |  WEBINARS  |  INDUSTRIES  |  FOCUS ON FUNDAMENTALS
  |  REGISTER  |  LOGIN  |  HELP
Comments
You must login to participate in this chat. Please login.

I group all my registers, ports, etc. by class in C_plus_plus because I find that the fucntions of non-trivial devices, like SPI, I2C, FLASH controllers, etc. can be spread all over the place. So I group them by functionality. I also don't need initilaiztion functions. I use the constructor to initilaize the object (with possible arguments). That way, one cannot use a device without it being properly initialized. This also means that there is zero overhead to reuse the code elsewhere.

Iron

Preference to configuration table

depends on the code flow, both

Script languages overview

Good course. Thanks Jacob.
Thank You Ann, Design News and Digi-Key.

Iron

 The best way to spell check is to hit "post" - every error jumps out at you.

How about - getting started with each of the popular IDE/development platforms?

Either a day for each one or a series for each one.

Getting the bits and bobs connected together,

gettting the configuration right,

and a getting a program download/running/emulated can be a daunting task.

 

Programming the parts in a production environment could be a nice session all by itself.

 

Now about - getting started with each of the popular IDE/deveopment platforms.

Either a day for each one or a series for each one. Getting the bits and bobs connected together, gettting the configuration right, and a getting a program download/running/emulated can be a daunting task.

 

I like the human readable form of the configuration table. It's more intuative, easier to relate to your target system.

Iron

I would rather have a configuration function that looks like the function on Slide 8.

Iron

Other topics? Use/applications of DSP in embedded development.

Iron

thanks everyone for posting links to tools you've used & liked -- some seem obscure (or, at least, *I* haven't ever come across), perhaps because they're niche? but definitely worth looking into. I have some good research to do now!

Iron

UML is good for business logic, which is rather for application software i think... and of course using UML without an OO language is of little use

Iron

Just wanted to get a general idea of its use.  I did a course in UML years ago, but found it isn't generally used in embedded systems projects, maybe because of lack of design / acceptance / size of projects (small)....

@EmbeddedAtHeart, YES! UML is a general technique for abstraction, no matter the application (embedded or otherwise.)

Hello from Beaverton, Oregon. Had a schedule conflict, catching up now...

Iron

Does anybody actually use UML for embedded development?

 

(Not Just diagrams - MODELS!)

i suppose its like mind mappish?

 

Iron

For UML diagrams:
Free: Astah Community: http://astah.net/editions/community
Commercial (reasonable price): Enterprise Architect: http://www.sparxsystems.com/

Diagrams in general, not specifically for state diagrams and its free... :o)

tool for statediagram @embedded?

 

Iron

Another good one is Xmind...

yes i would like to know about tools for diagrams too, other that visio wich is too bloated for a scratchpad style use for code

Iron

@EmbeddedAtHeart. This is an FSM tool that we used in various projects:
http://robertolanuza.tripod.com/fsm/fsm.htm

These are some recorded WebEx tutorials on how to use the tool:
http://qbx6.ltu.edu/sweet/Tools/FSM/

Link to free WebEx player/recorder (download the version for .WRF files):
http://www.webex.com/play-webex-recording.html

IAR.com has alot of info on State machine IDE's.

Iron

Thanks Jacob, Ann, and Digi-Key

Iron

i clicked on the link and now coming back to this page the chat is rolling up, taking like 5 minutes

Iron

Jacob: You mentioned some tools for state diagrams etc in one of the earlier lectures.  Can you please elaborate more on these, i.e. provide some links etc?  Thank you...

TI Grace at: http://www.ti.com/tool/grace 

Grace – Graphical Peripheral Configuration Tool

Iron

Grace is part of Ti's code compose studio a IDE.

Iron

can you elaborate on "grace" IDE.  Don't think I'm familar with it

Blogger

If you have C+ I would use those techniques but in C this has proven very useful.  You can do OO in C but it gets so complicated it becomes hard to understand which destroys the idea of simple, readable code.

Blogger

Lol. It's a greate show. Thanks for the lectures too, especially today's. I often find it difficult to arrive at a generic solution when I'm working on a specific problem. I'll try to free my mind.

Iron

Thanks Jacob, 

Would you said that Ti 's "grace" IDE uses configuration tables and init configs as part of this method ?

Iron

Duh, can you explain the syntax in the last line on Slide 20?

 

So the channel/NUM_PINS_PER_PORT is getting the pointer array entry to the hardware.  Then channel is moduls so that we get the entry in the port (i.e which pin of 8 is it?) then we shift over to access the correct bit

Blogger

Thanks so much for the presentation this week!

Iron

Jacob about config tables: do you put them in the header or just some typedefs, or all into the .c?

Iron

Jacob:  what is your opinion on using an Object Oriented approach instead of using these types of confiuguration tables and such, if you have a C+ compiler that is reasonable?

 

Iron

Thanks Jacob, Ann & Digikey.  Great seminar.

Iron

Yes so you would create separate configurations for SPI, PWM, I2C, etc.  But the I/O pins and the direction and function would be controlled by the DIO or GPIO peripheral

Blogger

last question - right side operand is computing a mask unncessarily.  unless the compiler optimizes this into an array lookup for the mask values, the shift operation is a waste of compute.

Why does this one use NUM_PINS_PER_PORT when none of the others did?   For I/O you could have 8, 16 or 32 pins per port which is used to determine when to move to the next element in the pointer array!  

Blogger

Jacob- from today, it looks like you would write the config table code for the project as a whole from this example.  (initializing SPI, analog, GPIO from the same spot)  I like to write separate initializations for each driver I use - so SPI would be initialized in the SPIinit function inside the SPI driver, DIO would be initialized in the DIO driver, etc.  What are your thoughts on this method?

 

Iron

Duh, can you explain the syntax in the last line on Slide 20?

Gold

Thanks a lot Jacob and Ann.

Iron

Your welcome!  I appreciate everyones participation!

Blogger

Thank you for the week.

Iron

As you look at the material please feel free to post here or email me anytime!  I will try to peridically check this check over the next few weeks ... email would ensure a quicker reponse

Blogger

Thank you so much for the excellent series of your lectures this week, Jacob!

I prefer a forced initialization (say all 0) which is a safe (fail safe) state for the system, H/W being set to expect this (pull downs, etc).  Then load a value for operation.

 

Iron

Also see how easy it is to FIX!

YES!!!!  Someone got it!  You are the first one!

Blogger

Yes LED_RED not  RED_LED!   Start general and then move to the specific!  See how easy it is to slip!

Blogger

Thanks Jacob and Digi-Key

Good work!

Iron

Excellent lecture Jacob - I have learned a few new tricks I will use for sure.  Thank you...

 

If you already answered, I missed it.  What's with the pineapple?  Are you a psych fan?

Iron

Thanks! I want more! Good job.

Iron

Thank you Jacob, Ann and Digi-Key

Gold

Thanks Jacob great job

Iron

Appreciate the presentations.

Iron

Thanks Jacob, Ann and DisgnNews

Iron

Thanks for the info. 

Iron

Jacob thank you for a very informative series. Lots to learn and change

Thank you Ann and Design News

Thank you Digi-key

Iron

yeah thanks jacob, i learned something today

 

Iron

THank you for the lectures

Thanks. Good material.

Iron

Short week next week. Enjoy the holidays, y'all

Another excellent lecture, Jacob. Many thanks...

Iron

Thank yo Jacob & Ann, Jacob you make it look so easy.

Iron

Very nice structured code.  I will definitely study this.  Thanks Jacob!

Iron

Great series, added lots of tips that make sense.

Iron

Thanks for the Lecture and the series.

Iron

Great series of presentations Jacob!  Thanks!!

This has been one of the best presentations.  Thanks, Jacob.

Iron

init uses the NUM_PINS_PER_PORT too

Iron

LED_RED is the enum name, not RED_LED.

Thanks,

Jacob, Ann, DesignNews, and Digi-Key for a

Very very good presentations, from Monday to Friday.

 

 

Iron

yeah the hardware div, NUM PINS should be power of 2

 

Iron

Why does this one use NUM_PINS_PER_PORT when none of the others did?

Read/modify/write could involve problems with critical regions.

Use of division and modulus

Iron

We are now on Slide 21

Blogger

Jacob's question was: Does anyone listening notice anything about this line of code?  Any performance issue concerns?

Blogger

We are now on Slide 20

Blogger

We are now on Slide 19

Blogger

Compiler would error on missing commas. Usually the cut and paste errors I've seen end up with

extra commas, because the last one sometimes gets added from a copy above.

We are now on Slide 18

Blogger

Benjamin, that's why I put the commas on the left. They are separators, not terminators.

We are now on Slide 17

Blogger

(comma after PORTA_7 on slide 15)

I like Human readable codes because they are understandabe and maintainable

Iron

Prior question - prefer an init function.

We are now on Slide 16

Blogger

jacob: where is the acronym table put?

Iron

The configuration table method is a lot more work the first time, but if you do it right and use the same micro family for several projects it could be a big win.

Iron

We are now on Slide 15

Blogger

Human readable code should be the goal in every case except for when some strange system or language construct forces you to do otherwise.  Let the compilers do what they are good at and carry the burden for the machine's needs.

human readable is better if the code is being passed to other users to modify. When writing code with a datasheet in front of me i tend to write it individually.

Iron

readability make knowledge transfer a NO OP :)

Iron

Thank you very much! Logging out.

Iron

It will be MUCH easier in the long-run!

 

Iron

Do you like how human readable this code is?  What are some advantages to having code written this way?  Any disadvantages?

Yes I love how human readable that code is.  Makes it very easy to understand for a new person to look at this code and realize what exaclty is going on.  Disadvantage would be it takes more time to have to set up a table like that.

Iron

I prefer this, it provides maintainability and readabilty

Iron

Makes sense. Makes it easier to someone else to pick up the code to change or even come back a year later and make mods without going into detail of the code.

Iron

The higher the level of abstraction at which you work, the better off you are.

Gold

A number of vendors now have configuration wizards that take care of the IO configuration; Renesas, Silicon Labs TI and ST, to name a few.

Platinum

I like this coding style

Iron

We are now on Slide 14

Blogger

More portable, more easily shared between multiple developers, easier to maintain after familiarity with the code decrease with time

Iron

I like the human readable code.  It is too difficult to maintain raw register access code.

Iron

Understandability, Maintainability, Extensibility

Iron

More easily maintained by others later on

Iron

let me think about it

Iron

The way presented is less error prone. : )

Iron

Yes.  I use this same method.

Iron

We are now on Slide 13

Blogger

@78RPM, NO!  The enum value starts with the value 0, so NUM_TIMERS will always have the value of the total number of elements in the enum - IF it is always the last element in the list.

 

Very readable! I prefer this.

Iron

no never go back again

Iron

Jacob's question was: Do you like how human readable this code is?  What are some advantages to having code written this way?  Any disadvantages?

Blogger

Tmr?  I'd like to buy some vowels, please.

Iron

NUM_TIMERS MUST always be the last element in the list - it gives you number of timers...

 

I prefer to put the comma separator delimiters in front of each line, where they don't get lost. Like:

typedef enum ZZ_class

   {
     ZZ_one

   , ZZ_two

   , ZZ_three  // comment where needed.


   , QUAN_ZZS  // number of entities assuming first one is 0, like in C.
   } ZZ_inst;

Only the first one is special, without a leading comma. Some compilers ignore extra commas, some dont.

 

Good point JCheetham. If the purpose is to set up pins as input or output I just define a variable as a binary to show which pins are in and which are out. Then move that var into the PORTB or whatever.

Gold

??On slide 11, wouldn't it make more sense to have NUM_TIMERS as the first item in the enum?  That way it is always in the same location within the enum.

Iron

NUM_TIMERS MUST always be the last element in the list!

 

We are now on Slide 12

Blogger

i like the initialization function

Iron

I like to use individual

Iron

when i first started writing code i preferred individual because it was much easier for me to understand what was goin on but now that i have a better understanding of how to code i like the initialization

Iron

We are now on Slide 11

Blogger

When I initialize registers, most have different values so the code on slide 8 will not work for that.

Iron

For the MCU specific registers, I prefer individual settings, but for the application level system configuration variables, I use arrays and structures.

I'd rather use an initiliazation function like the one showed

Iron

How do you start the timers so that they will the timers be in sync with each other?

Iron

We are now on Slide 10

Blogger

I prefer this in most circumstances - there are always exceptions :-)

Iron

Depends on whether I want to know what teh code is doing by looking at it.  The table seems more efficient.  I suppose that once I get used to it I would be more comfortable with it.  So, I'll vote for the Table method.

address each register within the peripheral by name and then set it/initialize it to the desired value

Iron

prefare initialization function 

Iron

prefer to set register individually.

Iron

depends on how often it needs to be changed.  If never changed, looping though a list is fine.

 

Iron

pointer array is cleaner for itializing

epends on situation but generally function

Iron

Loop is better but why can't I use memset?

Iron

would like to have what looks like your code, as oppose to setting every register

Iron

Advantages of both ways - this adds a layer of abstraction between the HW and SW

Iron

This way is good but it needs to be commented

Gold

Individually is sometimes easier to understand on the lowest level...

 

Iron

I would use the one in the example

Iron

I like this example on slide 8

Iron

initialization function

Iron

Your pointer example looks much simpler

Iron

not yet, I have done individual initialization

Iron

I'd like to see more information on microcontrollers and networking.

Iron

Jacob's question was: Would you rather have an initialization function like this or individually set every register?

Blogger

Barebones Internet of Things Start to Finish

Iron

Good afternoon from West Point, PA.

Iron

For future revs of this talk, maybe talk about how you use source control to manage dependencies between reusable software components

We are now on Slide 8

Blogger

Hello from Milwaukee!

Iron

what is the element in the array on the example slide 6? Comma seperated?

We are now on Slide 7

Blogger

We are now on Slide 6

Blogger

We are now on Slide 5

Blogger

Debugging when hardware is not evailable, and I/O must be simulated.

Iron

DSP, Uart ans USB application.

Iron

We are now on Slide 4

Blogger

UML and Model based programming

Yes, DSP. Optimized for FPU.

Iron

Start from scratch, using an RTOS with an associated IDE that are available at no charge (e.g. MQX). NOT starting with an example project.

Iron

Interested in CAN networks

Gold

We are now on Slide 3

Blogger

Unit testing methodologies and tools for embedded programming.

Iron

Placing code in specific sections of flash!

Iron

Using Xilinx Zynq tools (Vivado)

Iron

Probably more about microcontrollers

Iron

Interested in more detail on software reuse.

Iron

We are now on Slide 2

Blogger

Good afternoon from sunny 70 degree richmond va

Iron

Jacob's question was: What other topics would you be interested in hearing about?

Blogger

We are now on Slide 1

Blogger

Hello from Toronto, Ontario!

Iron

Hi all -Audio is live! If you don't see the audio bar at the top of the screen, please refresh your browser. It may take a couple tries. When you see the audio bar, hit the play button. If you experience audio interruptions and are using IE, try using FF or Chrome as your browser. Many people experience issues with IE. Also, make sure your flash player is updated with the current version. Some companies block live audio streams, so if that is the case for your company, the class will be archived on this page immediately following the class and you can listen then. People don't experience any issues with the audio for the archived version.

Greetings from Seattle ...

Iron

Good morning from Reno, NV.

Iron

Hello everbody from Coventry (UK)

Iron

Good Afternoon, from Ottawa, Canada

Iron

good morning everybody!

Iron

Hello, good afternoon everyone!

Iron

Greetings. Just had our Thansgiving lunch at work. The company provides the turkeys, employees provide everything else. Now I just have to stay awaaaakkkkkkeeeee......

Iron

Hi From Raleigh, one more time. : )

Iron

Hello from cold (28F) and windy (30, G55 mph) Albuquerque.

Iron

Hi from Melbourne Australia

 

On vacation today but this is too good to miss. Logged in from home.

Iron

Hello from Oxford, OH

Iron

Hello. Finally getting to the good stuff!

 

Iron

Good morning from Albuquerque. High today is 35F!

Iron

Be sure to follow @designnews and @DigiKeyCEC on Twitter for the latest class information. We encourage you to tweet about today's class using the hashtag #CEC.

Blogger

Please join our Digi-Key Continuing Education Center LinkedIn Group at http://linkd.in/yoNGeY

Blogger

Hello from the mountain forest of Montana

Gold

Happy Friday. Looking forward for another great lecture.

Iron

Hello from Summerville, SC. How is everyone doing?

Iron

The streaming audio player will appear on this web page when the show starts at 2 PM Eastern time today. Note however that some companies block live audio streams. If when the show starts you don't hear any audio, try refreshing your browser. If that doesn't work, try using Firefox or Google Chrome as your browser. Some users experience audio interruptions with IE. If that doesn't work, the class will be archived immediately following our live taping.

Blogger

Hi from Huntsville, Alabama.

Hi from Ann Arbor, MI

Iron

Happy Friday from sunny but windy San Ramon, CA!

Good morning from Mobile, AL

Be sure to click 'Today's Slide Deck' under Special Educational Materials above right to download the PowerPoint for today's session.

Blogger

Greeting from Frigid Minneapolis.

 

Hello from El Paso, TX

 

Iron

Hi from Panama City FL.

Iron

Good morning from Scottsdale, AZ

Iron

Greetings from Chicago

Iron

Morning from Portland Oregon

Iron

Hi from Beaverton, Oregon. Getting the slides.

Iron

Title sounds like an interesting session.

Iron


Partner Zone
Latest Analysis
Advertised as the "Most Powerful Tablet Under $100," the Kindle Fire HD 6 was too tempting for the team at iFixit to pass up. Join us to find out if inexpensive means cheap, irreparable, or just down right economical. It's teardown time!
The first photos made with a 3D-printed telescope are here and they're not as fuzzy as you might expect. A team from the University of Sheffield beat NASA to the goal. The photos of the Moon were made with a reflecting telescope that cost the research team 100 to make (about $161 US).
At Medical Design & Manufacturing Midwest, Joe Wascow told Design News how Optimal Design prototyped a machine that captures the wing-beat of a duck.
The increased adoption of wireless technology for mission-critical applications has revved up the global market for dynamic electronic general purpose (GP) test equipment. As the link between cloud networks and devices -- smartphones, tablets, and notebooks -- results in more complex devices under test, the demand for radio frequency test equipment is starting to intensify.
Much of the research on lithium-ion batteries is focused on how to make the batteries charge more quickly and last longer than they currently do, work that would significantly improve the experience of mobile device users, as well EV and hybrid car drivers. Researchers in Singapore have come up with what seems like the best solution so far -- a battery that can recharge itself in mere minutes and has a potential lifespan of 20 years.
More:Blogs|News
Design News Webinar Series
10/7/2014 8:00 a.m. California / 11:00 a.m. New York
9/25/2014 11:00 a.m. California / 2:00 p.m. New York
9/10/2014 11:00 a.m. California / 2:00 p.m. New York
7/23/2014 11:00 a.m. California / 2:00 p.m. New York
Quick Poll
The Continuing Education Center offers engineers an entirely new way to get the education they need to formulate next-generation solutions.
Oct 20 - 24, How to Design & Build an Embedded Web Server: An Embedded TCP/IP Tutorial
SEMESTERS: 1  |  2  |  3  |  4  |  5  |  6


Focus on Fundamentals consists of 45-minute on-line classes that cover a host of technologies. You learn without leaving the comfort of your desk. All classes are taught by subject-matter experts and all are archived. So if you can't attend live, attend at your convenience.
Next Class: 10/28-10/30 11:00 AM
Sponsored by Stratasys
Next Class: 10/28-10/30 2:00 PM
Sponsored by Gates Corporation
Learn More   |   Login   |   Archived Classes
Twitter Feed
Design News Twitter Feed
Like Us on Facebook

Sponsored Content

Technology Marketplace

Copyright © 2014 UBM Canon, A UBM company, All rights reserved. Privacy Policy | Terms of Service