Hola,
Estoy haciendo un proyecto que necesita dos puertos series y necesito utilizar el 2do puerto del PIC 18F46J50 (tiene 2 EUSART) en el Data Sheet pone que
están Multiplexado, he ido al apto donde hablan de los puertos y leyendo tengohe entendido que se puede mapear, pero es la primera vez que hago
y no se como funciona.
Aquí os dejo mi código que de momento no funciona. Haber que puedo hacer..
Necesito vuestra ayuda, Muchas gracias..
DataSheet PIC 18F46J50'---------------Código...
Device = 18F46J50 'Selecciono pic
Declare Xtal 12 ' XTAL a 12Mhz
Config_Start 'Fuses
WDTEN = OFF ;Disabled - Controlled by SWDTEN bit
PLLDIV = 3 ;Divide by 3 (12 MHz oscillator input)
STVREN = On ;Enabled
XINST = OFF ;Enabled Extended intruction disable
Debug = OFF ;Disabled
CPUDIV = OSC1
CP0 = OFF ;Program memory is not code-protected
OSC = HS 'HSPLL ;HS+PLL, USB-HS+PLL
T1DIG = On ;Secondary Oscillator clock source may be selected
LPT1OSC = OFF ;High-power operation
FCMEN = OFF ;Disabled fail-safe clock monitor
IESO = On ;Enabled 'two-speed start-up
Config_End
All_Digital = TRUE ' Set PORTA to all digital
Dim Var1 As Byte
'Mapeo los puertos
RPINR16= 4 'Pongo RB1 para RX2
RPOR3 = 5 'Pongo RB0 para TX2
'Declarations EUSART2
Declare Hserial2_Baud = 9600
Declare Hserial2_RCSTA = %10010000
Declare Hserial2_TXSTA = %00100100
Declare Hserial2_SPBRG = 77
Declare Hserial2_Clear = On
Loop:
HSerIn2 1000, Timeout, [Var1]
Print Dec Var1, " "
GoTo Loop ' Loop forever
Timeout:
Cls
Print "Tiempo Error"
DelayMS 500
Stop
End