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

PIC16F630 and RS232

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



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PIC16F630 and RS232
PostPosted: Tue Dec 13, 2005 2:30 am     Reply with quote

Hi Everybody,

This is a first time I use RS232 in software with CCS compiler.

I'm using RS232 in PIC16F630 without USART with internal RC oscillator 4 Mhz.
Quote:

#use delay(clock=4000000, RESTART_WDT)
#use rs232(baud=9600, xmit=PIN_C4,rcv=PIN_C3)


the PIC send out a character but it isn't 9600 baud and the PC doesn't see the comunication.

One character at 9600 baud take 1,87 ms time, my pic send the same character in 1,37 ms.

I'm using PCWH V3.235.

Have you something to suggest me ?

Thanks for support,
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Tue Dec 13, 2005 2:55 am     Reply with quote

Hi,

Because I use an RTCC interrupt every 200uS, I disabled it and the comunication start to work correctly.

I stay in interrupt 26 uS, just to take a count of time.

Why does it?

Thanks,
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Dec 13, 2005 3:04 am     Reply with quote

Fabri wrote:
Hi,

Because I use an RTCC interrupt every 200uS, I disabled it and the comunication start to work correctly.

I stay in interrupt 26 uS, just to take a count of time.

Why does it?

Thanks,


You have answered your own question. I am not sure about the specific numbers you have mentioned but every 200us you spend 26us in the interrupt handler. The software UART counts bit time in software. It is not able to determine that the the interrupt handler has repeasted interrupted the process.

At 9600 baud a standard 8 bit no parity character transmission takes 1.04ms including the start and stop bit. Five or 6 interrupts will occur during this period adding an additional 120us to 156us plus the call return overhead if you have not already included this in your number.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Ttelmah
Guest







PostPosted: Tue Dec 13, 2005 4:58 am     Reply with quote

Also, the actual interrupt tie will be longer than 26uSec. I'd suspect this is the duration in the 'handler', rather than the total interrupt time. On a PIC, when an interrupt occurs, the global handler is called, which saves the registers, then calls the actual 'event handler'. When this finishes, the code returns to the global handler, which clears the interrupt flag, restores the registers, and finally returns to the main code.
Unfortunately, even if the event handler itself, only takes 26 instructions, the global handler will typically add perhaps another 50uSec to this. With an RTC at 200uSec, and an event handler that lasts 26uSec, the processor will be in the global handler and the event handler for this, about 76uSec out of every 200uSec. About 1/4 the processor time.....

Best Wishes
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