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

#use rs232 ONLY TX

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



Joined: 18 Nov 2008
Posts: 274
Location: Athens, Greece.

View user's profile Send private message

#use rs232 ONLY TX
PostPosted: Fri Sep 24, 2021 5:40 am     Reply with quote

Hello friends,

I am using a PIC24FJ16GA002 and I need the UART only for sending debug messages to the PC. I do not need to receive anything.
Is there a way to enable only the TX pin?

If I do not "pin_select" the U1RX I get error: "USE parameter value is out of range No UART defined, May need #PIN_SELECT"

Thanks!
_________________
George.
jeremiah



Joined: 20 Jul 2010
Posts: 1314

View user's profile Send private message

PostPosted: Fri Sep 24, 2021 5:55 am     Reply with quote

if it is just for output, you can use a software serial port:

Code:

#use rs232(FORCE_SW,baud=9600,DISABLE_INTS, XMIT=PIN_B2)


Another thing you could try if you want to use a hardware serial port is set both pin_selects for TX and RX to the same pin.

Code:

#pin_select U1RX=PIN_B2
#pin_select U1TX=PIN_B2
#use rs232(UART1,baud=9600,ERRORS)


I think as long as you don't call getc it should be fine, but I've never tried it.
temtronic



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

View user's profile Send private message

PostPosted: Fri Sep 24, 2021 6:18 am     Reply with quote

I agree, use software serial TX only.
Simple and easy AND it keeps the HW serial available for future use( like 3 days from now, when client 'needs' a new feature.....)
Also ..any I/O pin can be used.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Sep 24, 2021 6:29 am     Reply with quote

Key is what is allowed on the UART.
You can turn off the TX part, but you can't separately turn off the RX.

So the standard way to get RX only, it to setup both, and then manually
turn off the TX.
For TX only this isn't available. However there is a very simple solution.

Just #pin select the RX pin to the same pin as the TX.
This way the RX will receive every character you send. If you don't have
any code to handle the RX, then these will just be ignored. Very Happy
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