hey!! i'am using a DSPIC30f4013 and i'm not able to receive the correct sent carracter.
So on 1 side i got a the PIC with the transmit routine wich work perfectly has when i look at the Tx port with a scop i can see the value been sent.
for the receiving end it just don't give me the correct caracter sent. I feel like it's an issue with receiving buffer becuz i will get the correct data at times, when i read the Rx register in interrupt routine.
i set the pic to generate interrupt on a full buffer and only on one caracter received but same result: can have the expected data sent
============================== ============================== ==============================
bonjour, j'essaye de mettre en place une comm avec UART de Mon DSPIC
La transmission est réussi par lecture du port de TX du module
Par contre la reception NON! le code de la reception est joint et aussi simple qu'il puisses paraitre il semble y avoir de la gestion de tempons a faire ''je penses''
mais que faire? avez vous des suggestions?
here is my routine:
Code:.equ __30F4013, 1 .include "p30f4013.inc ; ----------------------------------------------------------------------------- ; Global Declarations ; ----------------------------------------------------------------------------- config __FOSC, XT_PLL4 & CSW_FSCM_OFF ; config __FWDT 0x3F ; config __FWDT, WDTPSB_16 & WDTPSA_512 & WDT_OFF ; config __FBORPOR 0x87B3 ; config __FBORPOR, PWRT_64 & BORV20 & PBOR_ON & MCLR_EN ; config __FGS 0x7 ; config __FGS, GWRP_OFF & CODE_PROT_OFF ; config __FICD 0xC003 ; config __FICD, ICS_PGD #include <xc.h> ; ------------------------------------------------------------------------------ .global _Init_UART .global __reset .global _wreg_init .global PORT_init .GLOBAL __U2RXInterrupt .global __OC1Interrupt .global __T2Interrupt ; ----------------------------------------------------------------------------- .section .nbss, bss, near PotRP1: .space 2 ;.............................................................................. ;Code Section in Program Memory ;.............................................................................. .text ;Start of Code section __reset: MOV #__SP_init, W15 ;Initalize the Stack Pointer MOV #__SPLIM_init, W0 ;Initialize the Stack Pointer Limit Register MOV W0, SPLIM NOP call _wreg_init call PORT_init call _Init_UART RECEPTION: BRA RECEPTION PORT_init: BCLR TRISC,#RC14 BCLR TRISC,#RC13 return _Init_UART: mov #95, w0 mov w0, U2BRG BSET IPC6,#U2RXIP2 BCLR IPC6,#U2RXIP1 BCLR IPC6,#U2RXIP0 clr U2STA mov #0x8800, w0 ; mov w0, U2MODE BSET IEC1, #U2RXIE BSET U2STA,#UTXEN return ;.............................................................................. ;Subroutine: Initialization of W registers to 0x0000 ;.............................................................................. _wreg_init: CLR W0 MOV W0, W14 REPEAT #12 MOV W0, [++W14] CLR W14 RETURN __U2RXInterrupt: PUSH W10 clr w10 mov U2RXREG, W10 BCLR IFS1, #U2RXIF PUSH W10 retfie .end ;.............................................................................. ;Subroutine: portf Init ;..............................................................................
-----