|
|
View previous topic :: View next topic |
Author |
Message |
noxus
Joined: 16 Nov 2009 Posts: 6
|
2 serial ports on PIC18F46J50 |
Posted: Tue Jan 12, 2010 3:41 am |
|
|
Hello all,
I'm using version 4.099 of the compiler and I'm having problems using two serial ports on a PIC18F46J50.
The datasheets states that there are two Enhanced USART modules but when I try to use the second serial port I always get the following message from the compiler:
USE parameter value is out of range No Second UART
Note: In order to make the first serial port work I already had to change the serial port settings via chipedit.
http://www.ccsinfo.com/forum/viewtopic.php?t=39876
The code that I'm using ...
Code: |
#include <18F46J50.h>
#include "string.h"
#include "stdlib.h"
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_PLL //Internal oscillator
#FUSES NOPROTECT //Code not protected from reading
#use delay(clock=8000000)
#use rs232(UART1,BAUD=38400,PARITY=N,XMIT=PIN_C6,RCV=PIN_C7,BITS=8,STOP=1,STREAM=ser1)
#pin_select RX2=PIN_D6
#pin_select TX2=PIN_D7
#use rs232(UART2,BAUD=38400,BITS=8,XMIT=PIN_D7,RCV=PIN_D6,PARITY=N,STOP=1,STREAM=ser2)
void main()
{
setup_wdt(WDT_OFF);
while (1)
{
// Test serial port 1
fprintf(ser1, "Testing UART1...\r\n");
// Test serial port 1
fprintf(ser2, "Testing UART2...\r\n");
delay_ms(200);
}
}
|
Maybe I'm doing something wrong. I don't have alot of experience using the CCS compiler. Any advice is appreciated! |
|
|
wireless
Joined: 02 Nov 2003 Posts: 16 Location: London England
|
Two UARTS |
Posted: Tue Jan 12, 2010 4:18 am |
|
|
When you specify UART1 or UART2 in the #use rs232 command, you don't need to, also, list the XMIT and RCV pin allocation. The compiler knows which pins you use for the two ports.
Not sure why you needed to edit the port settings.
Regards
Terry |
|
|
|
|
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
|