Using serial interfaces

Connecting a terminal

You can easily connect a terminal to the serial interface of the simulated microcontroller. This terminal is just a file so it can be anything which is represented as a file. It can be a real serial line of the computer:
$ s51 -s/dev/ttyS1
Of course you must use the actual device name of your operating system. Device name ttyS1 above is used in Linux systems. Your system can use other names.

You can use a terminal of your system. It can be a virtual console if your system provides such as Linux does for example. On X Windows you can use xterm windows as terminals, one for running the simulator and one as a terminal on CPU's serial line. Here is a sample how to do this:

  1. Prepare the terminal window which will be connected to the serial line:

  2. Run the simulator in the other window:
    $ s51 -s/dev/ttyp1 program.hex
    
    Use the output of the tty command above as the parameter of the -s option.
Every character sent out by the simulated program appears in the "terminal" window and every charater you type in there will be received by the simulated controller's serial line.

Connecting two instances of simulator

Executing two instances of the simulator, serial lines of two simulators (micros) can be connected together so they can talk to each other over their serial interface. It is because you can specify separate files for serial input and output. For example you run two simulators "1" and "2", here is the sample how to connect them:

  1. Make two FIFOs to represent physical wires in serial cable connecting two micros:
    $ mkfifo 1-2 2-1 # 1-2: 1->2  and 2-1: 2->1
    
  2. Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versioi>Start two simulators and specify the FIFOs as inrint out versio