Intro to Bare Metal Programming - Episode 9: Header and Source Files | Videos
Intro to Bare Metal Programming - Episode 9: Header and Source Files
In this episode we will break the USART driver from Episode 8 into header and source files. Using header and source files allows us to make our projects modular and we can reuse code so that we don't have to write every project from scratch. This also means that we can maintain our own library of drivers so we are not affected if an external library updates and breaks things. We will use header and source files in all of the episodes moving forward, and leverage them in our final project for this series.
Relevant Links:
AVR® DD Microcontroller Family: https://mchp.us/428Rxh1
AVR64DD32 Curiosity Nano: https://mchp.us/42q90BX
AVR64DD32 Device Page: mchp.us/45wmmiD
MPLAB® X IDE: https://mchp.us/3C06oQs
MPLAB XC8 Compiler: https://mchp.us/3WyEmF7
Chapters:
00:00 Intro - In the last video
00:30 In this video
01:00 Copy previous project and rename
01:31 Set new project as Main Project
01:41 Create new header file
02:22 Change include guard condition
02:42 Header file TODOs
03:01 Moving code to header file
03:30 Include new header file in main.c
03:49 Build project to check for errors
03:57 Create new source file
04:17 Move function implementations to new source file
04:30 Include header file in new source file
04:48 Build project to check for errors
04:58 Adding extra functionality to our new library
05:18 Using enums and enum datatypes from device header file in our new header file to create function prototypes
06:50 Using enums and enum datatypes from device header file in our new source file to create function implemetations
08:15 Basic testing of our new library
08:55 Program device and open Data Visualizer
09:05 What to do if first few characters are garbled
10:04 Decision on error checking and use of enum datatypes in function definitions and implementations
10:38 Viewer can extrapolate this process for MainClockCtrl function
10:49 In the next episode
#embedded #avr #microchip #microcontroller
To view this video, please click manage cookies below and accept functional cookies.
{"SalesForceSecurePath":"https://microchip.my.salesforce-scrt.com","EmbeddedServiceName":"Messaging_For_Microchip","SalesForcePath":"https://microchip.my.site.com/ESWMessagingForMicrochi1755319480924","AgentAvailableHeader":"No problem. Chat with our engineering experts or schedule a call that's convenient for you.","ScheduleCallUrl":"https://microchip.my.site.com/schedulemeetingportal/s/","SalesforceOrgId":"00Do0000000KAkK","JsUrl":"https://microchip.my.site.com/ESWMessagingForMicrochi1755319480924/assets/js/bootstrap.min.js"}