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 CCS Technical Support

RS232 Interrupts with real time host

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



Joined: 28 Jul 2004
Posts: 8

View user's profile Send private message

RS232 Interrupts with real time host
PostPosted: Tue Jul 19, 2005 8:53 am     Reply with quote

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







PostPosted: Tue Jul 19, 2005 9:12 am     Reply with quote

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

View user's profile Send private message

RS232 Interupts with real time host
PostPosted: Tue Jul 19, 2005 1:05 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jul 19, 2005 2:58 pm     Reply with quote

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







PostPosted: Tue Jul 19, 2005 3:02 pm     Reply with quote

'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

View user's profile Send private message

RS232 Interupts with real time host
PostPosted: Tue Jul 19, 2005 3:09 pm     Reply with quote

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. Cool
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