TPS/SPS Assembler

The idea came to me in connection with the Arduino PLC. It's great to be able to change the program on the hardware. It works very well in the living room or at the desk. But I also use the PLC in my RC models and there I rarely have the opportunity, after installation, to get to the 3 keys. Let alone the patience to hack the codes. Everybody owns a smart cell phone by now. So, I figured out a way how to get my programs into the PLC by using a cell phone, some hardware and an internet service.

What you need:

  • a PLC with the latest firmware (> .10)
  • a smartphone with Internet and USB OTG connection
  • a USB OTG cable
  • an FTDI module ( USB-to-Serial conversion module )
  • and a piece of cable

he actual download of the program to the PLC is done via a serial protocol. This can even be done with a simple terminal program (or the built-in serial monitor in the ArduinoIDE). This new programming mode is entered, if after a reset of the PLC and the the SEL (and only this one ) button remains pressed. This protocol only knows 3 commands R (ead), W (rite) and E (xit). With Read the current program is output and with Write a new one is written in. The Format used is Intel HEX for both options. With Exit or a new Reset you leave this mode. To communicate using the mobile phone with the PLC, you also need a USB / serial converter. The most common ones are found under the name FTDI. This is a simple USBtoSerial converter that works with both - the PC and a mobile phone. Furthermore, the phone must support USB OTG. (Just google it to find out about your cellphone) In this way we have now a simple serial port on the phone. Now add a terminal program app onto the phone, job done. Finally, you have to convert your program idea into the IntelHEX format. This is achieved via this little service here on my website. Like any other assembler, this assembler translates the handwritten mnemonic code into a machine-readable program. Here to a program for the TPS / PLC.

The following features are supported:

  • Output formats: Intel HEX Code, PLC Emulator Source and HEX Text
  • Input Formats: TPS Assembler
  • Support of the following TPS systems: HOLTEK, ATmega8, Arduino PLC, ATtiny84 PLC
  • Automatic calculation of jumps and subroutine addresses
  • Support of labels for jumps
  • Support for comments
  • Macro support

You can find the online version here: Online TPS Assembler public BETA
The following mnemonics are supported:

Possible Program Size

Each hardware option has another max. Program size – based on the EEPROM area available.

  • HOLTEK: 128 bytes
  • ATmega8: 256 bytes
  • Arduino_TPS: 1024 bytes *
  • Tiny_TPS: 512 bytes *

* Everything over 256Byte Program Size can only be used by using subroutines (DFSB and CASB).

Uploading the Program Data

By using this Online SPSAssembler , you can enter and compile your source code. The output format is a simple text file with the corresponding representation for direct input into the TPS.
Alternatively, you can output the data as Intel HEX file. My Arduino_TPS and Tiny_TPS can receive both formats via the serial port. The following steps are necessary for this:

  • Create and download HEX file.
  • Connect mobile phone with FTDI (via a USB OTG cable).
  • Connect the FTDI to the serial interface of the hardware.
  • Start the terminal program on the mobile phone and connect to the FTDI. Speed is 9600 baud.
  • On the TPS, press Reset and SEL at the same time. You have to keep SEL pressed until the TPS announces itself in the terminal program.
  • Switch to the program send mode with “w” and check whether the TPS is in Programming Mode.
  • Then load the HEX file with the terminal program into the TPS.
  • Next a Reset or “E” and done.

Serial Connection

The ATTiny84 uses pins 11 (RX) and pin 12 (TX). A protocol with 9600 baud, 0 parity, 1 stop bit is used. The connection is made to the Tiny_TPS board via the input pin row.

Pin Signal FTDI
2 Din.2, TX RX
3 Din.3, RX TX
5 GND GND

(This translation was made by juergen pintaske, many thanks for your effort.)

en/arduino/arduinosps/tpsass.txt · Last modified: 2022/06/10 07:40 by admin
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0