E-3 Error in ASM Code: Label not found "33"

General discussion on mikroPascal for AVR.
Post Reply
Author
Message
mionut
Posts: 21
Joined: 19 Oct 2006 15:31
Location: Brasov, Romania
Contact:

E-3 Error in ASM Code: Label not found "33"

#1 Post by mionut » 26 Dec 2006 06:35

- E-3 Error in ASM Code: Label not found "33" -

Please, can anyone tell me what this error means?

Thank you,
Ionut Muntean
Ionut Muntean

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

#2 Post by milan » 26 Dec 2006 09:03

Hi,

Can you post the code that causes this error

mionut
Posts: 21
Joined: 19 Oct 2006 15:31
Location: Brasov, Romania
Contact:

#3 Post by mionut » 27 Dec 2006 10:57

Hi,

After changing some lines in the below code (inserting the pointer operation), I've got the error. Anyway, I'm not sure that this is the code that generates the error, because the message does not tell where in the code the error is. The asm file is not generated.

Code: Select all

function ReadTrack(var buffer: array [1..25 * BLK_LEN] of Byte): Boolean;
var Address: Longint;
    i: Word;
    p: ^Byte;
begin
  Result := false;
  if not DTSTest then Exit;
  if not DTSToAddress(Address) then Exit;
  i := 0;
  p := @buffer;
  while i <= 25 do
  begin
    Inc(i);
    p := p + ((i - 1 ) * BLK_LEN) + 1;
    {$IFDEF DEBUG}
     Wrt( 'Citire: ', Address + i - 1);
    {$ENDIF}
    if mmcRead(Address, p) <> 0 then
     begin
      {$IFDEF DEBUG}
       Wrt( 'Err:Citire ', Address + i - 1);
      {$ENDIF}
       Exit;
     end;
  end;
  TrackDirty := false;
  Result := true;
end;
Thank you,
Ionut Muntean

mionut
Posts: 21
Joined: 19 Oct 2006 15:31
Location: Brasov, Romania
Contact:

#4 Post by mionut » 27 Dec 2006 10:57

Hi,

After changing some lines in the below code (inserting the pointer operation), I've got the error. Anyway, I'm not sure that this is the code that generates the error, because the message does not tell where in the code the error is. The asm file is not generated.

Code: Select all

function ReadTrack(var buffer: array [1..25 * BLK_LEN] of Byte): Boolean;
var Address: Longint;
    i: Word;
    p: ^Byte;
begin
  Result := false;
  if not DTSTest then Exit;
  if not DTSToAddress(Address) then Exit;
  i := 0;
  p := @buffer;
  while i <= 25 do
  begin
    Inc(i);
    p := p + ((i - 1 ) * BLK_LEN) + 1;
    {$IFDEF DEBUG}
     Wrt( 'Citire: ', Address + i - 1);
    {$ENDIF}
    if mmcRead(Address, p) <> 0 then
     begin
      {$IFDEF DEBUG}
       Wrt( 'Err:Citire ', Address + i - 1);
      {$ENDIF}
       Exit;
     end;
  end;
  TrackDirty := false;
  Result := true;
end;
Thank you,
Ionut Muntean

rayhall
Posts: 58
Joined: 20 Oct 2006 08:00
Location: Cairns, Australia

#5 Post by rayhall » 19 Jan 2007 08:19

I am getting the same error with this code. I am still having no luck trying to find a way to do division without getting the wrong result or getting an error message.

Code: Select all

program Test_div;
var
  data: Real;
  Txt: string[6];
  
procedure showData;
begin
    data := data / 3.0;
    FloatToStr(data,Txt);
    Glcd_Write_Text(Txt,1,1,1);
end;

begin
  Glcd_Init(PORTD, 2, 3, 4, 5, 7, 6, PORTA);
  Glcd_Set_Font(font5x7,5,8,32);
  
  while true do
  begin
    data:= 1.234;
    ShowData;
  end;
end.

Targa
Posts: 13
Joined: 14 Jan 2007 02:06
Location: Germany
Contact:

#6 Post by Targa » 19 Jan 2007 20:34

To rayhall:
The problem in your code is FloatToStr(data,Txt);
in Help nothing stands over it, except mikroPascal for AVR Help - Simple Types - real under construction!

Real is 32–bit, thus FloatToStr(input: real; var output: array[0..23] of char);

rayhall
Posts: 58
Joined: 20 Oct 2006 08:00
Location: Cairns, Australia

#7 Post by rayhall » 19 Jan 2007 22:20

Targa,

If you look at this announcement it states that in version 4.0.0.0 these were implemented. To me implemented means added ?

http://www.mikroe.com/forum/viewtopic.php?t=7154
- Implemented floating point
- Implemented real math and trigonometry

Targa
Posts: 13
Joined: 14 Jan 2007 02:06
Location: Germany
Contact:

#8 Post by Targa » 19 Jan 2007 23:02

To rayhall:

- Implemented floating point
- Implemented real math and trigonometry

Yes, that is correct also and functions.
For example:
data : Real;
data := 1.5;
etc.

But, procedure FloatToStr(input: real; var output: array[0..23] of char); does not seem to function.

rayhall
Posts: 58
Joined: 20 Oct 2006 08:00
Location: Cairns, Australia

#9 Post by rayhall » 20 Jan 2007 01:07

So can someone from MikroElektronika fix the FloatToStr function and the other division bug reported. Not been able to do a basic thing like division makes the compiler almost useless to me. So much I want I want to do involves division.

