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

Printf(), putc() behaviour regarding hanging processor

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



Joined: 19 Jan 2005
Posts: 22

View user's profile Send private message

Printf(), putc() behaviour regarding hanging processor
PostPosted: Wed Feb 16, 2005 8:23 am     Reply with quote

Hi All,

I have a question since a long time... Does the PIC need to wait the transfert over RS232 during a printf(0 or putc() function? or is there somewhere a buffer to prevent that?
With examples:
printf ("Hello world");
instruction2;

for coming from printf to instruction to I have to wait the complete transmission of the data over RS232 (time will depend on baudrate) or only few cycles to setup the things and transfer data to internal buffer?
Same for putc()... Do I need to wait the complete transmission of the character or not?

Thanks
Pascal
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Feb 16, 2005 8:28 am     Reply with quote

It waits. You can use sprintf to a buffer and do the transmission yourself. That is how I would do it.
darrepac



Joined: 19 Jan 2005
Posts: 22

View user's profile Send private message

PostPosted: Wed Feb 16, 2005 8:29 am     Reply with quote

It was also my asumption and that's why I have done like this too...but I wanted to check, to be sure I am doing work for nothing
darrepac



Joined: 19 Jan 2005
Posts: 22

View user's profile Send private message

PostPosted: Wed Feb 16, 2005 10:23 am     Reply with quote

Just agin to be sure, interruption are still working during a printf()?
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Feb 16, 2005 11:54 am     Reply with quote

You will have to look at the lst file for that. That's why I hate all that "automagic" code that CCS produces. You can't tell what is going on without diving into it and they can change it at a whim.
darrepac



Joined: 19 Jan 2005
Posts: 22

View user's profile Send private message

PostPosted: Thu Feb 17, 2005 7:26 am     Reply with quote

shame :-(
darrepac



Joined: 19 Jan 2005
Posts: 22

View user's profile Send private message

PostPosted: Thu Feb 17, 2005 2:15 pm     Reply with quote

I have the impression that Interrupt are disabled during putc()...but I am not sure at all Confused , does someone could confirm?
thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 17, 2005 2:25 pm     Reply with quote

Whenever you compile, a listing file (.LST) is generated, which you
can examine to see what the compiler is doing. In the case of
putc(), here is the listing for a 16F877 with the hardware USART.
You then look in the data sheet in the Special Function Registers
table, to see what registers and bits are being used. You also
have to take into account the bank selection, but in the case
below, it's all in Bank 0.

Code:
0000                00307 ....................   
0000                00308 .................... putc(0x55); 
0014 3055       00309 MOVLW  55
0015 1E0C       00310 BTFSS  0C.4
0016 2815       00311 GOTO   015
0017 0099       00312 MOVWF  19
0000                00313 ....................   
darrepac



Joined: 19 Jan 2005
Posts: 22

View user's profile Send private message

PostPosted: Thu Feb 17, 2005 2:39 pm     Reply with quote

Ok thanks in fact I have done a mistake in my reading causing me troubles to understand...now it is far clearer
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