UART_Remappable_Init
-
- Posts: 35
- Joined: 08 Feb 2007 11:25
UART_Remappable_Init
Hi.
UART_Remappable_Init(19200)
The compile reports an error "223 304 Syntax error: Expected ")" but "19200" found"
Any surgestions please
UART_Remappable_Init(19200)
The compile reports an error "223 304 Syntax error: Expected ")" but "19200" found"
Any surgestions please
Re: UART_Remappable_Init
Hello.
I think
Could you please show us the code ?
Thanks.
I think
is your own function or... where did you get it ? That's no MikroBasic function.UART_Remappable_Init(19200)
Could you please show us the code ?
Thanks.
-
- Posts: 35
- Joined: 08 Feb 2007 11:25
Re: UART_Remappable_Init
Hi Max
This is a built in UART Remappable Libraryfor the PIC 18F45J11
Library Routines
UART_Remappable_Init
UART_Remappable_Data_Ready
UART_Remappable_Tx_Idle
UART_Remappable_Read
UART_Remappable_Read_Text
UART_Remappable_Write
UART_Remappable_Write_Text
This is a built in UART Remappable Libraryfor the PIC 18F45J11
Library Routines
UART_Remappable_Init
UART_Remappable_Data_Ready
UART_Remappable_Tx_Idle
UART_Remappable_Read
UART_Remappable_Read_Text
UART_Remappable_Write
UART_Remappable_Write_Text
-
- Posts: 337
- Joined: 17 Apr 2008 02:53
- Location: Fantasy Land
Re: UART_Remappable_Init
What happens if you comment out that line? Does it still give an error or does it compile ok?
-
- Posts: 35
- Joined: 08 Feb 2007 11:25
Re: UART_Remappable_Init
Yes if you delete the value in the Brackets, 19200 is does compile but has no Output on the Uart2
Re: UART_Remappable_Init
Hello.
I think it's a compiler bug
This code works. But you cannot set the needed speed !!
I think it's a compiler bug
Code: Select all
Unlock_IOLOCK
PPS_Mapping(15, _INPUT, _RX2_DT2) ' Sets pin 15 to be Input, and maps RX2/DT2 Input to it
PPS_Mapping(5, _OUTPUT, _TX2_CK2) ' Sets pin 5 to be Output, and maps EUSART2 Asynchronous Transmit/Synchronous
Lock_IOLOCK
UART_Remappable_Init()
-
- Posts: 35
- Joined: 08 Feb 2007 11:25
Re: UART_Remappable_Init
Thanks for the reply..
Would you know how to set the speed to 19200 or 9600.. Have you tried it on a chip.. I get no output...
Would you know how to set the speed to 19200 or 9600.. Have you tried it on a chip.. I get no output...
Re: UART_Remappable_Init
Hi Richard
Yesterday and today we discovered 2 bugs in the compiler in the Forum
would you be so kind to report this to mE support
at this link
http://www.mikroe.com/en/support/
as it helps to get the bugs fixed
Please
Best regards
Peter
Yesterday and today we discovered 2 bugs in the compiler in the Forum
would you be so kind to report this to mE support
at this link
http://www.mikroe.com/en/support/
as it helps to get the bugs fixed
Please
Best regards
Peter
P.Erasmus
Saratov,Russia
--------------------------------------------------------------
Saratov,Russia
--------------------------------------------------------------
- tihomir.losic
- mikroElektronika team
- Posts: 2138
- Joined: 02 Dec 2009 14:16
- Location: Serbia
- Contact:
Re: UART_Remappable_Init
Hello,RichardHirst wrote:Would you know how to set the speed to 19200 or 9600.. Have you tried it on a chip.. I get no output...
please, use this way of workaround:
for the same PIC (PIC18F45J11):
1) replace
Code: Select all
UART_Remappable_Init
Code: Select all
UART1_Init(19200)
3) Start debugger (F9)
4) Run Dis-assembly mode (ALT + D)
5) Copy the first three lines of this piece of code:
Code: Select all
;UART.mbas,35 :: UART1_Init(19200) ' Initialize UART module at 9600 bps
0x00D4 0x0E19 MOVLW 25
0x00D6 0x6EB0 MOVWF SPBRG
0x00D8 0x84AD BSF TXSTA, 2, 0
0x00DA 0xDFB9 RCALL _UART1_Init
Code: Select all
asm
MOVLW 25
MOVWF SPBRG
BSF TXSTA, 2, 0
end asm
UART_Remappable_Init()
The SPBRGHx:SPBRGx register pair controls the period of a free-running timer. In Asynchronous mode, bits, BRGH (TXSTAx<2>) and BRG16 (BAUDCONx<3>), also control the baud rate. In Synchronous mode, BRGH is ignored.
Please, look at: BAUD RATES FOR ASYNCHRONOUS MODES
I hope it will help to you.
Best regards,
Losic Tihomir
mikroElektronika [Support team]
-
- Posts: 35
- Joined: 08 Feb 2007 11:25
Re: UART_Remappable_Init
Hi Losic
Thanks for the work around.. I still have no Uart2 output.
Unlock_IOLOCK()
PPS_Mapping(4, _INPUT, _RX2_DT2) ' Sets pin RP4 RB1 to be Input, and maps RX2/DT2 Input to it
PPS_Mapping(8, _OUTPUT, _TX2_CK2) ' Sets pin RP8 RB5 to be Output, and maps EUSART2 Asynchronous Output to it
Lock_IOLOCK()
asm
MOVLW 25
MOVWF SPBRG
BSF TXSTA, 2, 0
end asm
UART_Remappable_Init()
then call; UART_Remappable_Write(65)
have I missed something..?
Richard
Thanks for the work around.. I still have no Uart2 output.
Unlock_IOLOCK()
PPS_Mapping(4, _INPUT, _RX2_DT2) ' Sets pin RP4 RB1 to be Input, and maps RX2/DT2 Input to it
PPS_Mapping(8, _OUTPUT, _TX2_CK2) ' Sets pin RP8 RB5 to be Output, and maps EUSART2 Asynchronous Output to it
Lock_IOLOCK()
asm
MOVLW 25
MOVWF SPBRG
BSF TXSTA, 2, 0
end asm
UART_Remappable_Init()
then call; UART_Remappable_Write(65)
have I missed something..?
Richard
- tihomir.losic
- mikroElektronika team
- Posts: 2138
- Joined: 02 Dec 2009 14:16
- Location: Serbia
- Contact:
Re: UART_Remappable_Init
Hello Richard,
please, create your support ticket:
http://www.mikroe.com/en/support
and send me your complete project in order to inspect it.
Thanks.
Best regards,
Losic Tihomir
please, create your support ticket:
http://www.mikroe.com/en/support
and send me your complete project in order to inspect it.
Thanks.
Best regards,
Losic Tihomir
mikroElektronika [Support team]
Re: UART_Remappable_Init
Hi,
I had some problems with this too.
But I solved using:
asm{ //config 9600 bps at USART 2
MOVLW 129
MOVWF SPBRG2
BSF TXSTA2, 2, 0
}
UART_Remappable_Init();
The value "129" I got with the workaround. But it's important to set SPBRG2 and TXSTA2, to use the second USART.
Regards
I had some problems with this too.
But I solved using:
asm{ //config 9600 bps at USART 2
MOVLW 129
MOVWF SPBRG2
BSF TXSTA2, 2, 0
}
UART_Remappable_Init();
The value "129" I got with the workaround. But it's important to set SPBRG2 and TXSTA2, to use the second USART.
Regards
-
- Posts: 4
- Joined: 05 Nov 2013 12:37
Re: UART_Remappable_Init
thank you, very helpful..worked =Dtihomir.losic wrote:Hello,RichardHirst wrote:Would you know how to set the speed to 19200 or 9600.. Have you tried it on a chip.. I get no output...
please, use this way of workaround:
for the same PIC (PIC18F45J11):
1) replacewithCode: Select all
UART_Remappable_Init
2) compile your project in release mode.Code: Select all
UART1_Init(19200)
3) Start debugger (F9)
4) Run Dis-assembly mode (ALT + D)
5) Copy the first three lines of this piece of code:
6) Now get back onto first task of this workaround and type following:Code: Select all
;UART.mbas,35 :: UART1_Init(19200) ' Initialize UART module at 9600 bps 0x00D4 0x0E19 MOVLW 25 0x00D6 0x6EB0 MOVWF SPBRG 0x00D8 0x84AD BSF TXSTA, 2, 0 0x00DA 0xDFB9 RCALL _UART1_Init
Baud Rate Generator (BRG) - The BRG is a dedicated, 8-bit or 16-bit generator that supports both the Asynchronous and Synchronous modes of the EUSART.Code: Select all
asm MOVLW 25 MOVWF SPBRG BSF TXSTA, 2, 0 end asm UART_Remappable_Init()
The SPBRGHx:SPBRGx register pair controls the period of a free-running timer. In Asynchronous mode, bits, BRGH (TXSTAx<2>) and BRG16 (BAUDCONx<3>), also control the baud rate. In Synchronous mode, BRGH is ignored.
Please, look at: BAUD RATES FOR ASYNCHRONOUS MODES
I hope it will help to you.
Best regards,
Losic Tihomir