View previous topic :: View next topic |
Author |
Message |
robert_terrell
Joined: 28 Jul 2004 Posts: 8
|
RS232 Interrupts with real time host |
Posted: Tue Jul 19, 2005 8:53 am |
|
|
I'm using a 18F452 in a magnet winding temperature monitor that is interfaced to an EPICS IOC. The VXworks operating system is real time. The hardware platform is VME with a Greensprings carier card and an IP Octal RS232 IP pack. The problem is:
When I leave the 232 connected and boot the interupts doen't work.
When I boot and then connect the 232 it works.
Do I have to clear some registers? |
|
|
Ttelmah Guest
|
|
Posted: Tue Jul 19, 2005 9:12 am |
|
|
Obvious question.
What 'error' handling do you have?.
Depending on what is seen, you could have an overrun error, or a 'framing' error in the UART. If ERRORS is set, and the interrupt is called, this should clear, but if you either don't have the ERRORS value set, don't have an equivalent in your own code, or clear the receive data interrupt before enabling the interrupts (so the error clearing routine does not get called), then the error will prevent further reception.
Best Wishes |
|
|
robert_terrell
Joined: 28 Jul 2004 Posts: 8
|
RS232 Interupts with real time host |
Posted: Tue Jul 19, 2005 1:05 pm |
|
|
Hum, I thought I posted a reply but I didn't see it show up.
I am unfamilier with the ERRORS statement. I am however getting an overrun bit set with no framing errors. I was really hoping to do this in ccs c. Do I need to clear the bit in asm? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jul 19, 2005 2:58 pm |
|
|
Quote: | I am unfamilier with the ERRORS statement.
I was really hoping to do this in ccs c. | http://www.ccsinfo.com/forum/viewtopic.php?t=19759 |
|
|
Ttelmah Guest
|
|
Posted: Tue Jul 19, 2005 3:02 pm |
|
|
'ERRORS', is a keyword for the #use RS232 command. It adds automatic error handling to the getc routine to clear these errors.
This will work, provided your code is calling the interrupt handler once (it should be, unless you are clearing the interrupt flag), and the handler always does a getc.
If you want to deal with the bit directly, you do not need assembler. You can (for example), just code:
Code: |
#bit OERR=0xFAB.1
#bit CREN=0xFAB.4
if (OERR) {
CREN=false;
CREN=true;
}
|
This simply tests the 'overrun error' bit (register 0xFAB, bit 1, on an 18F chip), and if this is set, disables, then re-enables 'continuous receive', which is the way to clear this bit.
Best Wishes |
|
|
robert_terrell
Joined: 28 Jul 2004 Posts: 8
|
RS232 Interupts with real time host |
Posted: Tue Jul 19, 2005 3:09 pm |
|
|
Thanks,
I had forgotten about the ERRORS argument. It's really hot this time of year. It works just fine. Thanks again, I'm sure I'll have more stupid questions but when I finally get tired of beating on something a post to here usually fixes the problem. |
|
|
|