Serial interrupt not triggering

Status
Not open for further replies.

rems

New Member
how to intiialize a serial interrupt in pic16f1937 and how to set the timer interrupt for 4 ms delay using option register.could someone help me please
 
i got to know how to set the timer interrupt.i got the information from this forumhttp://www.ccsinfo.com/forum/viewtopic.php?t=22467.hope it can be helpful for someone like me.
Thanks
 
i got to know how to set the timer interrupt.i got the information from this forumhttp://www.ccsinfo.com/forum/viewtopic.php?t=22467.hope it can be helpful for someone like me.
Thanks
 
I'm not criticising but you'll get more answers here....

Serial interrupts are quite easy to set up.... Are you using asm or C? the interrupt flag is in the Peripheral Interrupt Register PIR, and the Enable bit is in the Peripheral Interrupt Enable PIE.... The PEIE bit is in the INTCON reg at bit 6... (to enable all peripheral interrupts, there are two PIR registers PIR1 and PIR2, as is there two PIE registers )

Baud is a tad complicated if you haven't done it before.... The whole serial module has also to be turned on with the SPEN bit...

For the timer setting, you'll need to tell me what crystal / speed you'll be running at....
 
Last edited:
Thanks.actually i got the serial interrupt working proper.
Timer iam usinh 16MHZ Frequency.
iam sending delay (which is selected by the user ) in C# throught serial port to PIC.I need the interrupts to trigger when they get that delay and send the temperature with that delay back to c#.
 
iam not getting the delay and my timer interrupt is not triggering
 
Last edited:
Timer0...... set the OPTION_REG prescaler..... Set the TMR0IE and clear the TMR0IF..... Preload TMR0 with your 4mS calculated figure

16mhz / 4 = 4mhz.... clock cycle = .250uS 4Ms / .250uS = 16000 (oops too big )... If you set the prescaler to 64:1... 16uS you need to count 250..

If you preload your TMRO with 5.... a prescaler of 64:1... it should be nearly 4mS

If my maths are way off... someone correct me..

Remember to set GIE
 
Last edited:
Thanks Ian ,but i have a doubt,it may be a stupid question how to perload the timer with 5.
 
Last edited:
TMR0 = 5; It will then count 250 and fire the interrupt.... At the end of the interrupt re-load with 5 again..
 
I have a doubt in my program iam using serial interrupt ,when it gets triggered user select delay from c# is sent through serial port to PIC.Once the delay is send i have a calibration select in my c# and in that user can give calibration values.Those calibrations values also need to send through serial port to Pic.Can i use the same serial interrupt for this calibration values.
 
You can send almost anything through the serial port ( Full firmware updates if needed )... The trick is to get a robust enough connection..
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…