Before starting a programming tutorial i wanted to build a basic knowledge about embedded programming.
If you are designing windows applications in C, C++, C# ; data types are standard, your code can run on any machine running windows (if .net and other dependencies are supplied of course).
You don't have to know memory and peripheral addresses mostly. Bitwise operations are not common, you don't have to worry about cpu type, pin configuration, enabling clocks.
Probably you are not familiar with infinite while loop and RTOS (Real Time Operating System). Limited code and data memory restricts using big arrays.
Preprocessor directives and preprocessor macros are a little tricky usually. Portability is a big problem. If you write a program for STM32F1 even porting this program to STM32F4 can be pain in the ***.
1) Data Types
Don't get surprized when you see uint8_t, uint16_t etc. All type definitions are in stdint.h header file. Some of the definitions are below :
1 2 3 4 5 6 7 8 9 10 11 | /* exact-width signed integer types */ typedef signed char int8_t; typedef signed short int int16_t; typedef signed int int32_t; typedef signed __int64 int64_t; /* exact-width unsigned integer types */ typedef unsigned char uint8_t; typedef unsigned short int uint16_t; typedef unsigned int uint32_t; typedef unsigned __int64 uint64_t; |
2) Preprocessor Directives and Macros
Preprocessor directives and macros start with "#", sometimes you are going to encounter "\" character, it is used for line continuation. Some of the preprocessor directive keywords are :
1 2 3 4 5 6 7 8 9 10 11 12 13 | #define #if #else #elif #endif #ifdef #ifndef #include #line #message #pragma #undef #warning |
Take a look at these ebook :
https://gcc.gnu.org/onlinedocs/gcc-4.0.4/cpp.pdf
3) Microcontroller Dependent Register Names
Even if you are goint to use higher level libraries, it would be handy to know basic register names. In some tutorials and examples register based operations are used, for example below code does not mean anything to you if you don't know the register names :
1 | GPIOC->IDR & 0x0020 |
IDR is Input Data Register, this code reads Port C, Pin5. Below code is equivalent but easy to read.
1 | GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_5) |
4) Pin Configuration
Using GPIO pins is a little tricky for beginners at first. I am going to write a detailed gpio tutorial later but i want to make a brief explanation. Before using your MCU's gpio pins you have to make some effort, all pins are usually at floating input state initially.
- Enable clock for related port. (Port A etc.)
- Select related pins (Pin 0 etc.)
- Select Mode (Input/Output/Alternate Function/Analog)
- Select Speed (2-100Mhz)
- Select Output Type (Push Pull/Open Drain)
- Select Pull Property (Pull Up/Pull Down/No Pull)
1 2 3 4 5 6 7 8 | GPIO_InitTypeDef GPIO_InitStruct; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE); GPIO_InitStruct.GPIO_Pin = GPIO_Pin_0; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOC, &GPIO_InitStruct); |
Startup code is automatically generated by Keil and SystemInit function is called before main function. SystemInit function configures PLL parameters and sets the mcu at it's maximum frequency if possible.
Thank you!
ReplyDeletegreat
ReplyDeleteGood Post, I am a big believer in posting comments on sites to let the blog writers know that they ve added something advantageous to the world wide web.
ReplyDeleteSelenium training in Chennai
Selenium training in Bangalore
Wonderful bloggers like yourself who would positively reply encouraged me to be more open and engaging in commenting.So know it's helpful.
ReplyDeleteData Science course in kalyan nagar
Data Science course in OMR
Data Science course in chennai
Data science course in velachery
Data science course in jaya nagar
Data Science interview questions and answers
Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
ReplyDeleterpa training in bangalore
best rpa training in bangalore
rpa training in pune | rpa course in bangalore
rpa training in chennai
This comment has been removed by the author.
ReplyDeleteThanks For Sharing The Information The information shared Is Very Valuable Please Keep Updating Us Time just went On reading The article Python Online Training Aws Online Training Hadoop Online Training Data Science Online Training
ReplyDeleteThanks for sharing, nice post! Post really provice useful information!
ReplyDeleteAn Thái Sơn với website anthaison.vn chuyên sản phẩm máy đưa võng hay máy đưa võng tự động tốt cho bé là địa chỉ bán máy đưa võng giá rẻ tại TP.HCM và giúp bạn tìm máy đưa võng loại nào tốt hiện nay.
This comment has been removed by the author.
ReplyDeleteWow what a Great Information about World Day its incredibly charming instructive post. An obligation of appreciation is all together for the post.
ReplyDeletewhat is marketing, link building strategies, on-page seo best practices, balanced scorecard for marketing management, what is sales, is desire to buy emotional or rational decision, how i increased website traffic by 600 in 24 months, free internet marketing resources, free digital marketing resources
I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day!
ReplyDeletetrain collision avoidance system, traffic alert and collision avoidance system (TCAS), automatic train protection, automatic train protection (ATP), collision avoidance system manufacturers
Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
ReplyDeleteDevOps Training | Certification in Chennai | DevOps Training | Certification in anna nagar | DevOps Training | Certification in omr | DevOps Training | Certification in porur | DevOps Training | Certification in tambaram | DevOps Training | Certification in velachery
Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep to sharing .
ReplyDeleteAndroid Training in Chennai
Android Online Training in Chennai
Android Training in Bangalore
Android Training in Hyderabad
Android Training in Coimbatore
Android Training
Android Online Training
instagram takipçi satın al
ReplyDeleteucuz takipçi
takipçi satın al
https://takipcikenti.com
https://ucsatinal.org
instagram takipçi satın al
https://perdemodelleri.org
https://yazanadam.com
instagram takipçi satın al
balon perdeler
petek üstü perde
mutfak tül modelleri
kısa perde modelleri
fon perde modelleri
tül perde modelleri
https://atakanmedya.com
https://fatihmedya.com
https://smmpaketleri.com
https://takipcialdim.com
https://yazanadam.com
yasaklı sitelere giriş
aşk kitapları
yabancı şarkılar
sigorta sorgula
https://cozumlec.com
word indir ücretsiz
tiktok jeton hilesi
rastgele görüntülü sohbet
fitness moves
gym workouts
https://marsbahiscasino.org
http://4mcafee.com
http://paydayloansonlineare.com
Roulette - The Roulette Software & Software Review - Betting
ReplyDeleteRoulette. 아이벳25 The roulette software provides players with 저녁 메뉴 룰렛 a wide selection of different table games. The 888스포츠 roulette table features 실시간 스포츠 배팅 a lot of 꽁 머니 토토 사이트 popular games,
Casino 2021: Get a 50% deposit bonus up to €100
ReplyDeletePlay the 익산 출장샵 latest casino games from leading software providers 대전광역 출장안마 and offer a top casino bonus. Discover 동두천 출장안마 hundreds of casino games and 광양 출장안마 get 보령 출장마사지 up to 50%
mmorpg oyunlar
ReplyDeleteInstagram takipci satin al
Tiktok jeton hilesi
Tiktok Jeton Hilesi
antalya saç ekimi
İnstagram takipçi satın al
İNSTAGRAM TAKİPÇİ SATİN AL
metin2 pvp serverlar
İNSTAGRAM TAKİPCİ SATIN AL
PERDE MODELLERİ
ReplyDeletesms onay
mobil ödeme bozdurma
nft nasıl alınır
Ankara Evden Eve Nakliyat
Trafik Sigortasi
Dedektör
web sitesi kurma
ASK KİTAPLARİ
SMM PANEL
ReplyDeleteSmm Panel
is ilanlari blog
İNSTAGRAM TAKİPÇİ SATIN AL
Hirdavatci burada
Https://www.beyazesyateknikservisi.com.tr
SERVİS
Tiktok para hilesi
Good content. You write beautiful things.
ReplyDeletesportsbet
taksi
vbet
mrbahis
mrbahis
sportsbet
vbet
hacklink
hacklink
slot siteleri
ReplyDeletekralbet
tipobet
mobil ödeme bahis
betmatik
kibris bahis siteleri
poker siteleri
bonus veren siteler
betpark
OCS
kocaeli
ReplyDeletekonya
kuşadası
kütahya
malatya
6WJKQA
başakşehir
ReplyDeletebeykoz
gölcük
kütahya
bandırma
MRP5SF
Eskişehir
ReplyDeleteDenizli
Malatya
Diyarbakır
Kocaeli
0NTJ
görüntülü.show
ReplyDeletewhatsapp ücretli show
AZJ3KL
ankara parça eşya taşıma
ReplyDeletetakipçi satın al
antalya rent a car
antalya rent a car
ankara parça eşya taşıma
00İS
urfa evden eve nakliyat
ReplyDeletemalatya evden eve nakliyat
burdur evden eve nakliyat
kırıkkale evden eve nakliyat
kars evden eve nakliyat
A0TDQJ
urfa evden eve nakliyat
ReplyDeletemalatya evden eve nakliyat
burdur evden eve nakliyat
kırıkkale evden eve nakliyat
kars evden eve nakliyat
UK6
64C63
ReplyDeleteIsparta Evden Eve Nakliyat
Urfa Lojistik
Kırıkkale Parça Eşya Taşıma
Kütahya Evden Eve Nakliyat
Samsun Lojistik
5BEDE
ReplyDeleteEskişehir Şehir İçi Nakliyat
Van Şehir İçi Nakliyat
İstanbul Lojistik
Hatay Şehirler Arası Nakliyat
Ünye Marangoz
Karaman Şehirler Arası Nakliyat
Aksaray Şehirler Arası Nakliyat
Ünye Çekici
Aydın Lojistik
40409
ReplyDeleteBayburt Şehirler Arası Nakliyat
Cointiger Güvenilir mi
Ünye Oto Boya
Çerkezköy Yol Yardım
Sakarya Lojistik
Uşak Şehirler Arası Nakliyat
Ünye Marangoz
Çerkezköy Motor Ustası
Urfa Parça Eşya Taşıma
B299E
ReplyDeletedeca durabolin for sale
Artvin Şehir İçi Nakliyat
buy turinabol
testosterone propionat
vezir sosyal medya
Kütahya Parça Eşya Taşıma
Karapürçek Parke Ustası
Altındağ Parke Ustası
Kırıkkale Şehirler Arası Nakliyat
840FF
ReplyDeleteArdahan Şehirler Arası Nakliyat
Kayseri Evden Eve Nakliyat
Amasya Şehir İçi Nakliyat
Denizli Evden Eve Nakliyat
Ünye Petek Temizleme
Tokat Parça Eşya Taşıma
Iğdır Şehir İçi Nakliyat
Çerkezköy Oto Elektrik
Antep Evden Eve Nakliyat
CA741
ReplyDeleteMuğla Lojistik
İstanbul Lojistik
Raca Coin Hangi Borsada
Osmaniye Şehirler Arası Nakliyat
Silivri Cam Balkon
Bibox Güvenilir mi
Zonguldak Parça Eşya Taşıma
Rize Lojistik
Çankırı Lojistik
ED6C3
ReplyDeleteBursa Parça Eşya Taşıma
Trabzon Parça Eşya Taşıma
Lovely Coin Hangi Borsada
Muğla Şehirler Arası Nakliyat
Bilecik Parça Eşya Taşıma
Çerkezköy Petek Temizleme
Kars Şehir İçi Nakliyat
Eryaman Parke Ustası
Isparta Lojistik
23B81
ReplyDeleteBitci Güvenilir mi
Ünye Petek Temizleme
Referans Kimliği Nedir
Bibox Güvenilir mi
Ünye Çatı Ustası
Çerkezköy Cam Balkon
Etimesgut Parke Ustası
Silivri Fayans Ustası
Referans Kimliği Nedir
95D09
ReplyDeleteCoin Çıkarma Siteleri
Okex Borsası Güvenilir mi
Bitcoin Kazanma
Kripto Para Nasıl Kazılır
Bitcoin Üretme
Kripto Para Kazanma Siteleri
Coin Üretme
Bitcoin Kazma
Kripto Para Çıkarma
7110F
ReplyDeletebitlis kadınlarla görüntülü sohbet
giresun yabancı görüntülü sohbet
sinop rastgele görüntülü sohbet uygulamaları
kırıkkale rastgele sohbet siteleri
görüntülü sohbet kızlarla
tunceli görüntülü sohbet
hatay canlı ücretsiz sohbet
mobil sesli sohbet
amasya seslı sohbet sıtelerı
4AF63
ReplyDeletekizlarla canli sohbet
gate io
telegram kripto
binance referans
huobi
4g mobil proxy
bybit
gate io
kucoin
D80BA
ReplyDelete2024 Calendar
kripto telegram grupları
paribu
2024 Calendar
bybit
August 2024 Calendar
gate io
kızlarla canlı sohbet
kripto ne demek