| ??? 08/08/08 23:43 Read: times |
#157340 - C and assembly in 89C52 |
Hi folks,
I have a struct as below:
struct Five_Bytes_struct {
unsigned char B0;
unsigned char B1;
unsigned char B2;
unsigned char B3;
unsigned char B4;
};
struct Five_Bytes_struct data Active_Value _at_ 0x25;
I use KeilC to write function below:
void Inc_Data()
{
Active_Value.B0 = Active_Value.B0+1;
}
Use adjust function to decimal adjust written in assembly :
_Adjust:
USING 0
MOV R1,AR7 //Want to get Active_Value.B0 ? Is this True?
MOV A,@R1
CJNE A, #32,Not_Eq1
SJMP Inc_Data
Not_Eq1:
JC END22
Inc_Data:
SUBB A,#32
MOV @R1,A
MOV R0, #0x01
INC R1
CLR C
MOV A,@R1
ADD A, R0
DA A
MOV @R1,A
......
I using this _Adjust function in C as header below:
void Adjust(char data *Pointer);
Call this in main function:
void main()
{
...
Adjust(&Active_Value.B0);
...
}
But in see it on the LCD screen, the value is not true.
Anyone can show me how can I do?
Thanks and best regards, Cuong, |
| Topic | Author | Date |
| C and assembly in 89C52 | 01/01/70 00:00 | |
| Check it in the simulator | 01/01/70 00:00 | |
| Check it in the assembler listing | 01/01/70 00:00 | |
Still wrong. | 01/01/70 00:00 |



