Question about virtual terminal.

Discussion on both general simulation and Proteus VSM microcontroller simulation.
Post Reply
picchiedi
Professional User
Posts: 142
Joined: Thu 2014-12-25 9:32

Question about virtual terminal.

Post by picchiedi »

Hello.

My aim is to simulate with Proteus what I get on real circuit, when I use Hyperterminal to send a sequence (i.e. 123<CR>)with the send button, not sending one character at a time (see enclosed image).

I noticed that when I use Proteus virtual terminal, as soon as I type 1, it is transmitted.
Instead I would like to type 123 and then trasmit, like I do with the send button in Hyperteminal.

Is it possible ?

My ultimate aim is to understand how the USART of the PIC reacts and if there's a sort of buffer and how it works.

Thanks for any kind suggestion.

Regards
Send a sequence with hyperterminal using send button.JPG
Send a sequence with hyperterminal using send button.JPG (115.48 KiB) Viewed 2889 times
chimimic
Expert User
Posts: 508
Joined: Tue 2006-04-11 13:31
Location: France
Contact:

Re: Question about virtual terminal.

Post by chimimic »

Hi,

you can use at least 3 methods :

[1] add an additionnal (little) MCU sending data frame at specified time or (better) when triggered by a Proteus switch
[2] use a COMPIM Proteus component to catch frame data coming from external terminal emulator (need 2 com ports)
[3] use a digital script (scriptable HDL), but I believe this can only send predifined data at specified time (only used this manner).

I regulary used these 3 methods :
[1] and [3] with success at bautdrate less or equal to 250k,
[2] at a max of 56k (enough for basic tests).

Example with HDL digital script :

Code: Select all

// SERIAL DATA GENERATOR

// 1 - ASCII data to be output
DATA "Hello World ", 250m
DATA "- EASYHDL Test Program - First line\r", 500m

DATA "Hello World ", 250m

DATA "- EASYHDL Test Program - Second line\r", 500m

DATA REPEAT

// 2 - Define the baud rate
FLOAT BAUD=9600
FLOAT BITTIME=1.0/BAUD

// 3 - Declare working variables
STRING s
INT i,j,d
TIME td

// 4 - Top level
OUT = 1
SLEEP FOR 5m

// 5 - Read DATA line

LOOP:
  READ s,td
  GOSUB OUTSTRING
  SLEEP FOR td
GOTO LOOP

// 6 - Output an ASCII string in S char
OUTSTRING:
  FOR i=1 TO LEN(s)
    d = ASC(SUBSTR(s,i))
    GOSUB OUTCHAR
  NEXT I
RETURN

// 7 - Send a single character, one by one
// 1 Start bit, 1 Stop bit, no parity
OUTCHAR:
  // Start bit
  OUT = 0
  SLEEP FOR BITTIME
  // Data bits
  FOR j=0 TO 7
   OUT = d & (1 << j)
   SLEEP FOR BITTIME
  NEXT j
  // Stop bit
  OUT = 1
  SLEEP FOR BITTIME
RETURN
Regards,
Remy
picchiedi
Professional User
Posts: 142
Joined: Thu 2014-12-25 9:32

Re: Question about virtual terminal.

Post by picchiedi »

Thank you very much, Remy, for your kind suggestions.

I'll try these functionalities.

Regards.
Ianr
3rd Party Developer
Posts: 120
Joined: Fri 2007-03-09 14:03

Re: Question about virtual terminal.

Post by Ianr »

I also use terminal programs just like you.

On GIThub you will find Com0Com a very nice program that allows you to create a virtual pair of com ports.. Then configure the compII part in Proteus to one of the pairs, and your terminal ( shown ) to the other.... Then use that terminal program on Proteus from a separate window...

I use Lazarus to create external signal that I can inject the same way.... com0com is free..
picchiedi
Professional User
Posts: 142
Joined: Thu 2014-12-25 9:32

Re: Question about virtual terminal.

Post by picchiedi »

Thank you, Ianr.

That's nice too!

I'll try.

Regards
Post Reply