Program guide: How to program a touch sensor
Vložit
- čas přidán 24. 07. 2024
- This is the additional program guide for the PIC16F627A touch sensor tutorial, where we talk about how to program a touch sensor and go through the C source code for the XC8 compiler line by line.
Main video: • Breadboard capacitive ...
Companion article: www.friendlywire.com/tutorials...
Thanks for watching, and let me know in the comments if you have any questions!
Website: www.friendlywire.com
Twitter: / friendlywire
Reddit: / friendlywire
Facebook: / friendlywire
Instagram: / friendlywire
Timestamps:
00:00 Introduction
00:23 Program overview
01:00 Source code inside MPLAB X IDE
07:22 Summary
I like the style of renaming hardware dependent registers.
Normally I don't like putting so many commands on one line, but in this case it actually improved readability.
Thank you, glad you liked the techniques! :-)
Best Electronics tutorials on youtube
Thank you so much, Luca, I am very happy to hear that you like them! Let me know if you have anything you want to see in future videos! :)
Nicely explained
Thank you, glad you find it helpful! :)
Thank you very much for your crystal clear explanation.
Thank you for your kind words, so glad you find the video helpful! :)
Thank you for a really nice, understandable PIC tutorial. I'm not a beginner, but I'm sure I'll be able to use the debouncing code and possibly the touch sensor code in my own projects.
Hey, that's fantastic, glad you like it and, even better, got some use out of it!
You are really awesome.... Loved your projects...... U got a new subscriber 🎉
Thank you very much. glad you like the projects! :) Do you have anything you want to see on this channel? I am always looking for new ideas :)
Yaaa Sure.... Try make video on ttp223 that is also a good sensor module and it's very popular also ...... I have also made video on
But I think you can explain it better than me.... Go for it 🔥
@@protechstudios5377 The TTP223 is a useful touch sensor chip, true! But the whole idea of this touch sensor project was to build your own touch sensor so you don't have to use an extra sensor for that! :) So I have to think about it... :)
This is an awesome tutorial. Using an Arduino would've made this way more accessible but this was still super helpful
Thank you, I am so glad you like it! Arduino can be fun, but personally I like PIC microcontrollers :)
@@FriendlyWire Wouldn't be able to understand capacitive sensing without this tutorial so THANK YOU! :)
@@_azaad_ Thank you! The main idea of capacitive sensing is the same everywhere, regardless on which microcontroller you code it :)
@@FriendlyWire Absolutely. Having this detailed tutorial of the code is great because once you understand this, you can just code it on any microcontroller platform for sure! This was just a great explanation of an essential topic, I definitely subscribed over it. Kudos!
@@_azaad_ Thank you for sharing this perspective, it means a lot! I am thinking of creating similar code walkthrough videos for all my other PIC microcontroller projects, sort of as an additional video to the main one. Would that be interesting? In the main videos I cannot always cover all the details on the code, which is why I thought it might be useful to some of my viewers.
Nice video. And well organized structure of program.
Just one question. Why do you use PIC instead of Arduino?
Before finding your channel I had no idea that this brand even exists.
I wander if it is me being a beginner or is it not popular in my country?
Arduinos are great for removing the initial fear of using a microcontroller, but I find that they are often overpowered for hobbyist purposes. Moreover, there are a lot of libraries for the Arduino platform. This is a good thing, if you want to achieve a result fast, but I always like to program myself. I should probably do a video on this question at some point, I am getting this question a lot :)
But my main point is this: the best tool is the tool you know how to use. So, if Arduinos are more interesting to you, then there is nothing wrong with using them. In my case, I like the more barebone structure of using a single PIC controller, I enjoy reading the different datasheets and trying to get everything to work the register level, and that's why I like to focus on those on my channel here.
You are right, PICs are not as popular as the Arduino platform. at least for hobbyists, but I think they are a lot of fun, too :)
Hi Jens! Nice work. Do you offer programming services?
Hey Joseph, I do not offer any paid services. If it's a small thing I may be able to do it for free, just send me an email :)
Hi,
In the if (time-avg1 > thr1), what does the expression in the braces mean ? Does it do a subtraction operation and then compare against thr1? if so, how do you come up with this expression?
This compares the time it took for the button to read as digital low (stored in the variable "time") to the average time it takes for the button to read low (called "avg1"). If for some reason it takes much much longer than usual, then it must be because somebody touches the wire right now. The "much much longer" is specified by the threshold value "thr1" and this number is usually around 15-20, but you can try other values, too, to see if it works better. Hope it helps!
Can it work for PIC16F84A ?
Yes, it works for any pin that has a tristate register :) But you will have to write different code for the PIC16F84A because its internal registers are different from the ones of the PIC16F627A. Do you have some experience with PIC microcontrollers?
Hi can u answer my question please?
Q: With what type of recorders is the screen rendered in the "scrolling text" application with recorders?
A) SIPO
B) SISO
C) PIPO
D) PISO
Hi Burak, great question! :) The CD4094 that I use is a serial-in parallel-out type of register (SIPO). But in some sense it also has a serial output (the QS and /QS pins) so that part of it is serial-in serial-out (SISO). Hope that helps!
@@FriendlyWire I thought so too. I'm torn between two options. Which one should I mark? Thanks in advance.
@@burakcetin6504 It's just a name for things :) It's much more important to understand what it does! I think that strictly speaking the LEDs are just indicators and not part of the data structure, and in that sense it's probably a SISO-type of setup, but then again, it's just a name :)
sir can conduct a pic microcontroller course in UDEMY
Thank you! I have all my videos here on CZcams for free :)
@@FriendlyWire I think you should teach the PIC internal architecture and programming first
@@electroniclover5589 There are a lot of things to learn about PIC microcontrollers, yes! In my videos I take a different approach by building small projects that make use of some of the controller's features. I hope to make it easier for beginners to get acquainted with microcontrollers with this approach :)
@@FriendlyWire I see, hi sir do you have any recommended book for beginner
@@electroniclover5589 A book to learn how to program a PIC microcontroller specifically you mean? :)