Shop OBEX P1 Docs P2 Docs Learn Events
VT100 terminal plugin for the GEAR emulator — Parallax Forums

VT100 terminal plugin for the GEAR emulator

Marc GebauerMarc Gebauer Posts: 60
edited 2008-10-17 15:46 in Propeller 1
I have been getting familiar with the Gear Emulator; very nice. I wanted to know if anyone has made a VT00 terminal plugin for Gear. It seems that this would be a much faster way of displaying text rather than sending text to the vgamonitor or television plugin. If one does not already exsist, I am interested in giving it a try. But... I don't know where to start. I have written assembly language serial rx and tx routines, and they work so I'd say I have a fair knowledge of asynchronous serial. I have some knowledge of C, have not played with C#, and I have not written anything with a GUI except in VB. So far I have been trying to add a text label or textbox to my plugin but no luck.

10/07/08 - Uploaded Terminal.xml.

The serial UART reciever works reliably up to 230400 BAUD, maybe faster with a non-standard baudrate.
The serial UART transmitter works reliably up to 115200 BAUD and 160000 non-standard BUAD.
(tests were done with FullDuplexSerial driver)

The Terminal screen Word Wraps and Scrolls text and supports the following VT-100 control codes:
Carriage Return, Linefeed, Backspace, Tab,
Clear Screen, Clear Screen from cursor down, Clear Screen from cursor up,
Clear entire Line, Clear Line from cursor right, Clear Line from cursor left,
Home cursor, Move cursor to screen location (row, column).

The text entry box supports sending text and hex values. A hex value is sent by using the format $nn. For example $0d sends a carriage return. If you want to send a $ the use $$.

10/17/08 -·Gear's R & S action keys now blocked while using Terminal Text entry box. Thanks Mirror. Terminal.xml requires Gear V08_10_16 or later http://forums.parallax.com/showthread.php?p=701256

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


Post Edited (Marc Gebauer) : 10/17/2008 3:50:13 PM GMT

