Hi,
I'm new to the MikroC AVR compiler. I have a problem with Soft_UART_Init. If I write Soft_UART_Init(&PORTE, 1, 0, 115200, 0) I get "Undeclared identifier PORTE in expression" is there an include I'm missing or something?
I have checked the checkbox next to the soft uart library. I'm using an Xmega part.
Thanks
Tim
Soft_UART_Init problem
- aleksa.jovanovic
- Posts: 526
- Joined: 30 Jun 2015 08:48
Re: Soft_UART_Init problem
Could you post your project in a zipped file?
Best regards,
Aleksa
Best regards,
Aleksa
Re: Soft_UART_Init problem
Hi Aleksa,
Unfortunately I can not post my project, the code is proprietary to my customer and I had to sign an NDA to consult on this project. The problem is simply that the compiler MikroC PRO AVR is choking on Soft_UART_Init(&PORTE, 1, 0, 115200, 0).
I get the error "undeclared identifier PORTE in expression"
I'm using the ATxmega128D chip. I have looked at the ATxmega128d.c file and can find no definition for PORTE (I'm assuming that's my problem). Does some kind of definition (code of some kind) need to be added to the ATxmega128d.c file for your built in functions for software uart to work on the xmega chip?
Thanks,
Tim
Unfortunately I can not post my project, the code is proprietary to my customer and I had to sign an NDA to consult on this project. The problem is simply that the compiler MikroC PRO AVR is choking on Soft_UART_Init(&PORTE, 1, 0, 115200, 0).
I get the error "undeclared identifier PORTE in expression"
I'm using the ATxmega128D chip. I have looked at the ATxmega128d.c file and can find no definition for PORTE (I'm assuming that's my problem). Does some kind of definition (code of some kind) need to be added to the ATxmega128d.c file for your built in functions for software uart to work on the xmega chip?
Thanks,
Tim
- aleksa.jovanovic
- Posts: 526
- Joined: 30 Jun 2015 08:48
Re: Soft_UART_Init problem
Could you write a small example demonstrating this event?
Best regards,
Aleksa
Best regards,
Aleksa
Re: Soft_UART_Init problem
OK. The hardware uart works fine. The compiler chokes on Soft_UART_Init(&PORTE, 1, 0, 115200, 0); with "undeclared identifier PORTE in expression".
I'm using the ATxmega128d3 chip.
I have the following libraries checked
C_math
C_type
EEPROM
PrintOut
SoftwareUART
TWI
UART
I'm using the ATxmega128d3 chip.
I have the following libraries checked
C_math
C_type
EEPROM
PrintOut
SoftwareUART
TWI
UART
Code: Select all
void setupClock();
void printHandler(char c);
void main()
{
setupClock();
UARTD0_Init(115200);
Soft_UART_Init(&PORTE, 1, 0, 115200, 0);
do
{
printOut(printHandler, "hello\r\n");
Soft_UART_Write('C');
Delay_ms(500);
}
while(1);
}
void setupClock()
{
OSC_CTRL = 0x02;
while(RC32MRDY_bit = 0);
CPU_CCP = 0xD8;
CLK_PSCTRL = 0;
CPU_CCP = 0xD8;
CLK_CTRL = 1;
DFLLRC32M_CTRL = 1;
}
void printHandler(char c)
{
UARTD0_Write(c);
}
- aleksa.jovanovic
- Posts: 526
- Joined: 30 Jun 2015 08:48
Re: Soft_UART_Init problem
Hi,
Please place the mlk file from the attachment to Mikroelektronika>mikroC PRO for AVR>Uses
It is modified so the init looks like this
Soft_UART_Init(&PORTD_IN, &PORTD_OUT, 2, 3, 14400,0);
So one is declared as input and the other as output
The baud rate should be 14400 because some issues arise from using another baud rate.
These modifications will be forwarded to our software department and implemented on the future upgrade.
Best regards,
Aleksa
Please place the mlk file from the attachment to Mikroelektronika>mikroC PRO for AVR>Uses
It is modified so the init looks like this
Soft_UART_Init(&PORTD_IN, &PORTD_OUT, 2, 3, 14400,0);
So one is declared as input and the other as output
The baud rate should be 14400 because some issues arise from using another baud rate.
These modifications will be forwarded to our software department and implemented on the future upgrade.
Best regards,
Aleksa
- Attachments
-
- SOFT UART.rar
- (89.96 KiB) Downloaded 178 times
Re: Soft_UART_Init problem
Aleksa,
I'll give it a try. Is 14400 the highest baud rate, even with no interrupts enabled in the rest of my code and the processor core clock running at 32MHz?
Thanks,
Tim
I'll give it a try. Is 14400 the highest baud rate, even with no interrupts enabled in the rest of my code and the processor core clock running at 32MHz?
Thanks,
Tim
- aleksa.jovanovic
- Posts: 526
- Joined: 30 Jun 2015 08:48
Re: Soft_UART_Init problem
You can try to go higher, but I've gone up until it started working correctly.
Best regards,
Aleksa
Best regards,
Aleksa