|
|
View previous topic :: View next topic |
Author |
Message |
aroonkriss
Joined: 03 Dec 2012 Posts: 19 Location: kerala
|
UART1 is not responding - dsPIC30f3013 |
Posted: Thu Dec 27, 2012 12:21 am |
|
|
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: 19536
|
|
Posted: Fri Dec 28, 2012 2:51 am |
|
|
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 |
|
|
|
|
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
|