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

rx and tx dont tied down

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







rx and tx dont tied down
PostPosted: Mon Feb 16, 2009 1:36 pm     Reply with quote

Hi,
Im using eusart of a 18f4520, when my process finishes i need to tied down the RX and TX pins, so I use output_low(PIN_C6); and output_low(PIN_C7); but it doesnt work, what can i do?Crying or Very sad

Thanks
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Feb 16, 2009 1:56 pm     Reply with quote

I would expect you will first have to disable the EUSART before you "take over" the pins to control them...

setup_uart(false);

This "disconnects" the EUSART so you can control the I/O pins.

Of course you will have to turn it back on when you get ready to use it again.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Mon Feb 16, 2009 2:41 pm     Reply with quote

Note that low is not the usual idle state for serial pins. If the UART is still active when you pull the serial pin low it will see that as a Start bit and clock in a garbage character. You are doing something unusual, so it may take a bit more typing than the usual.
_________________
The search for better is endless. Instead simply find very good and get the job done.
julian
Guest







rx and tx dont tied down
PostPosted: Mon Feb 16, 2009 4:36 pm     Reply with quote

Thank you dyeatman and SherpaDoug .

Problem solved. I use set_uart(FALSE) like dyeatman say and now my program works well

Very Happy
julian
Guest







rx and tx dont tied down
PostPosted: Tue Feb 17, 2009 6:30 pm     Reply with quote

Using setup_uart(FALSE); bring another problem, now my mcu doesnt wake up, this is the code I use at the end of my program
Code:
setup_uart(FALSE);

output_c(0x00);
output_d(0x00);

delay_ms(2000);   
output_low(RELAY);
delay_ms(500);

ext_int_edge(2, H_TO_L);
enable_interrupts(INT_EXT2);
clear_interrupt(INT_EXT2);   
enable_interrupts(GLOBAL); 


I tried this

Code:
//setup_uart(FALSE);
#asm ASIS
BCF    0x0FAB.7
BCF    0x0FAB.4
#endasm


//delay_ms(100);
 output_c(0x00);
 output_d(0x00);

//delay_ms(2000);   
   output_low(RELAY);
//   delay_ms(500);

   ext_int_edge(2, H_TO_L);
   enable_interrupts(INT_EXT2);
   clear_interrupt(INT_EXT2);   
   enable_interrupts(GLOBAL);   
   sleep();

yesterday without setup_uart(FALSE); mcu wake up

Thanks in advance
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