Disabling interrupts for serout SX/B
Dunnsept
Posts: 115
I'm adding a serial graphics LCD to my project. The help file says to disable interrupts before using serout
but I can't find in the docs the best way to do this.
Can I set OPTION at any time in code?
would something such as this work:
right now I'm using the RTCC as a sort of timer.. even if my time periods wind up off by a few seconds because of this,
if it works, I don't mind.. I can adjust the time periods anyway.
thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
stand back! I have a slide rule and I know how to use it!
but I can't find in the docs the best way to do this.
Can I set OPTION at any time in code?
would something such as this work:
start: OPTION = $86 'int enable, prescalar = 128 main: 'blah blah 'blah 'oops need serout OPTION = $C6 'option reg stays same except bit 6 (RTI) is now 1 serout txpin,baud,"hi" OPTION = $86 're-enable interrupts 'do stuff goto main
right now I'm using the RTCC as a sort of timer.. even if my time periods wind up off by a few seconds because of this,
if it works, I don't mind.. I can adjust the time periods anyway.
thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
stand back! I have a slide rule and I know how to use it!
Comments
Depending on the interrupt code, you might be able to adjust the baud rate to "factor in" the time spent in the interrupt.
Can you post your interrupt routine ?
What baud rate are you using ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"I reject your reality, and substitute my own." Mythbusters
·
Mainly I'm playing around with the LCDs and will add one to the existing code I have for the coffee roaster and beer brewer.
right now I'm using T9600 for baud and the LCD_OUT sub written by jon williams (thank you, jon)
LCD supports 9600, 19,2 and 38,4
this stuff is way cool.. no interrupts or anything right now, but I have it setup with my thermocouple.. top part of the display shows
temp: 75F
and then bottom part of display is a graph of temp vs time.. kinda like an autochart.. display scrolls to the right and keeps plotting temp
I guess I could just slap an interrupt in there and see what happens... not like I'm gonna get much real work done today anyway
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
stand back! I have a slide rule and I know how to use it!
What you can do is keep adjusting the baud rate up in 1% increments until it starts working, then keep increasing it until it stops working again. Then use the average of the highest and lowest working values.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"I reject your reality, and substitute my own." Mythbusters
·
=0 sets 9600
=1 sets 19,2
=3 sets 38,4
something to play around with this weekend.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
stand back! I have a slide rule and I know how to use it!
I'm working on a project where I get 100 interrupts per second.· My ISR increments a memory location and then returns, so it only uses a few cycles.· I've never seen a problem with serial input or output with interrupts enabled.
·
Because the ISR will "slow down" the baud rate (because it takes time that is not accounted for). You need to adjust the baud rate up to account for it.
This works best when the ISR is very short, and occurs often (at least several times each bit).
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"I reject your reality, and substitute my own." Mythbusters
·
I'm off to Toronto for a wonderful week of SAP Business Process Integration indoctrination.. I mean training.
I'll check it out when I return
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
stand back! I have a slide rule and I know how to use it!