I'm using dspic33fj128gp802 that works ok with 10Mhz xtal with pll x 8 (40 Mips) and max232 to interact with the uart1 pins that worked ok with my 18f projects.
The first Uart1_Write_text command works ok, but i can't see anything more of the serial data i'm providing to the dspic through the rp3 at 9600bps or other baud rates at which I have also tested.
Could you help me ?, is very important.
Here is a minimal code:
Code: Select all
program UART1_TEST
dim recibido as char
main:
'xtal hs 10 Mhz, PLL x 8
CLKDIV.0=0 CLKDIV.1=0 CLKDIV.2=0 CLKDIV.3=0 CLKDIV.4=0
PLLFBD=30'
CLKDIV.6=0 CLKDIV.7=0
ADP1CFG = 0xFFFF ' all digital
TRISB.3=1 ' as input for uart1 read
TRISB.6=0 ' as output for uart1 write
Unlock_IOLOCK()
PPS_Mapping(6, _OUTPUT, _U1TX) 'mapping rp6 as uart1 output
PPS_Mapping(3, _INPUT, _U1RX) ' mapping rp3 as uart1 input
Lock_IOLOCK()
UART1_Init(9600)
delay_ms(100)
Uart1_Write_text("Start receiving:")
Uart1_Write(10)
Uart1_Write(13)
while true
if (UART1_Data_Ready() <> 0) then ' If data is received,
recibido = UART1_Read() ' read the received data,
UART1_Write(recibido) ' and write
end if
wend
end.
Thanks in advance