Thank You..

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#10 Post by zristic » 22 Jan 2007 12:32

Here are the basics which will enable you to work further:

Code: Select all

program test;
var
  data: Real;
  Txt: string[30];
  
procedure LongIntToStr2(input: LongInt; var output: array[12] of char);
var len, neg : byte;
    data : longint;
begin
  output := '         ';

  neg:=0;
  if input < 0 then
    begin
     neg:=1;
     output[0]:='-';
     input:=0-input;
    end;

  len  := neg;
  data := input;
  while data <> 0 do
    begin
      data := data div 10;
      inc(len);
    end;

  while len > neg do
    begin
      data := input mod 10;
      input := input div 10;
      output[len-1]:= 48 + data;
      Dec(Len);
    end;
  output[11]:=0;
end;


procedure FloatToStr2(input: real; var output: array[23] of char);
var
  tmpli: longint;
  tmpr : real;
  i, j : word;
  ch   : byte;
  pref,
  suff : array[12] of char;
  neg: byte;
begin
  neg := false;

  tmpli := input;
  if (input < 0) then
    if (tmpli = 0) then
    begin
     neg := true;
    end;

  LongintToStr2(tmpli, pref);
  tmpr := tmpli;
  tmpr := input - tmpr;
  tmpli := tmpr*100000.;  // take last five significant digits
  if tmpli<0 then tmpli:=-tmpli;
  LongintToStr2(tmpli, suff);

  i := 0;
  j := 0;
  if neg then
    begin
      output[0]:='-';
      i:=1;
    end;

  ch := pref[0];
  while ch = 32 do
    begin
      inc(j);
      ch := pref[j];
    end;

  while ch <> 0 do
    begin
      if ch = 32 then
        break;
      output[i] := ch;
      inc(j);
      inc(i);
      ch := pref[j];
    end;

  output[i] := '.';
  inc(i);

  j := 0;
  ch := suff[0];
  while ch <> 0 do
    begin
      if ch = 32 then
        ch := 48;
      output[i] := ch;
      inc(j);
      inc(i);
      ch := suff[j];
    end;

  output[i] := 0;
end;

procedure showData;
begin
    data := data / 3.0;
    FloatToStr2(data,Txt);
    Glcd_Write_Text(Txt,1,1,1);
end;

begin
  //Glcd_Init(PORTD, 2, 3, 4, 5, 7, 6, PORTA);
  Glcd_Init(PORTE, 2, 3, 4, 5, 7, 6, PORTA); // bigavr board (atmega 128)
  Glcd_Set_Font(font5x7,5,8,32);

  while true do
  begin
    data:= 1.234;
    ShowData;
  end;
end.

Targa
Posts: 13
Joined: 14 Jan 2007 02:06
Location: Germany
Contact:

#11 Post by Targa » 22 Jan 2007 22:08

Testing:
procedure LongIntToStr2(input: LongInt; var output: array[12] of char);

Code: Select all

//...
  while true do
  begin
    data:= 1.234;
    FloatToStr2(data,Txt);
    Glcd_Write_Text(Txt,1,1,1);
    
    data1:= 2147483647;
    LongIntToStr2(data1,Txt1);
    Glcd_Write_Text(Txt1,1,2,1);
    data1:= -2147483647;
    LongIntToStr2(data1,Txt1);
    Glcd_Write_Text(Txt1,1,3,1);
    data1:= -214748364;
    LongIntToStr2(data1,Txt1);
    Glcd_Write_Text(Txt1,1,4,1);
  end;
//...
GLCD:
1.233990000 - wrong (real)
21474836477 - wrong (longint)
-2147483647 - right (longint)
-2147483647 - wrong (longint)

Changes in LongIntToStr2:

procedure LongIntToStr2(input: LongInt; var output: array[11] of char);

Code: Select all

        // 12345678901
output := '           ';


Then the test was successful (LongIntToStr2).

procedure FloatToStr2(input: real; var output: array[23] of char);

Code: Select all

//...
while true do
  begin
    data:= 1.2358;
    FloatToStr2(data,Txt);
    Glcd_Write_Text(Txt,1,1,1);
    delay_ms(2000);
    data:= 1.2356;
    FloatToStr2(data,Txt);
    Glcd_Write_Text(Txt,1,1,1);
    delay_ms(2000);
    
    data1:= 2147483647;
    LongIntToStr2(data1,Txt1);
    Glcd_Write_Text(Txt1,1,2,1);
    data1:= -2147483647;
    LongIntToStr2(data1,Txt1);
    Glcd_Write_Text(Txt1,1,3,1);
    data1:= -214748364;
    LongIntToStr2(data1,Txt1);
    Glcd_Write_Text(Txt1,1,4,1);
  end;
//...
E-4 Error in ASM code: Address is out of range "33"
E-4 Error because of delay_ms(2000);
Test failed (FloatToStr2).

ColaCola
Posts: 2
Joined: 21 May 2008 10:47

#12 Post by ColaCola » 21 May 2008 11:08

Hi there,

I am probably just as bad as Rayhall as i can't do division. Least i will have a bit more luck now have the basics to fix the FloatToStr function and other bugs.
:)

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#13 Post by zristic » 21 May 2008 11:40

ColaCola, you have been kindly asked to remove the advertisements from your signatures. If you are not considering this seriously, I will have to officially let you know that you are breaking the forum rules.

Now only a official warning has been issued for you.

Thanks for understanding.

Post Reply

Return to “mikroPascal for AVR General”