Full playlist on the PIC microcontroller Programming kzbin.info/www/bejne/gYSsZ5mwhLWJsJI Under compiler XC8 v2.00 and up the ISR functions change to: - #include - void __interrupt() high_isr(void); - void __interrupt(low_priority) low_isr(void); Credit to user Peng of for informing me of this.
@mracipayam3 жыл бұрын
I was gonna write this, i did not see this explanation first , thanks.
@L2.Lagrange3 жыл бұрын
Hey man I really appreciate you making this series. I will be referencing it many times over the next few months during my UMN EE microcontrollers class!
@BinderTronics3 жыл бұрын
Glad to hear it is of some use.
@L2.Lagrange2 жыл бұрын
*
@muhammadfaizan88395 жыл бұрын
nice Explanation sir. please make more video on interrupt examples.
@BinderTronics5 жыл бұрын
One releasing the 4th Feb
@willashland45973 жыл бұрын
Great videos and love your accent mate. Are you South African?
@BinderTronics3 жыл бұрын
Yeah from the other down under.
@elless3179 ай бұрын
Hello. Thanks for video. Can you tell me the benefit of using interrupts instead of doing the same just with normal digital inputs? Thanks
@BinderTronics9 ай бұрын
Polling can miss the input and it is slower at reading the input. Interrupts are clock independent and will latch until serviced.
@elless3179 ай бұрын
@@BinderTronics mmmh, interesting. Thanks for the reply
@luke2v523 жыл бұрын
I have been enjoying this playlist so far, but I have two questions. 1. Around 6:51, you use INT1E and INT1P instead of INT1IE and INT1IP like the datasheet says. Is that like a shorthand that means the same thing? 2. What is the purpose of using low priority vs high priority in this example? In both cases they did the same task. I believe this only matters when both buttons are pressed since the high priority would be the only LED on, but is this the case or no? I apologize if you mentioned this already, but after swiping through the video a few times, I could not find this addressed.
@BinderTronics3 жыл бұрын
1. Same thing. Have a look in the pic18f4520.h file. The bit fields should be at the same address in a union. 2. "in this example" It severs only the purpose of showing the assignment to the low priority vector interrupt. You are overthinking it. if you really want to look into it. This is the simplest way of testing that both the interrupt vector priority are working.
@stanholmes42934 жыл бұрын
Hi Excelent explination on interrupts
@mrafayshams3089 Жыл бұрын
If we want to have the INT2 interrupt, will we need to add another isr or will need another if statement in the high_isr(){...} ?
@BinderTronics Жыл бұрын
Another if statement in the high_isr(){...}
@mrafayshams3089 Жыл бұрын
I get an error: variable has incomplete type 'void' when I try to name the isr function as void interrupt highISR(void). How to find what is a way to name the ISR function?
@BinderTronics Жыл бұрын
Did you read the pined comment? onlinedocs.microchip.com/pr/%20GUID-BB433107-FD4E-4D28-BB58-9D4A58955B1A-en-US-1/index.html?GUID-2AC0BB59-9083-4213-A961-F40BE6B91AF6
@lukagacnik30934 жыл бұрын
Can you explain, why does "GIEL" and "GIEH" need to be set HIGH in the main code? Great video by the way! :)
@BinderTronics4 жыл бұрын
GIEH enables the high priority interrupt. No interrupt will trigger before GIEH is set. GIEL enables the low priority interrupts. GIEL only disables the low priority interrupts.
@TomTom-ty5ej5 жыл бұрын
Hi, Great job! Is it possible to put in e.g.--- __delay_ms(200);---- to somewhere to avoid debouncing? Thanks!
@BinderTronics5 жыл бұрын
Just not inside the interrupt. It is bad practice to have any blocking code in an interrupt. I do have an example of doing debouching in kzbin.info/www/bejne/e164foKubNapaM0. To make it work (the easy way) you just have to move the if(!button_press){ section to the interrupt and remove the inner if(). The hard way disabling the interrupt and re-enabling it when the timer expires.
@aheletcodefloppydevice.21964 жыл бұрын
very good
@littlekarthick34023 жыл бұрын
Hi , Do some example program ON LED blinking continuously after one press on the button and OFF LED blinking after one press on the button.
@BinderTronics3 жыл бұрын
kzbin.info/www/bejne/goqzkoKOnduLjc0 Mode swap section. Same idea.
@LeonardCotrimFreundl9 ай бұрын
But how does the PIC know where there is going to be a rising/falling Edge?
@LeonardCotrimFreundl9 ай бұрын
...to further elaborate: because you have 2 Buttons that both could potentially trigger a rising/falling Edge, so now where does it say in the code that it was the Button on Pin X and not Pin Y that triggered that Edge?
@BinderTronics9 ай бұрын
K so you got two questions 1 ".. where there is going to be a rising/falling Edge" 3:30 The register is set to tell it witch edge you use. 2 "...so now where does it say in the code that it was the Button on Pin X and not Pin Y that triggered that Edge" 4:25 Testing witch flag was set
@LeonardCotrimFreundl9 ай бұрын
@@BinderTronics I found the Problem. So, I am using the PIC24FJ512GU410 and now I had somehow overseen this, but you have to use a Pin that has a INT compatibility (obviously; and that also answers the questions; because now the pic knows what Pin it has to be checking for a falling/rising Edge). But since my PIC has so many Functions the Datasheet (or where the data sheet shows what Functions what pins have) didn't show INT1/INT2 etc. so I thought I could use any PIN hence my confusion. Now when I was reading though many datasheets it turned out that I have to map INT1/INT2 etc. Functions to specific Pins because my PIC has so many Functions it didn't fit them all on every Pin. So now I have to use PPS (Peripheral Pin Select) to assign INT1 for example to Pin X and then I can turn on the rising/falling Edge and then it will hopefully work! Thanks you none the less, I love your videos
@DanielCharry10254 жыл бұрын
Outstanding tutorial. It would be nice to have a parallel one on mpasm though. Bravo!
@BinderTronics4 жыл бұрын
I have been playing with the idea of making a series on assembler. The thing is that it is not used in the industry very much. Only in very niche cases is it used. It is by far much better to disasmble C code and then lookup the instructions that the code is generating. The other question is what assembler flavor should I use.
@StoriesoftheSoul10182 жыл бұрын
Hi, Sir I just need ur help I hope u will be biggest help sir I'm currently doing a project in which I'm interfacing pic16F877a microcontroller with Max7219 dot matrix module. Can u guide me sir regarding this Regards
@BinderTronics2 жыл бұрын
What you are looking for is how to multiplex. This covers 99% of what you need to know. kzbin.info/www/bejne/m4HchYx_gc50sKs
@StoriesoftheSoul10182 жыл бұрын
@@BinderTronics such a great 👍, thank you very much 🙂
@sailfromsurigao4 жыл бұрын
Hi, I tried simulating the circuit in proteus and loaded the hex file of the code but LED's are not turning on. Please help
@sailfromsurigao4 жыл бұрын
It says in the proteus that "MCLR is low. Processor is in reset". But when I tried to put a VDD on the MCLR pin, LED's are still not turning on
@ShahbazParviezQazi3 жыл бұрын
@@sailfromsurigao use +5V
@sailfromsurigao4 жыл бұрын
Hi, i added delays as debouncing. But I'm getting an error of "interruptsmain.c:12:6: error: variable has incomplete type 'void' void interrupt high_priority high_isr(void)"
@sailfromsurigao4 жыл бұрын
I read you comment. Got it thanks
@prashantiprao74924 жыл бұрын
Have you got answer to this question?
@vaibhavkapadia13 жыл бұрын
@binder tronics sir i am using PIC18F47Q10 for my project i am currently facing an issue that my main function is repeating itself infinitely i am using internal oscillator at 8MHZ and beside this i am not able to use interrupts i have set all the bits required for generating interrupt but i am not able to use interrupt flag for Rx and Tx in EUSART please guide me
@BinderTronics3 жыл бұрын
kzbin.info/www/bejne/poHQdoqifr51r9E kzbin.info/www/bejne/hWWsoaqdjM2kgrs Is your uart sending data out on the TX PIC->PC? Don't bother with the interrupt on the uart until the above is working. Run it in simulator and double check that the bits are set that are supposed to be.
@vaibhavkapadia13 жыл бұрын
@@BinderTronics it is transmitting the data but my problem is that my void main() function is repeating itself infinitely without any infinite loop .
@BinderTronics3 жыл бұрын
You must have a at least 1 infinite loop in the main function. Your program counter is overflowing.
@learner_analog3 жыл бұрын
@@BinderTronics I want to show you my code ,its just a simple led blinking circuit without any infinite loop , main function is executing infinitely can you share your email id so that i can send you my code
@BinderTronics3 жыл бұрын
Here is what you do. Make a github account. Create a new public repo. Upload you code there. Post the link here. I'll give it a look and give you a price estimate.
@lunakomsomi64185 жыл бұрын
Hi, I am looking for a simple code to increment a counter each time the switch is pressed.
@BinderTronics5 жыл бұрын
kzbin.info/www/bejne/goqzkoKOnduLjc0 have fun.
@toysandgames70152 жыл бұрын
Can pic18's family do everything, including motor control, because I have seen pic 32 of a university, its applications are so great that I'm bewildered. , I watch the project about pic 32 via Bruce Land's KZbin channel
@BinderTronics2 жыл бұрын
It can most likely do what you want it to do. You have to select a MCU based on your needs. This PIC can do motor control for a single motor. If a MCU can generate a PWM signal it can do motor control. The AVR atmega328p are much better at it and the king of motor control is the STM32G series. Here is what you want to research. kzbin.info/www/bejne/l4LcZHd9iK56o5Y kzbin.info/www/bejne/kJvZZJmEeMiJqas 1 PWM signal, speed control. 1-4 PWM signals, speed and direction (H-bridge). 1 PWM + ECU module, control a BLDC motor. 3 PWM signals, direct BLDC and 3 phase motors. Recommend looking at what the hobby RC communities are using rather than looking at university lectures. Side note I have only seen a PIC used in a industrial/consumer application once.
@mendupmindcode17363 жыл бұрын
sir i am watching your tutorial and i learned alot but sir i wana request please do obstacle avoidnes robot with atmega328p i write code and now i am facing issue its not working if you can do it please it will be so help and it will cover alot of topic
@BinderTronics3 жыл бұрын
Lookup hc-sr04 arduino
@mendupmindcode17363 жыл бұрын
@@BinderTronics sir i yep i got the distance from hc-sro4 but the main issue when distance is than 20 robot stop and hen i want that servo motor rotate the hc-sro4 to lef -90" and get left distance and the to right to get the right distance and then it decide which distcance is more and robot move in that irection but the main issue i got with servo motor sir if you kindly do it it will be great a great tutorial for us hence it will cover alot of topic
@keydarkman6 жыл бұрын
you could zoom in on the screen to see the code.
@BinderTronics6 жыл бұрын
What type of device are you watching on? Looks fine on a 22" screen @ 1080p but will make some adjustments. You can also have a look at the Git repo.
@keydarkman6 жыл бұрын
@@BinderTronics only do it zoom to the code.
@kaumohlamonyane2723 жыл бұрын
The accent sounds South African
@BinderTronics3 жыл бұрын
Cause it is one.
@BinderTronics3 жыл бұрын
@@kaumohlamonyane272 Suggest you remove your university and subject code from your comment.