Simulating PIC and Serial Port Communication in Proteus

Status
Not open for further replies.

Ali.B

Newbie level 4
Joined
Apr 27, 2013
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,321
I'm using Proteus to simulate a simple communication between PIC16F877A and a Serial Port.

I Installed VSPE, I created 2 Virtual Ports COM2 and COM3, I picked "pair" in VSPE so that COM2 and COM3 are connected together.

In Proteus I added the PIC and the COMPIM, I edited the properties of COMPIM so that it works as COM2, all other properties I kept them the same (Baud,etc..).

I added a Virtual Terminal to read the incoming and outgoing data.



I created a small application in C#, when I try to send some data to COM3, the data shows perfectly on the Virtual Terminal connected to COM2.

But when I send bytes from the PIC to COM2 (In Proteus), the Virtual Terminal displays weird characters (Mostly "?"), and in C# I get weird Numbers.



The PIC code is the following:

Code:
Device=16F877A
XTAL=4

HSERIAL_RCSTA=$90
HSERIAL_TXSTA=$24
HSERIAL_SPBRG=25 ' 9600 Bauds
HSERIAL_CLEAR=On
Output PORTB
PORTB = 10
MainLoop:

HSerOut [PORTB]
DelayMS 5000

GoTo MainLoop
End

I'm simply trying to send number 10, what am I missing here?
 

Zip and post your project files and Proteus file. Maybe baudrate is not matching or data is inverted. Remove COMPIM and just connect Tx pin of MCU to RXD pin of Virtual Terminal and see if it displays characters properly. If not, then problem is in code or baudrate or invert.
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…