This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

the problem read S0BUF to A ,use 89LPC952

when i use the 89LPC952 serial port 0,the below interrupt response program is work unnormal.
if ( S0BUF == '#'){
s0_input_flag = 1;
P2 |= 0x08;
S0_in_char_n = 0;
RI_0 = 0;
goto out1;
} but when i use the serial port 1,the reslut is ok 90FFB4 MOV DPTR,#0xFFB4 74D2 MOV A,#RTCH(0xD2) F0 MOVX @DPTR,A
when i debug the source find the S0BUF content not send to the A ,it is alway 0. E599 MOV A,S0BUF(0x99) B423FB CJNE A,#0x23,C:0030
sfr setting is
S0CON = 0x40;
BRGR0_0 = 0xD2;
BRGR1_0 = 0x04;
BRGCON_0 = 0x03;

S1CON = 0x50;
BRG0_1 = 0xD2;
BRG1_1 = 0x04;
BRGCON_1 = 0x03;

how can i get the S0BUF correctly?

Parents
  • Well, that's quite a foul mix of unformatted C and assembly you have there or can it legitimately be called either since you have english(ish) stuff intermingled? It might not be assembly, but rather some kind of assembly listing intermixed. Who can tell?

    So anyway, besides the "work unnormal" compared to the "reslut is ok" difference, are there any differences in the (questionably posted) serial port 0 code versus the unposted serial port 1 code?

Reply
  • Well, that's quite a foul mix of unformatted C and assembly you have there or can it legitimately be called either since you have english(ish) stuff intermingled? It might not be assembly, but rather some kind of assembly listing intermixed. Who can tell?

    So anyway, besides the "work unnormal" compared to the "reslut is ok" difference, are there any differences in the (questionably posted) serial port 0 code versus the unposted serial port 1 code?

Children