Multisim and Ultiboard

cancel
Showing results for 
Search instead for 
Did you mean: 

8051 SCON problem

Solved!
Go to solution

The following program can not achieved correct results. I find the problem with oscilloscope that "the TXD pin of 8051 can not produce clock for output",actually, it should provide clock for outside, after "MOV SCON, #10H".

Is it a bug of multisim?

 

     ORG 0000H
     AJMP START
     ORG 0100H
START:CLR P1.0
     MOV SCON, #10H
     SETB P1.0
     JNB RI, $
     MOV A, SBUF
     MOV P2,A

     SJMP START
END

0 Kudos
Message 1 of 6
(6,856 Views)

Hi zhouyufei,

 

Thank you for your post. I was wondering if you could send me the schematic and  the whole assembly code of this circuit. From the assembly code you given, it seems that the setting is receiving data. For serial communication in 8051, check the interrapt Clearence: CLR RI  when needed in this situation.

 

Another thing is when simulating the circuit, try setting the initial conditions to 0 in the Interactive Simulation Settings==>Initial conditions:==>Set to zero

This might  help when you connect an external oscilator to the MCU.

 

Capture.PNG

 

Hope it helps,

Chen_T
National Instruments
0 Kudos
Message 2 of 6
(6,692 Views)

Thanks very much for your reply.

the multisim files are attached. It receive data from a 8-BIT SHIFT REGISTER (8-Bit input and 1-Bit output), and send the data to P2, shown by LED. But from CH1 of oscillograph, we see no shift clock from TXD. So the 8051 can not receive data correctly. I donot know why.

Can you give me advice?

 

Yours Yufei zhou

0 Kudos
Message 3 of 6
(6,659 Views)
Solution
Accepted by topic author zhouyufei

Hi Yufei,

 

Thank you for your schematic. I've found the problems and I've fixed them, the first one is the way you use the 74HC165N .

datasheet.PNG

According to the datasheet(attached at last), CP is the clock signal(CLK), PL(Low enable) is to load the data(SH/~LD), CE(Low enable) is to enable the clock(INH). On your schematic, you did not enable the clock, that's why you do not have the output at the QH end.

 

To fix it, pull down the logic level at the INH(Pin 15) when you want to send signals.

timing diagram.PNG

 

The second problem is the clock signal at TXD. In real serial communication, it should be exist. But here in Mulsitim,we've already build it inside the simulation. We do not need to care about it now, just like we do not need to add external oscilator between the XTAL1 and XTAL2 ends of the MCU. But, here we need to add the Clock using the function generator at the 74HC165N.

 

disp.PNG

 

8051.PNG

 

Run the simulation again, set the 8-bit information and pull down the INH to send it. You then can see it displayed.:-)

 

Attached are the modified file and the datasheet for 74HC165N.

 

Hope it helps!:-)

Chen_T
National Instruments
Download All
0 Kudos
Message 4 of 6
(6,639 Views)

Thank you very much! Mr Chen. The problem is solved. You are warmhearted and professional. I will consult you when have trouble. I like Multisim very much. Hope the software can be successful. 🙂

0 Kudos
Message 5 of 6
(6,627 Views)

I have a similar design but I am using 4021BP_5V instead 74165. How can I synchronize the data between 4021BP_5v and 8052 if there is no output from TXD. I have same problem like zhouyufei. I already tested my design in real serial communication and it is working fine. I would like to do more serial design using Multisim. Maybe in next multisim you can add this TXD function. 

0 Kudos
Message 6 of 6
(5,164 Views)