HI. With INTCONbits.GIEH/GIEL = 1 you are ENABLING the global interrupt priority high and low. But when you explain isr you say that : with GIEH = 0 is for ENABLE and GIEH = 1 is for DISABLE. Why ? second answer: why in isr low priority are setting GIEH bit and not GIEL ? Thank you
@@lorenrus Don't know where I say GIEH = 1 is for DISABLE. Can you maybe give me a timestamp? As for the why I'm not using GIEL. I don't want the code to jump from the low to high isr while the low isr is doing its thing. GIEH = 0 serves as a disable all interrupts. Please refer to here: ua-cam.com/video/MiPxVmj_nHI/v-deo.html
Thing is the code can very wildly depending on the situation. Here is the basic principal. digilent.com/reference/learn/microprocessor/tutorials/debouncing-via-software/start
@@BinderTronics thanks so much!!! I was able to understand some of this ha, and i messed around, struggled a bit, and then i figured something out!! Keep up the great content!
Hi :) if i want to enable PLL to generate F = 32 MHz, on your code i have to add only the line PLLEN = 1, correct ? Another question, if i have to calculate the Tcycle for timer = 4/Fosc * Prescaler * 255(with 8 bit), in your example you have to enable clock freq equal to 8 Mhz and Fosc is 8 Mhz, but if i enable PLL the clock freq will begin 32 Mhz and to calculate the value 4/Fosc have i to consider Fosc = 32 Mhz ? Thank you
330R for the LEDs (~20mA @ 5V). 1k for the switch. Some extra stuff. bindertronics.com/tutorials/pic-programming/hardware-connections Not a dumb question. I did not specify it. These are rule of thumb values. You will often see the values 1k 10k 100k 1M in digital design. LEDs generally want to have about 20mA passing though them.
For me I am not getting an output, I followed most of the code with a PIC18F45K20 (64MHz). Except no prescalar, and every time the timer overflows it increments a two dimensional array variable to output. I have transistors that control the colors on PORTA and the base to activate it is on PORTCbits.RC0. Neither give an output even when hardcoded in before,/during infinite loop or ISR.
Execution insurance. Not necessary on this particular PIC microcontroller but some do not have ISR guards that prevent interrupts from trigging while running a ISR. Basically just forcing the ISR to finish running before it can process another interrupt(s).
@@BinderTronics But that would be in the case of single ISR? If you had multiple interrupt sources/routines, then I assume touching GIE in ISR wouldn't be wise.
Have you had a look at this ua-cam.com/video/MiPxVmj_nHI/v-deo.html ? This is the case for multiple ISR routines. The flag is the trigger for a interrupt. If a interrupt flag is set before GIE is enable then the interrupt will trigger only after GIE is enabled. In shot. I prefer to manually disable interrupts when doing ISRs. When one vector can service more than one interrupt. At the end if the day the application and documentation determine the function of how you use GIE.
@@BinderTronics Wou sê daai aksent klink bekend. Ek het oldschool 8085 assembler geprogrameer. Leer nou eers om in C te programmeer . Jou videos maak dit sommer maklik, dankie. Ek fokus tans op die PIC 16f88
@@daniejcbs261 Dryg nou al a ruk om n reeks te doen op die PIC16F887A in assembler maar die voel soos tanne trek om van C af trug na assembler toe te gaan. Baie goed wat C net vir jou handle in die agtergrond.
@@BinderTronics Nee jis C maak die lewe baie makliker soos met die Arduino's. libraries is klaar daar al wat nodig is is om te include. Wens ek het dit lankal al geleer. In die ou dae met assembler, soos met die 8085 CPU, moes 'n mens meeste subroutines self sryf en daar was altyd 'n horde foute wat met die saamgekom het. Maar dit sal nice wees as jy daai reeks kan doen vir mense wat nog nie in assembler geprogrameer het nie.
@@BinderTronics Sal nice wees as jy die reeks kan doen. Lyk my PIC16F887 is nogal groot in die PIC gemeenskap, ek sien communica het darm van hulle so gaan solank vir my 'n paar aanskaf vir as jy besluit om die reeks te doen.
Full playlist on the PIC microcontroller Programming ua-cam.com/video/KSI6fzOPVz0/v-deo.html
If there is anything you would like to see let me know.
HI. With INTCONbits.GIEH/GIEL = 1 you are ENABLING the global interrupt priority high and low. But when you explain isr you say that : with GIEH = 0 is for ENABLE and GIEH = 1 is for DISABLE. Why ?
second answer: why in isr low priority are setting GIEH bit and not GIEL ? Thank you
@@lorenrus Don't know where I say GIEH = 1 is for DISABLE. Can you maybe give me a timestamp? As for the why I'm not using GIEL. I don't want the code to jump from the low to high isr while the low isr is doing its thing. GIEH = 0 serves as a disable all interrupts. Please refer to here: ua-cam.com/video/MiPxVmj_nHI/v-deo.html
Binder Tronics Now i understand . Thank you:)
This series looks super helpful. I have a microcontrollers exam on PICs tomorrow
Good luck!
Great explanation of the code. Thanks.
Muchas gracias por el video, esta bueno el tutorial, continua subiendo videos.
Again an excelent explination. Thanks
Nicely explained, really helpful
Thanks appreciate the feedback.
Nice video! The counter variable overflowed at 255 instead of being reset at 200, thats why it “worked”. Error was not really noticeable.
Witch counter are you referring too? I am assuming the blink_count. Cause the led will never blink if the counter overflows.
@@BinderTronics Yeah blink_count @15:00. uint8_t is one byte wide, so it flips back to zero when it = 255 and gets incremented.
@@JohnSmithZen Yeah I am aware of it by now. Just never bother to update the comment.
Great video series!! Do you have any suggestions on how to implement a pushbutton counter with debounce?
Thing is the code can very wildly depending on the situation.
Here is the basic principal.
digilent.com/reference/learn/microprocessor/tutorials/debouncing-via-software/start
@@BinderTronics thanks so much!!! I was able to understand some of this ha, and i messed around, struggled a bit, and then i figured something out!! Keep up the great content!
Hi :)
if i want to enable PLL to generate F = 32 MHz, on your code i have to add only the line PLLEN = 1, correct ?
Another question, if i have to calculate the Tcycle for timer = 4/Fosc * Prescaler * 255(with 8 bit), in your example you have to enable clock freq equal to 8 Mhz and Fosc is 8 Mhz, but if i enable PLL the clock freq will begin 32 Mhz and to calculate the value 4/Fosc have i to consider Fosc = 32 Mhz ?
Thank you
You are correct in both cases. Watch the heat on the chip when using PLL. Also you need to change the _XTAL_FREQ define to 32000000
This might be a dumb question. Could you specify the resistance values used here? Thanks in advancec
330R for the LEDs (~20mA @ 5V). 1k for the switch.
Some extra stuff.
bindertronics.com/tutorials/pic-programming/hardware-connections
Not a dumb question. I did not specify it. These are rule of thumb values. You will often see the values 1k 10k 100k 1M in digital design. LEDs generally want to have about 20mA passing though them.
For me I am not getting an output, I followed most of the code with a PIC18F45K20 (64MHz). Except no prescalar, and every time the timer overflows it increments a two dimensional array variable to output. I have transistors that control the colors on PORTA and the base to activate it is on PORTCbits.RC0. Neither give an output even when hardcoded in before,/during infinite loop or ISR.
Best i can tell you is to step debug the code. ua-cam.com/video/O4IpwgWhqLY/v-deo.html
Any particular reason for resetting GIEH at beginning of ISR and setting it back on at end of ti?
Execution insurance. Not necessary on this particular PIC microcontroller but some do not have ISR guards that prevent interrupts from trigging while running a ISR. Basically just forcing the ISR to finish running before it can process another interrupt(s).
@@BinderTronics But that would be in the case of single ISR? If you had multiple interrupt sources/routines, then I assume touching GIE in ISR wouldn't be wise.
Have you had a look at this ua-cam.com/video/MiPxVmj_nHI/v-deo.html ?
This is the case for multiple ISR routines. The flag is the trigger for a interrupt. If a interrupt flag is set before GIE is enable then the interrupt will trigger only after GIE is enabled.
In shot. I prefer to manually disable interrupts when doing ISRs. When one vector can service more than one interrupt. At the end if the day the application and documentation determine the function of how you use GIE.
Klink of jy Afrikaans kan praat :-). Great videos!
Dis omdat ek kan.
@@BinderTronics Wou sê daai aksent klink bekend. Ek het oldschool 8085 assembler geprogrameer. Leer nou eers om in C te programmeer . Jou videos maak dit sommer maklik, dankie. Ek fokus tans op die PIC 16f88
@@daniejcbs261 Dryg nou al a ruk om n reeks te doen op die PIC16F887A in assembler maar die voel soos tanne trek om van C af trug na assembler toe te gaan. Baie goed wat C net vir jou handle in die agtergrond.
@@BinderTronics Nee jis C maak die lewe baie makliker soos met die Arduino's. libraries is klaar daar al wat nodig is is om te include. Wens ek het dit lankal al geleer. In die ou dae met assembler, soos met die 8085 CPU, moes 'n mens meeste subroutines self sryf en daar was altyd 'n horde foute wat met die saamgekom het. Maar dit sal nice wees as jy daai reeks kan doen vir mense wat nog nie in assembler geprogrameer het nie.
@@BinderTronics Sal nice wees as jy die reeks kan doen. Lyk my PIC16F887 is nogal groot in die PIC gemeenskap, ek sien communica het darm van hulle so gaan solank vir my 'n paar aanskaf vir as jy besluit om die reeks te doen.
how to generate a PWM for some limited Time?
ua-cam.com/video/Zjv3fNCcVsII/v-deo.html
Is jy afrikaans
Lang storie kort. ja.