CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

UART and Timer_isr

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
GiG



Joined: 03 Sep 2021
Posts: 39

View user's profile Send private message

UART and Timer_isr
PostPosted: Sun Apr 17, 2022 5:53 am     Reply with quote

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: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Apr 17, 2022 7:39 am     Reply with quote

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: 452
Location: Montenegro

View user's profile Send private message

PostPosted: Sun Apr 17, 2022 9:31 am     Reply with quote

Software or hardware UART?
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Sun Apr 17, 2022 10:31 am     Reply with quote

He says he is using RB.0 and serial inside this.
This implies a software UART.
No surprise that he has problems.... Sad

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: 452
Location: Montenegro

View user's profile Send private message

PostPosted: Sun Apr 17, 2022 10:41 am     Reply with quote

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: 452
Location: Montenegro

View user's profile Send private message

PostPosted: Sun Apr 17, 2022 10:53 am     Reply with quote

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: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Apr 17, 2022 10:54 am     Reply with quote

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... Very Happy
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: 452
Location: Montenegro

View user's profile Send private message

PostPosted: Sun Apr 17, 2022 11:16 am     Reply with quote

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: 19195

View user's profile Send private message

PostPosted: Mon Apr 18, 2022 12:56 am     Reply with quote

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... Very Happy
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: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Apr 18, 2022 7:51 am     Reply with quote

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: 19195

View user's profile Send private message

PostPosted: Tue Apr 19, 2022 1:56 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group