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?