View previous topic :: View next topic |
Author |
Message |
GiG
Joined: 03 Sep 2021 Posts: 39
|
UART and Timer_isr |
Posted: Sun Apr 17, 2022 5:53 am |
|
|
Hello everyone, I have a program that uses Uart, and in it I am using the touch module at the same time, which has a zero and one timer, and I also use the third timer, and I also use the RB.0 interrupt, and This use of interrupts in displaying Uart information shows me errors in output of terminal.
Do you have a solution for me? Thankyou
pic16f723
at 8mhz |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Sun Apr 17, 2022 7:39 am |
|
|
You really need to post your program (or a short version that shows the problem).
And the message of the 'error'.
Also the compiler version. |
|
|
PrinceNai
Joined: 31 Oct 2016 Posts: 479 Location: Montenegro
|
|
Posted: Sun Apr 17, 2022 9:31 am |
|
|
Software or hardware UART? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Sun Apr 17, 2022 10:31 am |
|
|
He says he is using RB.0 and serial inside this.
This implies a software UART.
No surprise that he has problems....
Needs to either switch to using a hardware UART, or possibly be might
be able to get it to work by tweaking the interrupt order (and therefoee
the priority with which they are handled).
He might be able to use a single timer interrupt, and the timer based
UART handler that I have posted in the past. |
|
|
PrinceNai
Joined: 31 Oct 2016 Posts: 479 Location: Montenegro
|
|
Posted: Sun Apr 17, 2022 10:41 am |
|
|
Like cutting an onion. Why using the knife, where my wife can interrupt me at any time and later complains that the onion isn't cut, when I can use a blender. |
|
|
PrinceNai
Joined: 31 Oct 2016 Posts: 479 Location: Montenegro
|
|
Posted: Sun Apr 17, 2022 10:53 am |
|
|
RB.0 interrupt is cool. Set a flag in there that you need to send something out. Exit interrupt. A few microseconds have elapsed. Main reads the flag, clears it and sends the message out. Via hardware. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Sun Apr 17, 2022 10:54 am |
|
|
OK, I'm confused..easier the older I get....
I read the post that he is using the HW UART, the RB.0 INT, and 'some' touch pins. Quick look at the datasheet shows touch pin 0 is same pin as RB.0.
I really NEED to see the code to understand HOW the PIC is configured. Actually a schematic would be better.. I like pictures....tells things faster than lines and lines of code...
I KNOW English is not an easy language, really amazed people around the World can actually figure it out....!! |
|
|
PrinceNai
Joined: 31 Oct 2016 Posts: 479 Location: Montenegro
|
|
Posted: Sun Apr 17, 2022 11:16 am |
|
|
Well, if you think English is difficult, you should try Slovenian or Serbian, which I'm forced to use where I work. Admittedly, we don't have so many words that are either written the same way or sound the same with 320 different meanings. But here basically every sentence you make can have an explicit, secondary meaning.
BTW, Oxford dictionary and Kindle with integrated dictionary helps. So do the owners of the company who speak only English. And a ton of books read in English. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Mon Apr 18, 2022 12:56 am |
|
|
temtronic wrote: | OK, I'm confused..easier the older I get....
I read the post that he is using the HW UART, the RB.0 INT, and 'some' touch pins. Quick look at the datasheet shows touch pin 0 is same pin as RB.0.
I really NEED to see the code to understand HOW the PIC is configured. Actually a schematic would be better.. I like pictures....tells things faster than lines and lines of code...
I KNOW English is not an easy language, really amazed people around the World can actually figure it out....!! |
Agree wholeheartedly Jay.
Looking at it again, the big issue is undoubtedly trying to use RB.0 as an
interrupt.... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Mon Apr 18, 2022 7:51 am |
|
|
sigh, a schematic would be nice.... to SEE what pullup, filter cap, etc is on the pin....and what kind of 'push button' is used...... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Tue Apr 19, 2022 1:56 am |
|
|
Thinking about it more, my 'suspicion' would be that he is handling one
(or more) of the ISR's incorrectly. Perhaps delaying inside the ISR or
waiting for something else to happen. Result the other ISR's get stalled.
Old 'rule of thumb' on interrupt handlers is to handle just the event they
involve, and get out ASAP. Keep ISR's quick.
I'd suggest he posts just the ISR's, hopefully commented with what he
wants them to actually do. |
|
|
|