Тёмный

How to use an ADC (embedded example in C) 

Jacob Sorber
Подписаться 160 тыс.
Просмотров 29 тыс.
50% 1

Patreon ➤ / jacobsorber
Courses ➤ jacobsorber.thinkific.com
Website ➤ www.jacobsorber.com
---
How to use an ADC (in C) // The analog to digital converter, or ADC, is an essential tool that all embedded developers need in their toolkit. This video will help you get started measuring analog voltages and creating custom sensors on two platforms: Arduino and the MSP430. Examples in C.
***
Welcome! I post videos that help you learn to program and become a more confident software developer. I cover beginner-to-advanced systems topics ranging from network programming, threads, processes, operating systems, embedded systems and others. My goal is to help you get under-the-hood and better understand how computers work and how you can use them to become stronger students and more capable professional developers.
About me: I'm a computer scientist, electrical engineer, researcher, and teacher. I specialize in embedded systems, mobile computing, sensor networks, and the Internet of Things. I teach systems and networking courses at Clemson University, where I also lead the PERSIST research lab.
More about me and what I do:
www.jacobsorber.com
people.cs.clemson.edu/~jsorber/
persist.cs.clemson.edu/
To Support the Channel:
+ like, subscribe, spread the word
+ contribute via Patreon --- [ / jacobsorber ]
+ rep the channel with nerdy merch --- [teespring.com/stores/jacob-so...]
Source code is also available to Patreon supporters. --- [jsorber-youtube-source.heroku...]

Опубликовано:

 

