Port Register Control | Increase speed of Read/Write - Arduino101

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ธ.ค. 2024

ความคิดเห็น • 298

  • @mmawad100
    @mmawad100 4 ปีที่แล้ว +180

    PLEASE CONTINUE WITH THE ADVANCED STUFF THERE IS A SERIOUS LACK ON THE INTERNET FOR THAT

    • @willtipton
      @willtipton 4 ปีที่แล้ว +6

      I agree! 114%

    • @MrRijoAlex
      @MrRijoAlex 4 ปีที่แล้ว +4

      Truer words have never been spoken!

    • @Danixu86
      @Danixu86 3 ปีที่แล้ว +8

      Well there's stuff on internet, the problem is that is not well explained and this videos helps a lot.

    • @AdithyanKNair
      @AdithyanKNair 2 ปีที่แล้ว +2

      still facing this problem

  • @minusharma1738
    @minusharma1738 4 ปีที่แล้ว +51

    You are so underrated 😭

    • @sawansihag6974
      @sawansihag6974 3 ปีที่แล้ว

      Yes, I am amazed by the amount of knowledge I got from this video

  • @DivyanshMMMUT
    @DivyanshMMMUT 4 ปีที่แล้ว +10

    I think programming directly using Register Control is more fun as we are literally seeing what the controller is actually doing.... More like an assembly level Language 🔥.
    - Thankyou from India 🙏

  • @bobvanwagner6099
    @bobvanwagner6099 10 หลายเดือนก่อน +2

    i've programmed in C since Bell Labs in the late '70-s and know the concepts like this better than the back of my hand, but rarely have I seen such a clear and careful explanation. Great Job!

  • @ELECTRONOOBS
    @ELECTRONOOBS  4 ปีที่แล้ว +30

    ERROR: To invert a byte we use "~" and not the "!" Sowy! :)
    Arduino Course (Spanish): bit.ly/3ldW6kO
    Follow me on FACEBOOK for more: facebook.com/Electronoobs
    Help me on Patreon: www.patreon.com/ELECTRONOOBS

    • @bilelhafsi3320
      @bilelhafsi3320 4 ปีที่แล้ว

      Thank you for the vidéo!!!
      Could you please tell me which software do you use to make video animations ?

    • @monleyson8668
      @monleyson8668 3 ปีที่แล้ว +2

      Ok

  • @MarlinFirmware
    @MarlinFirmware 4 ปีที่แล้ว +12

    For our project we used “FastIO” headers that define helpful macros to initialize, read, and write to the port bits using the digital PIN number, concealing all the binary math. They really speed up digital I/O, so we extended them to several platforms. For analog pin reading you can do similar tricks, by first setting up the pin for reading, then starting the ADC, and then going off to do other things and picking up the ADC result later, instead of calling analogRead() and waiting for it to return. That would make a good related subject for a future video. Cheers!

    • @richardlighthouse5328
      @richardlighthouse5328 4 ปีที่แล้ว

      If you need performance, then write in pure c/c++.

    • @MD-vs9ff
      @MD-vs9ff 2 ปีที่แล้ว

      @@richardlighthouse5328 I don't know what you mean. Arduino is a pure C++ set of libraries, with just some cosmetic things handled automatically (like function prototypes).

    • @richardlighthouse5328
      @richardlighthouse5328 2 ปีที่แล้ว

      @@MD-vs9ff I meant without any framework. Just AVR helpers.

    • @stark_energy
      @stark_energy ปีที่แล้ว

      @@richardlighthouse5328 What it means: using FastIO is not only having near equal the direct (without any framework) but also platform independent. The hard part is always making the code has near highest performance BUT at the same time platform agnostic (i.e. can be run on Mega, ESP32, etc without changing your code).

  • @sammflynn6751
    @sammflynn6751 4 ปีที่แล้ว +8

    Amazing, crystal clear explanation . wow, nobody explains it better than you. You deserve a million subs man.

  • @anonymoususer900
    @anonymoususer900 4 ปีที่แล้ว

    Last time i honestly told you that the video(internal comparator one) wasnt very understandable for intermediate or new people. DRAMATIC IMPOROVEMENT. Awesome tutorial......i will use this in my led cube project.....Thanks!

  • @stephanemuller7032
    @stephanemuller7032 4 ปีที่แล้ว +6

    Great video man! Best explanation I've seen out there.
    To make your code easier to read you can also use constants like so:
    DDRB |= (1

  • @padmalayarawal3091
    @padmalayarawal3091 4 ปีที่แล้ว +20

    This is really a great explanation as well as great presentation. Port manipulation now looks more easy to get understand. Thank you. 🤩

  • @saram263
    @saram263 2 ปีที่แล้ว

    The diagrams of the ports on the arduino board were so helpful and saved me from scrolling through pages of documentation as a noob, thank you!

  • @Sekhar_Home
    @Sekhar_Home 3 ปีที่แล้ว +1

    Finaly clearly able to know bitwise operator use in Arduino... Thanx for ur awesome graphical presentation which makes the education more fun and interactive

  • @nabilandadamslaboratory3422
    @nabilandadamslaboratory3422 4 ปีที่แล้ว +2

    This video has finally demystified port manipulation. Thank you!!

  • @piiumlkj6497
    @piiumlkj6497 4 ปีที่แล้ว +21

    This is a masterpiece , I love this kind of videos

  • @alirezaahmadian4237
    @alirezaahmadian4237 3 ปีที่แล้ว

    right now im at the midle of the video and im so excited about this great explanation that made me write this comment. its great.thats exactully what i needed.

  • @saurabhgawli2167
    @saurabhgawli2167 4 ปีที่แล้ว +2

    U deserve so much more...
    Just don't stop ur work...
    Luv from India ❤

  • @null8363
    @null8363 5 หลายเดือนก่อน

    I found this video and channel today, this is extremely amazing, the information and the quallity are top-notch, really thank you for your hardwork

  • @TimNortonGuru
    @TimNortonGuru 4 ปีที่แล้ว +2

    I did not realise the Arduino IDE could accept direct port addressing.
    Thanks

  • @JLCPCB
    @JLCPCB 2 ปีที่แล้ว +1

    Great video as always! 😀

  • @ManojSharma-ud3ox
    @ManojSharma-ud3ox 4 ปีที่แล้ว

    You explained it very well. I am a mechanical engineering graduate and have lots of projects which involved heavy use of electronic. This video was very clear and understand everything you said. Well done!!

  • @amarjitmoirangcha4521
    @amarjitmoirangcha4521 ปีที่แล้ว

    You are doing great I really like this. Such type of videos are very rare on internet which is teaching on register level for Arduino. Thanks

  • @kaden56
    @kaden56 4 ปีที่แล้ว

    I will be a serious follower of this more advanced line of arduino info. This is the stuff that makes all my old projects finally work properly 😂

  • @hrperformance
    @hrperformance 3 ปีที่แล้ว

    I learned so much from this video. This guy has a serious talent.
    Much love from the UK

  • @SaminaZafar270
    @SaminaZafar270 4 ปีที่แล้ว

    This is the video that I was searching for months. This video is awesome. Please make more arduino tutorials.

  • @halitekmekcioglu7150
    @halitekmekcioglu7150 4 ปีที่แล้ว +2

    very clear and well explained, I wish I could listen to this in my highschool years :) Lucky newbies

  • @baladshin7100
    @baladshin7100 4 ปีที่แล้ว +1

    One of the best videos I’ve ever seen on TH-cam for arduino tutorial 😍 keep going bro! 💪🏻 love from IRAN 🇮🇷

  • @MrAasi4
    @MrAasi4 3 ปีที่แล้ว

    This is one clearest tutorial of port manipulation. Good job!

  • @richardsteen4340
    @richardsteen4340 9 หลายเดือนก่อน

    Excellent tutorial..!! Did some assembly programming years ago in college.. This has helped me to remember things I forgot I had learned..;)

  • @stark_energy
    @stark_energy ปีที่แล้ว

    A very detailed and great explanation to low-level optimization to Arduino. However we should point out that this only works on specific Arduino type, different type might require different configuration (and thus different code on different platform), while on the other hand a common Arduino function like digitalRead / Write is platform agnostic, it can even run on ESP32 or ESP8266 and many other types that conform with Arduino.h standard without changing code (except the pin number). So, for the sake of simplicity and portability there is always performance hit to pay. This is true for all programming language. The more you into performance, the more specific/limited device your code can work.

  • @antibrevity
    @antibrevity 4 ปีที่แล้ว +1

    This is an excellent explanation of boolean port manipulation that should be easy for newcomers to understand. Great work! I see that others have already pointed out some errors, but this is still a great video.

  • @johnni5254
    @johnni5254 3 ปีที่แล้ว +6

    Great video! At 12:20 in the upper "loop()" commands, shouldn't those be: PORTD |= 0001000 and PORTD &= 00001000 accordingly? We're trying to set bit 3 of the register (Arduino pin D3). If we leave it as is in the video, it sets bit 1 of the register (Arduino pin D1). Do I miss something?

  • @soekma_aoeliea
    @soekma_aoeliea 4 ปีที่แล้ว

    You also could use , some of its function is pretty useful

  • @rikvermeer1325
    @rikvermeer1325 4 ปีที่แล้ว

    Amazing channel. I'm from software engineering and I understand this stuff but just don't know it all works like this. Thank you for clarifying!! I became a subscriber

  • @TYGAMatt
    @TYGAMatt 4 ปีที่แล้ว

    Very well explained. Wish you'd don't this video a few months ago so that I wouldn't have had to spend hours reading the datasheet and doing it myself. Excellent stuff

  • @bhargavdayal8595
    @bhargavdayal8595 3 ปีที่แล้ว

    Bro....This is one of the best explanations i have ever listened to..Great work

  • @Idklol-i7y
    @Idklol-i7y 4 ปีที่แล้ว +3

    Very informative, thanks for putting in the effort to edit the video. I like the inclusion of the result comparison at 6:50 and the video presentation overall looks professional, I bet new players will learn a lot from this Arduino101 series. Looking for more videos like this one to come soon, again, great job mate.

  • @mdoering
    @mdoering 3 ปีที่แล้ว

    The production value of your videos is next level... I LOVE the motion tracked labels. New subscriber achieved.

  • @magnet2011
    @magnet2011 3 ปีที่แล้ว

    First many many thanks for the video,I am from India,I am an ordinary television technical person . I don't know about programming of microcontroller. Sir you feel proud to know that after watching you video 10 to 15 times and doing some practice I found a mistakes at 12:25 in the video. I think you display PORTD|=B00000010;// set D3 to high should be PORTD|=B00001000; same to PORTD&=!B00000010, should be PORTD&=!B00001000;// set D3 to low.
    Many many thanks , please reply

  • @wiktormolzahn736
    @wiktormolzahn736 3 ปีที่แล้ว

    I love you!!!
    This ist the first Video that explanes everything nicely

  • @scottstevens7569
    @scottstevens7569 4 ปีที่แล้ว

    Very Good Explanation! We really do need more of this type of thing as there is not much available, and not as easy to understand as yours is. Clear, concise and relevant.

  • @kylemfwelch
    @kylemfwelch 4 ปีที่แล้ว

    I never seen this so clearly explained before. Excellent!

  • @rajneeshsingh6639
    @rajneeshsingh6639 10 หลายเดือนก่อน

    This is the best tutorial for port register control

  • @jollyjumper1873
    @jollyjumper1873 3 ปีที่แล้ว

    Nice video! This is helping me out with my graduation project. Thanks :)

  • @مقاطعمترجمة-ش8ث
    @مقاطعمترجمة-ش8ث 3 ปีที่แล้ว

    9:42 After two years of trying PCM/PWM code on my ATtiny85 code I found in the internet, which I never fully understand (they use port register) , now I fully understand that code very well, BTW I study C language in the school I don't remember how boolean operators works(maybe I just past it by) , neither bit shift

  • @tanoryjakaperdana1419
    @tanoryjakaperdana1419 3 ปีที่แล้ว

    Thanks bro.. you explain these stuffs with human language.. subscribed and liked.. 👍👍👍

  • @CNsongs
    @CNsongs 2 ปีที่แล้ว

    Super helpful. Thank you very much. My university expected expected us to know these magically.

  • @Tuberkulo1
    @Tuberkulo1 4 ปีที่แล้ว

    Best explanation about Port Register Control so far !

  • @RinksRides
    @RinksRides 4 ปีที่แล้ว +1

    Awesome floating graphics and text!! I just finished a tutorial on Attiny85 complimentary output PWM 250KHz to 1MHz+ this could inspire me to finally make YT tutorials.

  • @jumbo999614
    @jumbo999614 4 ปีที่แล้ว

    12:21 In Loop function, why you use 2nd bit? In the setup() function, you set register to 4th bit.

    • @ELECTRONOOBS
      @ELECTRONOOBS  4 ปีที่แล้ว +2

      That's an editing error. Sorry. It should be the forth bit!

    • @jumbo999614
      @jumbo999614 4 ปีที่แล้ว

      @@ELECTRONOOBS Thank you replaying. Anyway, I'm new to bit shifting thing.
      PIND >> 5 & B00100000 >> 5 Why shift 5 twice?
      The result of 1st shifting is B00000001right?
      Also, what happen if we use PIND with '|' instead of '&'?

  • @tcrenegade
    @tcrenegade 4 ปีที่แล้ว

    Loved this!! I felt like I was finally learning how to use arduino as a tool

  • @skidroadkustom5953
    @skidroadkustom5953 9 หลายเดือนก่อน

    A lot of great info, thanks. I did watch this one at least 15 times

  • @vcrahul
    @vcrahul 4 ปีที่แล้ว

    Dear frnd..excellent explanation...even better than greatscott's...on this subject...nice...

  • @DivyanshMMMUT
    @DivyanshMMMUT 4 ปีที่แล้ว +1

    Man, How to thank you more 🔥🔥🔥
    We are getting this for free 😱
    Please don't Stop keep it coming 😊😊

    • @rikvermeer1325
      @rikvermeer1325 4 ปีที่แล้ว +1

      pssst... We can also contribute :)

    • @DivyanshMMMUT
      @DivyanshMMMUT 4 ปีที่แล้ว

      @@rikvermeer1325 yup... I support him.by sharing his videos atleast that's what I can do to support him for now

  • @billcrm003
    @billcrm003 4 ปีที่แล้ว

    at 5:18 you point at the crystal of the chip mega16u2,but actually the crystal of mega328p is the one close to the chip itself

  • @justdoingodswork
    @justdoingodswork 3 ปีที่แล้ว

    Thank you so much, its so great to learn these and importance of register. I'll definitely implement these in my codes from now on.
    Please keep making these videos about advance coding.
    Thanks again

  • @myhobbies5965
    @myhobbies5965 4 ปีที่แล้ว

    Always waiting for such a atmega mcu program learning videos.

  • @pedroaugusto5995
    @pedroaugusto5995 11 หลายเดือนก่อน

    Nice video, your didactics is something else!

  • @jaroslawpiotrowski210
    @jaroslawpiotrowski210 4 ปีที่แล้ว

    Very well prepared video about advanced operations on Arduino. Very well explain - THANKS !!!
    PLEASE continue this subjects for advanced operations !!!

  • @nid274
    @nid274 4 ปีที่แล้ว

    this is great..i never imagined there would nano to micro variation!!

  • @sennabullet
    @sennabullet 2 ปีที่แล้ว

    A,fantastic explanation made easier to understand with superb animations. Thank you for sharing your knowledge.

  • @astrogerard
    @astrogerard 4 ปีที่แล้ว +1

    Very good video and thanks for taking the time to do this. I think the views counter is broken because in my opinion it should be at lease 10 timers higher by now.
    I would like to see more advance content like this. Please consider making an advance video on interrupts using -all- the pins of the Arduino. Thanks!

    • @ELECTRONOOBS
      @ELECTRONOOBS  4 ปีที่แล้ว +1

      Next part will be on interrupts

  • @Sekhar_Home
    @Sekhar_Home 3 ปีที่แล้ว

    Pls make more and more video on 101 arduino. I need to learn embeded system from you.. you are the best in teaching microcontroller.

  • @SudhirKumar-bq4xz
    @SudhirKumar-bq4xz 4 ปีที่แล้ว +2

    Great and informative video as always.... :-)
    Sir, please make a video on how to interface external ADCs, selection of ADC, important specification while selecting a ADC.....

  • @ajeethsuryash5123
    @ajeethsuryash5123 3 ปีที่แล้ว

    Amazing video... Expecting more of such class...

  • @ChrisLocke1969
    @ChrisLocke1969 4 ปีที่แล้ว

    One of your best arduino code videos yet, thanks!!

  • @moinshaikh6684
    @moinshaikh6684 4 ปีที่แล้ว

    Very Nice Explaination! Fallen in love with this tutorial!

  • @supperslash1376
    @supperslash1376 4 หลายเดือนก่อน

    I was just wondering, what do you use to make the graphics, such as at: @7:18 all the way to 10:00 ish? what software? @elecreonoobs

  • @tejaspatil5929
    @tejaspatil5929 3 ปีที่แล้ว

    please explain even more about the arduino, this video helped me a lot, please make even more videos

  • @GrandNecro
    @GrandNecro 4 ปีที่แล้ว

    best tutorial i've found yet! i do have a question though. how do you read analog value? PINC register only stores the digital value of the analog pins.

  • @PdroAlfMar
    @PdroAlfMar 4 ปีที่แล้ว

    Puro Oro!!!! Saludos y Gracias por tu aporte a esta comunidad!!!!

  • @luisarielgonzalez4778
    @luisarielgonzalez4778 2 ปีที่แล้ว

    Great video. Nevertheless at the end of the video (minute 12:41) a NOT (!) operator was missing through the explanation. Just a note. Thanks

  • @rikvermeer1325
    @rikvermeer1325 4 ปีที่แล้ว

    Wow, the reactions you are getting are beautiful :) I recently started as a self-employed software developer / hardware modder. Will check in and hopefully soon become patreon

    • @paulmaydaynight9925
      @paulmaydaynight9925 4 ปีที่แล้ว

      great, please make a copy of rebol and port it and patch it to esp32 then create a github for this tested code and notify carl and this channel.
      github.com/rebol/rebol

  • @Danixu86
    @Danixu86 4 ปีที่แล้ว

    Nice tutorial. There are a lot of things that I did not understand until now. Also would be nice to have any tutorial like this talking about Timers and how to change it to change PWM signals for example.

  • @naikganesh5677
    @naikganesh5677 3 ปีที่แล้ว +1

    You nailed it 🔥🔥

  • @curiouslittledroid1234
    @curiouslittledroid1234 4 ปีที่แล้ว

    Great presentation. Nice video editing and great use of motion graphics.

  • @harikamalakarreddydarapu7410
    @harikamalakarreddydarapu7410 4 ปีที่แล้ว +1

    Very nice information.and very good explanation

  • @SirLeecher
    @SirLeecher 4 ปีที่แล้ว

    Explained it really well and helped me understand, very nice !

  • @jstro-hobbytech
    @jstro-hobbytech 3 ปีที่แล้ว

    Cool video man. Optimized code gets me going.

  • @monsieur-khonar
    @monsieur-khonar 4 ปีที่แล้ว +4

    There is a mistake à 8:52, it its // 0,1,2,4,6 LOW

    • @monsieur-khonar
      @monsieur-khonar 4 ปีที่แล้ว

      at 12.21 it does not looks good either in the loop function

  • @simran_army_ot7215
    @simran_army_ot7215 4 ปีที่แล้ว

    Sir, please make a video about extending the range of 433mhz using transistor or ICs.
    Lot of people are interested in making FM transmitters.
    There is not even a single video about that.
    Hope, you will help the community.

  • @DustinWill
    @DustinWill 4 ปีที่แล้ว

    Best explanation and great animation. Very clearly stated.

  • @tomszky88
    @tomszky88 2 ปีที่แล้ว

    Hi great video. How can I display value of the input in serial monitor?

  • @PJElliot
    @PJElliot 4 ปีที่แล้ว

    Very nice production quality. Using a define for the pin value B0001000 etc would make the code easier to understand, but I understand you were trying to explain bit access for which your method was clearer to someone new to the topic.

  • @juanmf
    @juanmf 2 ปีที่แล้ว

    Great stuff! I bought the starter kit only to get disappointed at the analogRead sample rate. Do you have a similar video for analogRead?

  • @webslinger2011
    @webslinger2011 4 ปีที่แล้ว

    Wow! Thanks for a very good explanation on the Arduino ports.

  • @technicalpeaks
    @technicalpeaks 2 ปีที่แล้ว

    what do we use for analog read?? Thanks for the rest of explanation though. great work!!

  • @littlemadness221990
    @littlemadness221990 4 ปีที่แล้ว

    Great video ! This is a perfect foundation for future learning.

  • @markogvero5836
    @markogvero5836 2 หลายเดือนก่อน

    Thank you so so much for this amazing explanation! It really helped a lot

  • @ChathuraJayasundaraIMD
    @ChathuraJayasundaraIMD 4 ปีที่แล้ว +1

    Wow, awesome vid! please make a vid on timers n interrupts if it's possible. thank you

  • @ranaharsh365
    @ranaharsh365 4 ปีที่แล้ว

    Finally something that I badly needed.....

  • @yayingzhang1506
    @yayingzhang1506 ปีที่แล้ว

    Thanks!

  • @chiparooo
    @chiparooo 4 ปีที่แล้ว

    Very interesting! Great graphics. Learned a lot. Thanks for sharing!

  • @sawansihag6974
    @sawansihag6974 3 ปีที่แล้ว

    Thanks for sharing this precious knowledge ❤️❤️🔥

  • @dioutoroo
    @dioutoroo 2 ปีที่แล้ว

    Hi, thank you for your lesson! This is really helpful. I have question, when you set D5 as an input at 12:41, why is it DDRD &= B00100000 and why not DDRD &= 11011111. You said earlier we use & to place 0. Can anybody help? Thank you

    • @Henry-sv3wv
      @Henry-sv3wv 2 ปีที่แล้ว +1

      The operation:
      DDRD &= B00100000;
      clears (zeroes) all bits in DDRD except leaving bit 5 unchanged
      ---> Every Pin on PortD goes to input mode except PD5, that stays the same DDR mode it was before this operation.
      becaus if bit 5 was 1 before then we have: 1 & 1 --> stays 1
      if bit 5 was 0 before then we have : 0 & 1 --> stays 0
      and every position we have a zero will turn to: anyBeforeBitValue & 0 ---> 0

    • @dioutoroo
      @dioutoroo 2 ปีที่แล้ว

      @@Henry-sv3wv thank you, Sir! I got it now

    • @Henry-sv3wv
      @Henry-sv3wv ปีที่แล้ว +1

      but i think it's too easy making a mistake and then nothing works , so you can use the macro bitWrite:
      bitWrite(ADMUX, MUX3, 1); //set that bit
      bitWrite(ADMUX, MUX3, 0); //clear that bit
      (defined in Arduino.h )

    • @dioutoroo
      @dioutoroo ปีที่แล้ว

      @@Henry-sv3wv wow this is nice. I just knew this. Is there any different between bitwrite and the port register?

  • @deepakjoshi6242
    @deepakjoshi6242 4 ปีที่แล้ว +1

    Okay, I'll be honest, Amazing 👏👏
    I love the animation🥺
    Even greatscott covered this topic before but I really liked the animation approach.
    Thank you so much. 🙏❤️

  • @jawwadahmad7774
    @jawwadahmad7774 4 ปีที่แล้ว

    Hard-Work 👍. Easy to Understand.

  • @maulanawahyudi7127
    @maulanawahyudi7127 3 ปีที่แล้ว +1

    DDRD &= B00100000; D5 as input ? , How it can be ? in 12:40

    • @ELECTRONOOBS
      @ELECTRONOOBS  3 ปีที่แล้ว +1

      Sorry, is should be DDRD &= ~B00100000; My mistake

    • @maulanawahyudi7127
      @maulanawahyudi7127 3 ปีที่แล้ว

      @@ELECTRONOOBS Btw, Thankyou very much . I have been learning everything in your channel, big love from me

  • @cpuchip
    @cpuchip 4 ปีที่แล้ว +3

    This is awesome! Have you done DMA on the arm cortex m mcu's I would love to seem more on those. Like the stm32 or samd range.
    Keep up the great work!

    • @rikvermeer1325
      @rikvermeer1325 4 ปีที่แล้ว

      Yeah!!! I would love to get more insight on how to control DMA

  • @nyakoi
    @nyakoi 4 ปีที่แล้ว

    Thank you! Always good to learn something new 😀

  • @amnesie6615
    @amnesie6615 4 ปีที่แล้ว

    This is what I've subscribed for! COOL! Thank you!