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
Upgrade from MikroPascal for 8051 2.2 to 3.5 issues
-
- Posts: 4
- Joined: 18 Oct 2013 20:30
- marina.petrovic
- Posts: 2986
- Joined: 18 Apr 2013 08:11
Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues
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
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
-
- Posts: 4
- Joined: 18 Oct 2013 20:30
Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues
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
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
- marina.petrovic
- Posts: 2986
- Joined: 18 Apr 2013 08:11
Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues
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
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
-
- Posts: 4
- Joined: 18 Oct 2013 20:30
Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues
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;
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;
- marina.petrovic
- Posts: 2986
- Joined: 18 Apr 2013 08:11
Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues
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
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
-
- Posts: 4
- Joined: 18 Oct 2013 20:30
Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues
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
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
- marina.petrovic
- Posts: 2986
- Joined: 18 Apr 2013 08:11
Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues
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
Thank you very much for pointing on the error.
It will certainly help to solve the problem as soon as possible.
Best regards,
Marina
Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues
Hi Marina,
Any news?
Any news?
- marina.petrovic
- Posts: 2986
- Joined: 18 Apr 2013 08:11
Re: Upgrade from MikroPascal for 8051 2.2 to 3.5 issues
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
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