5 окт 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 46   
@gokulrajaking
@gokulrajaking 3 года назад
3:31 - resistor and green wire wrong connect in breadboard
@JacobSorber
@JacobSorber 3 года назад
Man, you're right. Sorry about that. I must have fixed it after recording that. Folks. Slide that green wire up to the next row. Thanks for pointing that out, Gokul.
@davidli7752
@davidli7752 3 года назад
@@JacobSorber lol, first physical bug on your channel?
@glenthemann
@glenthemann 3 года назад
Dude, this channel is a goldmine. Im a pretty heavy book learner and haven't really spent much time watching videos related to programming, but I'm glad you ended up in my feed. You're a wonderful teacher, thank you for continuing to make videos.
@JacobSorber
@JacobSorber 3 года назад
You're welcome. Glad you're enjoying them. Let me know if there are topics you would like to see on here.
@classyjohn1923
@classyjohn1923 3 года назад
Yep, ADC is very easy to implement, even if you're doing it from scratch on a microcontroller. It works as a great voltage sensor for your analog pins and, more importantly, its incredibly important to have when you want to interface it with certain sensors such as the DHT11 sensor
@jakubstandarski7974
@jakubstandarski7974 3 года назад
Simple, easy, well explained! I just love that, great job!
@JacobSorber
@JacobSorber 3 года назад
Thanks, Jakub.
@mockingbird3809
@mockingbird3809 3 года назад
Can you make a video on how to use inline assemble in C code, either inside functions and other places with their practical applications? That would be really great :-)
@JacobSorber
@JacobSorber 3 года назад
I'll add it to the list and see what I can do.
@pedrocoutinho5451
@pedrocoutinho5451 Год назад
You are the best teacher, thank you a lot! :)
@benjaminshinar9509
@benjaminshinar9509 3 года назад
I don't do embedded, but it's always informative to see a new video! most of the video I was confused, because I had no idea what the sensor is, and then it appeared in the last minute, maybe in future videos you could have it show up in a small box whenever the program is running?
@ryanhaart
@ryanhaart 3 года назад
You should add switch hysteresis to your code, otherwise the light will keep switching on and off all the time during borderline light conditions.
@tuanvu3654
@tuanvu3654 2 года назад
Thank you from Vietnam.
@soaringeq22
@soaringeq22 3 года назад
Would love to see a video on Huffman coding!
@shekharmaela2308
@shekharmaela2308 3 года назад
Hey Jacob, I have a question. How can we register test functions at compile time in C++ , like with constexpr/consteval? for example: you're writing a unit testing framework and you want it to automatically register the tests at compile time.
@berthold64
@berthold64 3 года назад
I'd love to see esp32 c/c++ tutorial using its official sdk, esp-idf. Personally I find esp32 is the cheapest and very accessible micro with tons of useful on board peripherals such as WiFi, dual core, and multiple hardware UARTs. The sdk and documentations quality are commercial tier too.
@aabdev
@aabdev 3 года назад
Dear Jacob Sorber, How to perform a unit test for ADC? How to automatically justify that MCU ADC measures really existing voltage without offset? Regards, AB
@vishwajithk8811
@vishwajithk8811 3 года назад
▪️How'll processor differentiate between two static locals whose name is same? ▪️And what're map files, dep files? Human readable files? Generated by GCC? or by Make?
@netblogger2109
@netblogger2109 3 года назад
How do I use ADC to feedback the inverter in atmega And what happens when you do that?
@datawolk
@datawolk 3 года назад
Nice video. Note: Max binary value = 2^n - 1
@JacobSorber
@JacobSorber 3 года назад
True. 0...4095. 😀
@alemajohmartin7017
@alemajohmartin7017 3 года назад
Hi Jacob, what projects can I do to really feel confident in C?
@JK360noscope
@JK360noscope 3 года назад
Try some different ones using whatever microcontroller dev kit you can find! If you want confidence, go try some things! Get SPI communication working! Flash an LED with a bunch of interrupts! The possibilities abound
@sakshisingh8167
@sakshisingh8167 3 года назад
PLEASE DO STM32F407VG DISCOVERY BOARD
@Serendipity2893
@Serendipity2893 Год назад
Does anybody have a source that does this with Embedded/Bare-metal C? Im stuck on an assignment, and everyone just wants to do arduino. The explanation + Delivery was fantastic though
@JohnWick-xd5zu
@JohnWick-xd5zu 3 года назад
Thank you so much 🥰, love you from Egypt!!!
@user-su5sq5ib3i
@user-su5sq5ib3i 2 года назад
The first code you showed was only the main function. Where are the rest of the functions like the getvoltage and initialization?
@ayu12641
@ayu12641 3 года назад
Could you explain why using timers are more energy efficient? The time spent in the delay loop would still be spent in the empty infinite loop right?
@JacobSorber
@JacobSorber 3 года назад
With a timer, you can put your MCU in sleep mode-so just the ADC and/or timer are working-and then have it wake you up when it's time to do something (by firing an interrupt).
@ayu12641
@ayu12641 3 года назад
@@JacobSorber That didn't cross my mind. But replacing the _delay_cycles() with a sleep function inside the infinite loop achieve the same power efficiency as timers?
@JacobSorber
@JacobSorber 3 года назад
@@ayu12641 You would have to check how _delay_cycles() is implemented, but usually, it's just a busy loop. If it doesn't change the CPU state into a low power mode, then it won't get the same efficiency.
@rogo7330
@rogo7330 3 года назад
Basically
@phillipneal8194
@phillipneal8194 Год назад
Are there high speed adc 's ? Say 50 msps ?
@JacobSorber
@JacobSorber Год назад
Yes, there are, but as with any measurement equipment, things get expensive as your speed requirements go up.
@bbq1423
@bbq1423 3 года назад
Is there a difference between for(;;) and while(1)?
@JacobSorber
@JacobSorber 3 года назад
No. They're functionally equivalent.
@duanedsilva3573
@duanedsilva3573 3 года назад
@@JacobSorberfor(;;;) would be compiler error
@BlackXeno
@BlackXeno 3 года назад
@@duanedsilva3573 yes, but not the for(;;)
@ritiksahu1844
@ritiksahu1844 3 года назад
Why you didn't use while true for looping infinitely
@JacobSorber
@JacobSorber 3 года назад
Good question. Guess I was just feeling in a for-loop mood. A while(true) would have worked, as well.
@ayu12641
@ayu12641 3 года назад
A fun fact. PC lint software would throw a warning if you use while(1) for an infinite loop. One way to get past it is to use for(;;) loop which is less error prone as it has no values.
@Yarin5879
@Yarin5879 3 года назад
I want this shirt.
@JacobSorber
@JacobSorber 3 года назад
Thanks. I know where you can get one.
@nabiisakhanov3522
@nabiisakhanov3522 3 года назад
Using an ADC isn't that hard actually, you just need to learn to last-hit and attack-move properly, then all you have to do is play safe before you get your core items and then stay behind your frontline in teamfights and deal as much damage as you can!
@framepointer
@framepointer 3 года назад
lmao league of legends reference
Далее
How to make memory read-only in your C programs.
12:57
Thank you king gnome Crawly for saving my life 🙏
00:38
50 YouTubers Fight For $1,000,000
41:27
Просмотров 135 млн
How Do ADCs Work? - The Learning Circuit
10:13
Просмотров 125 тыс.
How to Check Your Pointers at Runtime
14:12
Просмотров 31 тыс.
C++ for Embedded Development
52:28
Просмотров 104 тыс.
Master Pointers in C:  10X Your C Coding!
14:12
Просмотров 288 тыс.
The Inline Keyword in C.
16:18
Просмотров 57 тыс.
How to Blink an LED in C (avr, msp430)
16:36
Просмотров 33 тыс.
How do I access a single bit?
11:07
Просмотров 19 тыс.