Skip to content

Board XH M194

Thomas edited this page May 2, 2020 · 11 revisions

"XH-M194 5-way Timer Relay Control Module"

The board is advertised as "5-way" although it has 6 relay channels, and there is no obvious reason why it shouldn't be called a "6-way Relay" module. It's also not a "Value Line Gadget" since it's powered by an Access Line device (16-32K Flash, 2K RAM).

The XH-M194 board has the following characteristics:

  • STM8S105S4T6, SWIM interface on 4 pin header (pins unpopulated)
  • 5.0V internal supply voltage
  • DS1302 RTC

Unfortunately the design of the board is unimaginative: I2C pins are N/C, the UART wasted for clocking the LED shit register, the SSC for controlling LEDs and the analog inputs used for keys (both could have been multiplexed). As many as 5 GPIOs are were left N/C and not a single one of them was made available on a pin header. It's clear to see that at now extra cost the XH M194 board could have been a RS485 node, a RF connected device, a development board... but as it is now it's just an overpowered clock with relays.

XH-M194 Forth Support

The following features are supported:

  • Half-duplex serial console pin PD1/SWIM
  • LED display (serial console has priority over colon dots)
  • DS1302 clock (register and RAM access), time decoding
  • 6 relays and 6 green LEDs controlled by OUT!
  • 6 keys mapped through BKEY and ?KEYB

There are no analog or digital inputs - the hardware has to be modified to obtain some (e.g. remove green LEDs and re-purpose GPIOs).

DS1302 RTC

The board support code provides basic register access. Please refer to XH-M192/board.fs.

Digital Outputs

The word OUT! puts a binary pattern to the outputs. The outputs are assigned as follows:

OUT bit value Relay OUT bit value Green LED
0x01 relay 1 0x0100 LED 1
0x02 relay 2 0x0200 LED 2
0x04 relay 3 0x0400 LED 3
0x08 relay 4 0x0800 LED 4
0x10 relay 5 0x1000 LED 5
0x20 relay 6 0x2000 LED 6

Character I/O

The 6 keys are mapped as follows:

Key ?KEYB BKEY
"R" "A" (0x41) 0x01
"L" "B" (0x42) 0x02
">" "D" (0x44) 0x04
"v" "H" (0x48) 0x08
"^" "P" (0x56) 0x10
"<" "`" (0x96) 0x20

Pressing multiple keys leads to an ASCII code corresponding to the value of the bit-field (e.g. "R" and ">" result in the code 0x45 (ASCII "E").

A decimal point after the 2nd digit controls the colon dots:

: test ." AB.CD" ;
' test BG !

After a 30s "blackout period" this will be rendered on the LED display as Ab:Cd.

Serial Console

The board support provides half-duplex console access through PD1/SWIM on the ICP header. Please note that PD1 also controls the 7S-LED colon segment. Up to 30 seconds after a serial transmissions, the LED display is blanked to improve robustness of the communication.

The half-duplex interface is designed to work with e4thcom, or with the example Picocom configuration for half-duplex communication described here.

The following sketch shows how to connect a serial interface adapter using the SWIMCOM method:

................  
   XH-M194     .
               .      .----o serial TxD "TTL"
       ( )     .      |      e.g. "PL2302 USB serial converter"
               .     ---
               .     / \  1N4148 
VCC ------<1>  .     ---  
               .      |
PD1/SWIM--<2>--.------*----o serial RxD "TTL"
               .
NRST------<3>  .
               .
GND-------[4]--.-----------o serial GND
               .     
ICP header     . 

Hardware Description

The STM8S105S4 pins are connected as follows:

Pin STM	Connected to
-------------------------------------
 1  NRST
 2  PA1        LED green R3 
 3  PA2        LED green R4
 4  VSSIO_1    I/O ground
 5  VSS        digital ground
 6  VCAP
 7  VDD        digital power supply
 8  VDDIO_1    I/O power supply
 9  PA4        LED green R5
10  PA5        LED green R6
11  PA6        DS1302 pin 7 SCLK
12  VDDA       analog power supply
13  VSSA       analog ground
14  PB7/AIN7   DS1302 pin 6 I/O
15  PB6/AIN6   DS1302 pin 5 CE
16  PB5/AIN5   key <
17  PB4/AIN4   key ^
18  PB3/AIN3   key v
19  PB2/AIN2   key >
20  PB1/AIN1   key L (leftmost)
21  PB0/AIN0   key R (rightmost)
22  PE6/AIN9   n/c
23  PE5        LED green R2
24  PC1        LED green R1
25  PC2        LED red R6
26  PC3        LED red R5 
27  PC5        LED red R3
28  VSSIO_2    I/O ground
29  VDDIO_2    I/O power supply
30  PC6        LED red R2
31  PC7        LED red R1
32  PG0        LED red R4
33  PG1        n/c
34  PE2        n/c (I2C_SDA)
35  PE1        n/c (I2C_SCL)
36  PE0        n/c
37  PD0        7S-digit4 (rightmost)
38  PD1        SWIM 7S-COLON
39  PD2        7S-digit3
40  PD3        7S-digit2
41  PD4        7S-digit1 (leftmost)
42  PD5        74HC595-14-DS   s-in UART2_RX
43  PD6        74HC595-11-SHCP sclk UART2_TX
44  PD7        74HC595-12-STCP pclk TLI

74HC595

Symbol  Pin  Description
-------------------------------------
Q1       1   7S-B
Q2       2   7S-C
Q3       3   7S-D
Q4       4   7S-E
Q5       5   7S-F
Q6       6   7S-G
Q7       7   n/c
GND      8   ground (0 V)
Q7S      9   serial data output
MR      10   (VCC) master reset (active LOW)
SHCP    11   43 pull-up / shift register clock input
STCP    12   44 pull-up / storage register clock input
OE      13   GND / output enable input (active LOW)
DS      14   42 pull-up / serial data input
Q0      15   7S-A
VCC     16   supply voltage

DS1302 Trickle-Charge Timekeeping Chip

Symbol  Pin  Description
-------------------------------------
VCC2     1
X1       2   xtal out
X2       3   xtal in
GND      4
CE       5 * 15 PB6 / chip enable
I/O      6 * 14 PB7 / serial in/out
SCLK     7 * 11 PA6 / clock in
VCC1     8   (rechargeable) battery 

7S-LED Clock Display

The display on the board examined resembles closely the one in the following picture:

However, there doesn't appear to be a real standard for 12pin clock display: there are variants with colon dots multiplexed with digit1, digit2, and digit3+digit4, and only rarely some DP segments are provided (14pin clock displays provide DP segments and non-multiplexed colon dots).

The board support code exports CFGDOTS as a configuration point for the multiplex type.

XH-194 design review

Refer to issue #128.