ITP
Advanced Member level 4
- Joined
- Jul 11, 2001
- Messages
- 116
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 1,298
- Activity points
- 1,136
Hi All,
I am facing a strange problem with k*e*i*l. For an "if" statement in C it
generates an unconditional jump (LJMP)instruction. But when I put a dummy
statement [ while(!STOP_KEY_PORT)] it works.
Below I have shown a segment of my C*51 program and its corresponding k*e*i*l
output.
The declaration for two bit variable used are as follows
sbit STOP_KEY_PORT = P1^5;
sbit velocity_in = P2^3;
------------------------START-----------------------
// original C code
{
P1=0x0f0;
velocity_in = 1;
while(!velocity_in)
{
if(!STOP_KEY_PORT) goto abort;
}
while(velocity_in)
{
if(!STOP_KEY_PORT) goto abort;
}
}
K*e*i*l output:
758: P1=0x0f0;
C:0x0CA8 7590F0 MOV P1(0x90),#adc_data(0xF0)
759: velocity_in = 1;
760:
C:0x0CAB D2B4 SETB velocity_in(0xB0.4)
761: while(!velocity_in)
C:0x0CAD 20B403 JB velocity_in(0xB0.4),C:0CB3
762: {
763: if(!STOP_KEY_PORT) goto abort;
C:0x0CB0 020D80 LJMP C:0D80
764: }
765: while(velocity_in)
C:0x0CB3 30B403 JNB velocity_in(0xB0.4),C:0CB9
766: {
767: if(!STOP_KEY_PORT) goto abort;
C:0x0CB6 020D80 LJMP C:0D80
768: }
769: }
----------------------------END-------------------------------
---------------------------START------------------------------
//C Code after the introduction of statement [ while(!STOP_KEY_PORT)]
{
P1=0x0f0;
velocity_in = 1;
while(!STOP_KEY_PORT); // <-- newly introduced line
while(!velocity_in)
{
if(!STOP_KEY_PORT) goto abort;
}
while(velocity_in)
{
if(!STOP_KEY_PORT) goto abort;
}
}
K*e*i*l output:
758: P1=0x0f0;
C:0x0B0B 7590F0 MOV P1(0x90),#adc_data(0xF0)
759: velocity_in = 1;
C:0x0B0E D2B4 SETB velocity_in(0xB0.4)
760: while(!STOP_KEY_PORT);
C:0x0B10 3095FD JNB STOP_KEY_PORT(0x90.5),C:0B10
761: while(!velocity_in)
C:0x0B13 20B406 JB velocity_in(0xB0.4),C:0B1C
762: {
763: if(!STOP_KEY_PORT) goto abort;
C:0x0B16 2095FA JB STOP_KEY_PORT(0x90.5),C:0B13
C:0x0B19 020BF2 LJMP C:0BF2
764: }
765: while(velocity_in)
C:0x0B1C 30B406 JNB velocity_in(0xB0.4),C:0B25
766: {
767: if(!STOP_KEY_PORT) goto abort;
C:0x0B1F 2095FA JB STOP_KEY_PORT(0x90.5),C:0B1C
C:0x0B22 020BF2 LJMP C:0BF2
768: }
769: }
---------------------------END----------------------------
Kindly help me to understand this problem.
Thanks for your time.
Itp.
I am facing a strange problem with k*e*i*l. For an "if" statement in C it
generates an unconditional jump (LJMP)instruction. But when I put a dummy
statement [ while(!STOP_KEY_PORT)] it works.
Below I have shown a segment of my C*51 program and its corresponding k*e*i*l
output.
The declaration for two bit variable used are as follows
sbit STOP_KEY_PORT = P1^5;
sbit velocity_in = P2^3;
------------------------START-----------------------
// original C code
{
P1=0x0f0;
velocity_in = 1;
while(!velocity_in)
{
if(!STOP_KEY_PORT) goto abort;
}
while(velocity_in)
{
if(!STOP_KEY_PORT) goto abort;
}
}
K*e*i*l output:
758: P1=0x0f0;
C:0x0CA8 7590F0 MOV P1(0x90),#adc_data(0xF0)
759: velocity_in = 1;
760:
C:0x0CAB D2B4 SETB velocity_in(0xB0.4)
761: while(!velocity_in)
C:0x0CAD 20B403 JB velocity_in(0xB0.4),C:0CB3
762: {
763: if(!STOP_KEY_PORT) goto abort;
C:0x0CB0 020D80 LJMP C:0D80
764: }
765: while(velocity_in)
C:0x0CB3 30B403 JNB velocity_in(0xB0.4),C:0CB9
766: {
767: if(!STOP_KEY_PORT) goto abort;
C:0x0CB6 020D80 LJMP C:0D80
768: }
769: }
----------------------------END-------------------------------
---------------------------START------------------------------
//C Code after the introduction of statement [ while(!STOP_KEY_PORT)]
{
P1=0x0f0;
velocity_in = 1;
while(!STOP_KEY_PORT); // <-- newly introduced line
while(!velocity_in)
{
if(!STOP_KEY_PORT) goto abort;
}
while(velocity_in)
{
if(!STOP_KEY_PORT) goto abort;
}
}
K*e*i*l output:
758: P1=0x0f0;
C:0x0B0B 7590F0 MOV P1(0x90),#adc_data(0xF0)
759: velocity_in = 1;
C:0x0B0E D2B4 SETB velocity_in(0xB0.4)
760: while(!STOP_KEY_PORT);
C:0x0B10 3095FD JNB STOP_KEY_PORT(0x90.5),C:0B10
761: while(!velocity_in)
C:0x0B13 20B406 JB velocity_in(0xB0.4),C:0B1C
762: {
763: if(!STOP_KEY_PORT) goto abort;
C:0x0B16 2095FA JB STOP_KEY_PORT(0x90.5),C:0B13
C:0x0B19 020BF2 LJMP C:0BF2
764: }
765: while(velocity_in)
C:0x0B1C 30B406 JNB velocity_in(0xB0.4),C:0B25
766: {
767: if(!STOP_KEY_PORT) goto abort;
C:0x0B1F 2095FA JB STOP_KEY_PORT(0x90.5),C:0B1C
C:0x0B22 020BF2 LJMP C:0BF2
768: }
769: }
---------------------------END----------------------------
Kindly help me to understand this problem.
Thanks for your time.
Itp.