Hi,
there are two things I want to mention:
1. while simulating a program with UART1_Write() / UART1_Write_Text() it idles on this line, because it waits for the UART to clear bit5 in UDRE (USART Data Register Empty). So no further simulation is possible. Can you ignore this state-bit in simulation? Perhaps by adding a checkmark for this in Compiler-Settings?
2. if I want to know the value of a variable while in debugging mode, "Add to watch list" will not work for local variables. They dont appear in Watch-Window. Is it possible to implement debugging support for local variables?
Regards
Debug-Idle during Uart1_Write and local vars dont appear in
-
- Posts: 66
- Joined: 04 Oct 2008 18:39
- Location: Germany
- slavisa.zlatanovic
- mikroElektronika team
- Posts: 1321
- Joined: 07 Apr 2009 09:39
Re: Debug-Idle during Uart1_Write and local vars dont appear
Hi!
Sorry for the late response!
I'll use this simple example for my explanation:
However, local variables are Inaccessible outside the procedures/functions in which they have been declared.
Also, optimizer sometimes eliminates some variables and then you can not add them to the Watch list because they don't really exist.
Sorry for the late response!
I'll use this simple example for my explanation:
Code: Select all
program UART;
var uart_rd : byte;
procedure ddd();
var tmp : byte;
begin
tmp := 1;
asm nop end;
uart_rd := tmp;
end;
begin
ddd(); // Add tmp to the Watch window
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
UART1_Write_Text('Init');
UART1_Write(13);UART1_Write(10);
while (TRUE) do // Endless loop
begin
if (UART1_Data_Ready() <> 0) then // If data is received,
begin
uart_rd := UART1_Read(); // read the received data,
UART1_Write(uart_rd); // and send data via UART
end;
end;
end.
You can add UDRE0_bit to the Watch window and change its value manually in order to proceed with the simulation. Just click it, write 1 and then hit ENTER.1. while simulating a program with UART1_Write() / UART1_Write_Text() it idles on this line, because it waits for the UART to clear bit5 in UDRE (USART Data Register Empty). So no further simulation is possible. Can you ignore this state-bit in simulation? Perhaps by adding a checkmark for this in Compiler-Settings?
You can add local variables to the Watch window. Pay attention to the tmp variable in the picture above.2. if I want to know the value of a variable while in debugging mode, "Add to watch list" will not work for local variables. They dont appear in Watch-Window. Is it possible to implement debugging support for local variables?
However, local variables are Inaccessible outside the procedures/functions in which they have been declared.
Also, optimizer sometimes eliminates some variables and then you can not add them to the Watch list because they don't really exist.
Best regards
Slavisa
Slavisa
-
- Posts: 66
- Joined: 04 Oct 2008 18:39
- Location: Germany
Re: Debug-Idle during Uart1_Write and local vars dont appear
Hi Slavisa!
Thank you very much for replying to my post and your detailed explanations.
Best regards
Thank you very much for replying to my post and your detailed explanations.
Best regards