Debug-Idle during Uart1_Write and local vars dont appear in

Beta Testing discussion on mikroPascal PRO for AVR.
Post Reply
Author
Message
TurboProgger
Posts: 66
Joined: 04 Oct 2008 18:39
Location: Germany

Debug-Idle during Uart1_Write and local vars dont appear in

#1 Post by TurboProgger » 31 Aug 2010 17:01

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

User avatar
slavisa.zlatanovic
mikroElektronika team
Posts: 1321
Joined: 07 Apr 2009 09:39

Re: Debug-Idle during Uart1_Write and local vars dont appear

#2 Post by slavisa.zlatanovic » 16 Sep 2010 12:35

Hi!

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.
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 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.
watch.PNG
watch.PNG (16.63 KiB) Viewed 4074 times
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?
You can add local variables to the Watch window. Pay attention to the tmp variable in the picture above.
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

TurboProgger
Posts: 66
Joined: 04 Oct 2008 18:39
Location: Germany

Re: Debug-Idle during Uart1_Write and local vars dont appear

#3 Post by TurboProgger » 18 Sep 2010 14:41

Hi Slavisa!

Thank you very much for replying to my post and your detailed explanations.

Best regards

Post Reply

Return to “mikroPascal PRO for AVR Beta Testing”