Comments

  • mirrormirror Posts: 322
    edited 2008-09-17 21:50
    I've wanted to do this as it would be very handy. Any time I spend on GEAR comes out of my "time-set-aside-for-donating" bucket, and it's been running low to empty.
    The existing plugins would give you an idea of how to write a terminal emulator. The VGA plugin shows how to get transitions and the time at which they occur, and the stimulus plugin shows how to generate signals at specific times.
    The VT100 plugin would then do bit-bash transmit and receive, displaying the results to an output window.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-09-17 22:42
    Mirror,

    Thanks for your input.

    I figured I would get what I needed from the vgamonitor and stimulus plugin·concerning the·exchanging pulses. I'm a little unsure how I would determine the bit period, coming from gear, for· instance 9600 baud. Is there a way to·determine what gear's clock is running at and scale·it from there?

    Also, I need a primer on how to output to a window and input from the keyboard. Do you have a suggestion on what I would google or any examples that relate to the plugin envirement? Just to be clear; the plugin is written in C#?



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • mirrormirror Posts: 322
    edited 2008-09-17 23:08
    Time is in seconds.
    So baud rate to seconds per bit conversion is simply an inverse.
    eg: BitPeriod = 1 / BaudRate;

    User interface stuff is a little painful. I used Microsoft Visual Studio to create a form, and then copied and modified the code into the stimulus plugin.

    I would suggest as a user interface that you *NOT* try and respond to key presses. Instead·make something like a·single line edit which shows the characters that are·due to be sent. Remember that everything happens *MUCH* slower than in real life. You could even get the single line edit to recognise sequences like '$0d$0a' for a linefeed, carriage return and $$ if you need a $ symbol. That way you have a simple mechanism for sending hexadecimal values.
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-09-17 23:28
    Thanks Mirror.

    I thing I have what I need. For now...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-09-19 18:24
    Just an update.

    I have started calling my plugin Terminal.xml. Currently my UART receiver is working up to 230400 baud from the spin test application using the fullduplexserial driver. Charcters are showing up in the window of the Terminal plugin. Yay!

    I am currently working on adding some·limted ansi screen control codes.

    Mirror -·do you know the best way to determine the·spin app's clkfreq (500000 ~ 80000000)·so it won't have to be manually edited in Terminal plugin?


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (Marc Gebauer) : 9/19/2008 6:32:37 PM GMT
  • mirrormirror Posts: 322
    edited 2008-09-19 21:55
    I'm looking forward to seeing the result of your work, it sounds like you're making great progress.

    To answer your question:
    As long as you have the following in your code:
      public override void PresentChip(Propeller host)
      {
        Chip = host;
        Chip.NotifyOnPins(this);
      }
    
    

    Then the frequency at which the Propeller is running is:
    Chip.CoreFrequency
    
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-09-20 15:34
    Mirror,
    Thanks. That worked!

    So currently the Terminal plugin receive·config options are·BAUD rate, receive pin, and invert receive.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (Marc Gebauer) : 9/20/2008 7:49:53 PM GMT
  • potatoheadpotatohead Posts: 10,261
    edited 2008-09-20 18:58
    This is damn cool.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!

    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
  • mirrormirror Posts: 322
    edited 2008-09-20 22:27
    I think that the receiver is the hard part!
    I'm sure you'll find the transmitter is a cakewalk once you get to it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-09-25 16:33
    Hello,

    I have been·away on a job·and sick, but I am back on the project. I have decided to upload Terminal.xml for your evaluation along with Serial_test.spin to show off what it can do. I have·implemented:·a serial receive UART that I have tested with fullduplexserial up to 230400 BAUD and a text·terminal with clear screen,·screen row/col addressing (works a little·unpredictably do to·the plugin's label control word wrap function), and screen scroll. All in all it seems to be pretty bullet proof.·Any suggestions as to how to·make screen row/col addressing reliable are welcome.

    Now on to serial·transmit - I have·been studying the stimulus.xml plugin and see that·it was originally slated to have serial transmit functionality.·Since·that makes alot of sense and alot of the structure I need is already there, I am going to·try and add·the functionality.

    ·***·Placed attachment·in·top post ***

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (Marc Gebauer) : 9/26/2008 3:27:02 AM GMT
  • SapiehaSapieha Posts: 2,964
    edited 2008-09-25 16:49
    Hi Marc Gebauer.

    Thanks Very Much

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • SapiehaSapieha Posts: 2,964
    edited 2008-09-25 19:32
    Hi Marc Gebauer.

    I have one question to You.
    You have learned Script on Gear.

    My question is... Can You write I2C emulator based on same Text file principle that in VT Terminal.
    In that File I wil place "00110101 110101010" and so on.
    In first Text Line I will place PIN pair (maybe I2C speed) and then in next line data to send.
    Blanks betwen data MARK not sending pause.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • mirrormirror Posts: 322
    edited 2008-09-25 21:17
    Marc Gebauer said...

    Now on to serial·transmit - I have·been studying the stimulus.xml plugin and see that·it was originally slated to have serial transmit functionality.·Since·that makes alot of sense and alot of the structure I need is already there, I am going to·try and add·the functionality.

    Stimulus was slated to have the serial transmit stuff, but I just haven't had the time to do it. Personally, I think it would be desirable to have·both variations:
    1) Transmit chars/strings using stimulus.xml.
    2) Allow VT100.xml (or whatever you called it) to do transmit as well as receive, for making interactive testing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • mirrormirror Posts: 322
    edited 2008-09-25 21:25
    Spieha,
    It would not be too difficult to write a convertor to get from I2C to the current stimulus file format.
    A problem not covered in you theoretical implmentation is start condition and stop condition generation, and more importantly ack states for each of the bytes sent.
    The stimulus file format is flexible enough to allow any incoming protocol to be simulated. It allows allows pins to be tristated.
    Treating the Propeller as an I2C slave device is probably not as useful as making some external plugins that are I2C compatable (for example an EEPROM plugin).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-09-25 21:27
    Sapieha,

    I intend on finishing this project then I'm not sure about the next one. Maybe if you told me more about what your trying to accomplish, I might get interested. Do you want to emulate a partiucular i2c device like an eeprom?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • SapiehaSapieha Posts: 2,964
    edited 2008-09-25 21:31
    Hi mirror.

    It was only basic idea.¨I have not detalied all.
    I know it must be more specified but if we hepls any other maybe it is posible.

    It was one idea to VT Terminal to. Have in first Text Line PINs to use on Serial comunication in that way pople must not edit Script file.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-09-25 21:32
    Mirror,

    OK, I'll concentrate on making Terminal.xml interactive.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • SapiehaSapieha Posts: 2,964
    edited 2008-09-25 21:34
    Hi Marc Gebauer.

    Most I/O ICs with not to many data from (type RTC, I/O expanders etc..)

    Ps.. I am sure that You have to Use of that posiblity. For tests it is only TEXT to PINs that is nesesary. It is mostly if one program wait for data from that device.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha

    Post Edited (Sapieha) : 9/25/2008 9:48:17 PM GMT
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-09-26 00:07
    Mirror,

    I have started the tx side of things and ran into a confict. Is there a way to block the r & s·keys from gear·while I am entering text into a textbox in·the Terminal plugin?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • mirrormirror Posts: 322
    edited 2008-09-26 00:41
    Marc Gebauer said...

    Mirror,

    I have started the tx side of things and ran into a confict. Is there a way to block the r & s·keys from gear·while I am entering text into a textbox in·the Terminal plugin?

    Hah, gotchya!!!

    Send me your almost working code - except for r and s keys, and I'll fix GEAR to allow those keys·for all plugins. Otherwise I've got to write my own test plugin . . .
    ·
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-09-26 03:11
    While I was working on the TX side of Terminal plugin I found a small mistake. rcvPin assignment was not passing value to the routine. So I fixed it and reuploaded Terminal_plugin.zip to top post in thread.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (Marc Gebauer) : 9/26/2008 3:31:13 AM GMT
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-10-08 02:59
    I have uploaded the complete Terminal plugin (see top post).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (Marc Gebauer) : 10/8/2008 2:41:41 PM GMT
  • SapiehaSapieha Posts: 2,964
    edited 2008-10-08 04:50
    Hi Marc Gebauer

    Fantastic.

    I have one question to You and Mirror.
    How much work with Gear it is to have Real Emulator.

    My think is....

    Have one DLL to conect to Pararell Port on PC and one Plugin in Gear.

    Thanks for Termonal plugin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-10-08 23:23
    Sapieha,

    Sorry but I can't help you I do not know about writing emulators and I was not involved in programming the Gear emulator.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • SapiehaSapieha Posts: 2,964
    edited 2008-10-09 00:07
    Hi Marc Gebauer.

    It was only mt think on that idea.
    Have any Parallel interface to Gear. Gear has with plugins has all mechanisms to it.
    I know that it is not You that write Gear.
    Only problem is to write Parallel interface DLL that can conect to Parallel port maybe Serial to.
    That construction give posiblites to test all on bredboard from Gerar without have propeller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-10-09 01:03
    Sounds like an interesting idea. I suppose a plugin could be written. I think it would have limited capabilities, do to restrictions on the parallel port. Also it may not be possible for a plugin to know direction of the Gear's prop port. I don't know the specification on a parallel port, but I imagine that it only allows for the data pins to be outputs or inputs and not a combination of both at the same time. I think that would eliminate it from being used as an i2c bus. Although I could not find a limitation on how slow an i2c bus can go. Also parallel ports are quickly disappearing from the landscape. I don't think any of my computers have a parallel port.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • SapiehaSapieha Posts: 2,964
    edited 2008-10-09 01:08
    Hi Marc Gebauer.

    Yes maybe limited but in EPP mode Parallel Potrt in PC is bidirectional + You have outgoing signasls on status port to.
    Modern Parallel ports have 3 modes and 2 of them is bidirectional.

    Ps Parallel port is often used as IC2 bus in many programing tools for micros type PIC and others.
    Parallel ports are also posible with USB to Parallel converters.
    FTDI has that chip USB to 2 Parallel else 1 + Serial else 2 serial in same chip and that chip has even posiblites to emulate BUS On Intel 8085 CPU else Motorola CPUs

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha

    Post Edited (Sapieha) : 10/9/2008 1:26:38 AM GMT
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2008-10-17 15:46
    Uploaded new Terminal.xml into top post. Requires Gear V08_10_16 or later.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sign In or Register to comment.