View previous topic :: View next topic |
Author |
Message |
PICAlison
Joined: 11 Jun 2021 Posts: 10
|
RS232 putc and putc_send |
Posted: Mon Jul 26, 2021 6:46 am |
|
|
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](images/smiles/icon_confused.gif) |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9170 Location: Greensville,Ontario
|
|
Posted: Mon Jul 26, 2021 6:51 am |
|
|
need to know ...
Which PIC, which Compiler version and plase post a small, compilable program that show us what you're doing...
Jay |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19359
|
|
Posted: Mon Jul 26, 2021 7:10 am |
|
|
Yes. It depends massively on whether you are using a TRANSMIT_BUFFER,
and whether you are using the TXISR option or not. |
|
![](templates/subSilver/images/spacer.gif) |
PICAlison
Joined: 11 Jun 2021 Posts: 10
|
|
Posted: Mon Jul 26, 2021 8:18 am |
|
|
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](images/smiles/icon_confused.gif) |
|
![](templates/subSilver/images/spacer.gif) |
PICAlison
Joined: 11 Jun 2021 Posts: 10
|
|
Posted: Mon Jul 26, 2021 8:24 am |
|
|
Update: I need a TXISR in the setup to enable to us "TBE interrupt for transmitting data".
Default is NOTXISR ... ![Smile](images/smiles/icon_smile.gif) |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19359
|
|
Posted: Mon Jul 26, 2021 9:32 am |
|
|
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.... |
|
![](templates/subSilver/images/spacer.gif) |
|