Upgrade from MikroPascal for 8051 2.2 to 3.5 issues

General discussion on mikroPascal PRO for 8051.
Post Reply
Author
Message
CARLOS RODRIGUES
Posts: 4
Joined: 18 Oct 2013 20:30

Upgrade from MikroPascal for 8051 2.2 to 3.5 issues

#1 Post by CARLOS RODRIGUES » 31 Oct 2013 00:57

Has anyone faced problems migrating from MikroPascal 2.2 to 3.5?
I have a part of my code that is very simple and it simply does not work in version 3.5.
It is related to the bit P3.7.

Code is like this: if P3_7 = 0 write "normal". if P3_7 = 1 write "reduced".

It always write "reduced" even when pin P3.7 is 0 when I compiled in 3.5 version.

When I compiled in version 2.2, everything works fine.

My code has other complicated parts that works fine in both versions, but this very simple part I couldn't realize what was happened.

I am using 89S8253

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues

#2 Post by marina.petrovic » 31 Oct 2013 11:54

Hi,

If I understand you properly, pin P3_7 is always equal to 1 in your project (mikroPascal PRO for 8051 v3.5.0)?

Did you tried your two codes/projects on same hardware?
If you can send me a simple code that demonstrate that behavior so I can try it on my system?

Best regards,
Marina

CARLOS RODRIGUES
Posts: 4
Joined: 18 Oct 2013 20:30

Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues

#3 Post by CARLOS RODRIGUES » 31 Oct 2013 20:44

Hi Marina,

Pin 3.7 is a digital input and I can see 0 and 1 with the multimeter.
The thing is that when I compile with the new version, microcontroller sees only 1's. Never 0.
Otherwise, when I compile with version 2.2, microcontroller sees when there is 0 or 1 in the pin 3.7.

Anotehr diferente thing that happens is:

I have a string variable declared like this:

var msgbuffer : string[16];

In the old version I wrote wrongly a line code with "msgbuffer := 0;" and the compiler accepted without any warning.
Now the new version generates na error and I have to write "msgbuffer := ' ';"

I am using the same computer. My OS is Windows 8.

I attached part of the code.

Thanks,

Carlos

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues

#4 Post by marina.petrovic » 01 Nov 2013 13:13

Hi,

If you set some pin to be digital input, you set that pin on high impedance
so you can't change the value of that pin in your code.
(only if you set that pin to be digital output).

Please, can you attach some small project that demonstrate the behavior that you describe?

Best regards,
Marina

CARLOS RODRIGUES
Posts: 4
Joined: 18 Oct 2013 20:30

Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues

#5 Post by CARLOS RODRIGUES » 01 Nov 2013 13:28

Hi,

I am trying to read pin 3.7. It is set as Digital Input. It reads always 1 even if is 0 on it.
Remember I am using the 89S8253.

Part of the code:

Program test;

{ Declarations section }

Var
.
.
var DADOS : byte at P0;
var AUTMAN : sbit at P1_6_bit;
var IndMA : sbit at P3_7_bit;
.
.
var msgbuffer : string[16];
.
.
const msgaut = 'AUTO ';
const msgman = 'MANUAL ';
const msgmag = ' NORMAL';
const msgmap = 'REDUZIDA';
.
.
{code section}
.
.
if (AUTMAN = 1) and (IndMA = 0) then msgbuffer := msgman + msgmag;
if (AUTMAN = 0) and (IndMA = 0) then msgbuffer := msgaut + msgmag;
if (AUTMAN = 1) and (IndMA = 1) then msgbuffer := msgman + msgmap;
if (AUTMAN = 0) and (IndMA = 1) then msgbuffer := msgaut + msgmap;
.
.
sndmsg();
.
.
procedure sndmsg();
var i : byte;
begin
for i:=0 to 16 do
begin
rsLCD := 1;
rwLCD := 0;
DADOS := msgbuffer;
delay_us(50);
habilLCD();
waitbusy();
end;
end;




procedure habilLCD();

begin
enLCD := 1;
delay_us(100);
enLCD := 0;
end;

procedure waitbusy();
var i : byte;
begin
i := 0;
DADOS := 0x00;
rsLCD := 0;
rwLCD := 1;
enLCD := 1;
delay_us(50);
enLCD := 0;
busy_flag := 1;
while (busy_flag) do
begin
i := i + 1;
if (i = 255) then break;
end;
end;

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues

#6 Post by marina.petrovic » 04 Nov 2013 16:53

Hi,

I manage to reproduce the behavior that you describe.
We will investigate that behavior a further more and try to find the source of the problem.

I am very sorry for the inconvenience.

Best regards,
Marina

CARLOS RODRIGUES
Posts: 4
Joined: 18 Oct 2013 20:30

Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues

#7 Post by CARLOS RODRIGUES » 04 Nov 2013 17:12

Hi Marina. Thanks for your efforts.

I made a test here and it seems to be the way the compiler understands the operand AND.

I wrote a little code to simulate the operand AND. It doesn't work when I compile with Version 3.5:
I used the board Easy8051.

program Testepin37;

{ Declarations section }

var AUTMAN : sbit at P1_6_bit;
var IndMA : sbit at P3_7_bit;
var comp : sbit at P0_0_bit;
var AUTMAN_OUT : sbit at P0_1_bit;
var IndMA_OUT : sbit at P0_2_bit;

begin
{ Main program }
P0 := 0x00;
while (TRUE) do
begin
if (AUTMAN=0) and (IndMA=0) then comp:=0;
if (AUTMAN=1) and (IndMA=0) then comp:=0;
if (AUTMAN=0) and (IndMA=1) then comp:=0;
if (AUTMAN=1) and (IndMA=1) then comp:=1;

AUTMAN_OUT := AUTMAN;
IndMA_OUT := IndMA;
end;

end.

On the other hand, if I substitute

if (AUTMAN=0) and (IndMA=0) then comp:=0;
if (AUTMAN=1) and (IndMA=0) then comp:=0;
if (AUTMAN=0) and (IndMA=1) then comp:=0;
if (AUTMAN=1) and (IndMA=1) then comp:=1;

for

comp:= AUTMAN and IndMA it works properly.

I hope it helps you to figure out what is happening. both codes work properly with MikroPascal version 2.2.

Carlos

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues

#8 Post by marina.petrovic » 05 Nov 2013 10:29

Hi,

Thank you very much for pointing on the error.
It will certainly help to solve the problem as soon as possible.

Best regards,
Marina

PIERETI
Posts: 3
Joined: 31 Jan 2014 21:15

Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues

#9 Post by PIERETI » 14 Feb 2014 09:48

Hi Marina,
Any news?

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues

#10 Post by marina.petrovic » 20 Feb 2014 16:57

Hi,

Solution for this behavior is already on our "to do" list, we will try to correct this for the next compiler release.
I am very sorry for the inconvenience.

Best regards,
Marina

Post Reply

Return to “mikroPascal PRO for 8051 General”