Full playlist on the PIC microcontroller Programming ua-cam.com/video/KSI6fzOPVz0/v-deo.html 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.
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!
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?
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
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.
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.
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.
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.
...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?
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
@@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
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 ua-cam.com/video/E-UMOx7qv2k/v-deo.html. 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.
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
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 UA-cam channel
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. ua-cam.com/video/aQy3DGSIGm4/v-deo.html ua-cam.com/video/Zjv3fNCcVsI/v-deo.html 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.
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)"
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
@@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
@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
ua-cam.com/video/pPmEWlIYByo/v-deo.html ua-cam.com/video/O4IpwgWhqLY/v-deo.html 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.
@@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
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.
Full playlist on the PIC microcontroller Programming ua-cam.com/video/KSI6fzOPVz0/v-deo.html
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.
I was gonna write this, i did not see this explanation first , thanks.
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!
Glad to hear it is of some use.
*
nice Explanation sir. please make more video on interrupt examples.
One releasing the 4th Feb
Hello. Thanks for video. Can you tell me the benefit of using interrupts instead of doing the same just with normal digital inputs? Thanks
Polling can miss the input and it is slower at reading the input. Interrupts are clock independent and will latch until serviced.
@@BinderTronics mmmh, interesting. Thanks for the reply
Great videos and love your accent mate. Are you South African?
Yeah from the other down under.
Hi
Excelent explination on interrupts
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(){...} ?
Another if statement in the high_isr(){...}
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.
ua-cam.com/video/LYPaOXhvXWk/v-deo.html
Mode swap section. Same idea.
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?
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
Can you explain, why does "GIEL" and "GIEH" need to be set HIGH in the main code? Great video by the way! :)
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.
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.
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.
Outstanding tutorial. It would be nice to have a parallel one on mpasm though. Bravo!
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.
But how does the PIC know where there is going to be a rising/falling Edge?
...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?
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
@@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
Hi, Great job!
Is it possible to put in e.g.--- __delay_ms(200);---- to somewhere to avoid debouncing?
Thanks!
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 ua-cam.com/video/E-UMOx7qv2k/v-deo.html. 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.
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
What you are looking for is how to multiplex.
This covers 99% of what you need to know.
ua-cam.com/video/ePyTYILiAzI/v-deo.html
@@BinderTronics such a great 👍, thank you very much 🙂
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 UA-cam channel
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.
ua-cam.com/video/aQy3DGSIGm4/v-deo.html
ua-cam.com/video/Zjv3fNCcVsI/v-deo.html
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.
Hi,
I am looking for a simple code to increment a counter each time the switch is pressed.
ua-cam.com/video/LYPaOXhvXWk/v-deo.html have fun.
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)"
I read you comment. Got it thanks
Have you got answer to this question?
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
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
@@sailfromsurigao use +5V
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
Lookup hc-sr04 arduino
@@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
@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
ua-cam.com/video/pPmEWlIYByo/v-deo.html
ua-cam.com/video/O4IpwgWhqLY/v-deo.html
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.
@@BinderTronics it is transmitting the data but my problem is that my void main() function is repeating itself infinitely without any infinite loop .
You must have a at least 1 infinite loop in the main function. Your program counter is overflowing.
@@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
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.
very good
you could zoom in on the screen to see the code.
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.
@@BinderTronics only do it zoom to the code.
The accent sounds South African
Cause it is one.
@@kaumohlamonyane272 Suggest you remove your university and subject code from your comment.
@@BinderTronics Thanks for that💯