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

UART1 is not responding - dsPIC30f3013

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



Joined: 03 Dec 2012
Posts: 19
Location: kerala

View user's profile Send private message

UART1 is not responding - dsPIC30f3013
PostPosted: Thu Dec 27, 2012 12:21 am     Reply with quote

Hi,

I am using the following piece of code for uart1 communication, sending the command 'G' through MAX233 to UART1. max233 is working fine. But uart1 is not responding. I checked it with uart2 which is working fine.

In dsPIC30f3013 pins for uart1 are also used for programming.

Any help would be appreciated. Please respond.

Thank you.
Code:

#include <30F3013.h>
#include <stdlib.h>

#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES CKSFSM //Clock Switching is enabled, fail Safe clock monitor is enabled
#FUSES NOBROWNOUT //No brownout reset

#use delay(clock=20000000)

#use rs232(baud=2400,parity=N,xmit=PIN_F3,rcv=PIN_F2,bits=8,stream=UART1)
#use rs232(baud=2400,parity=N,xmit=PIN_F5,rcv=PIN_F4,bits=8,stream=UART2)

void main()
{

while(1)
  {
   char c;
   c=fgetc(UART1);
   if(c=='G')
     fputc('A',UART1);
  }   

}

_________________

_________________
I dream world peace
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Fri Dec 28, 2012 2:51 am     Reply with quote

What compiler version?.
Always 'critical', since CCS change so many undocumented bits between versions....

A quick glance at the code generated by 4.140, looks at least at first glance to be right. They initialise both UART's during boot, and test for the URXDA bit being set, then read U1RXREG. The use of the pins for programming doesn't matter. They only become programming pins, when the correct voltage is seen on the MCLR pin. They behave as normal the rest of the time.

Best Wishes
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