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 support@ccsinfo.com

RS232 putc and putc_send

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



Joined: 11 Jun 2021
Posts: 10

View user's profile Send private message

RS232 putc and putc_send
PostPosted: Mon Jul 26, 2021 6:46 am     Reply with quote

I've setup my uart and if I don't use flow control I can send out data using 'putc'. But when I turn the flow control on (RTS/CTS) I have to follow each putc with a putc_send.

It appears that putc is puts the byte it in the transmit buffer and putc_send transmits it. Is this right?

It does seem like that when I read the manual. Confused
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jul 26, 2021 6:51 am     Reply with quote

need to know ...
Which PIC, which Compiler version and plase post a small, compilable program that show us what you're doing...
Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Jul 26, 2021 7:10 am     Reply with quote

Yes. It depends massively on whether you are using a TRANSMIT_BUFFER,
and whether you are using the TXISR option or not.
PICAlison



Joined: 11 Jun 2021
Posts: 10

View user's profile Send private message

PostPosted: Mon Jul 26, 2021 8:18 am     Reply with quote

Here's my setup directive for the uart:
Code:
// with flow control
#use rs232(stream=BLUETOOTH, UART1, baud=115200, RTS=PIN_B5, CTS=PIN_B4, RECEIVE_BUFFER=20, TRANSMIT_BUFFER=20, stream=UART_PORT1, xmit=PIN_B14, FLOW_CONTROL_MODE, rcv=PIN_B15, parity=N, bits=8, stop=1, errors)


This is how I am using it:
Code:
  putc('$', BLUETOOTH);
   putc_send(BLUETOOTH);


The help for putc says "sends a character over the RS232 XMIT pin" and putc_send() says "transmit bytes loaded in transmit buffer over RS232".

So it doesn't sound like I need the putc_send, but I do? Confused
PICAlison



Joined: 11 Jun 2021
Posts: 10

View user's profile Send private message

PostPosted: Mon Jul 26, 2021 8:24 am     Reply with quote

Update: I need a TXISR in the setup to enable to us "TBE interrupt for transmitting data".

Default is NOTXISR ... Smile
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Jul 26, 2021 9:32 am     Reply with quote

Yes.

As I said:
Quote:

and whether you are using the TXISR option or not.


The key is that this is what allows the TRANSMIT_BUFFER to actually send
without you signalling to do so....
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