Expansion Board
The following is an expansion prototype board to add to the TMS9995 micro board using two TMS9901 programmable CRU chips. On RHS is the ribbon cable going to the main board. 4 sets of 10 IDC pins are I/O ports of Port A and Port B with high and low bytes for each. The diagram below is the schematic for the board.
Please note again that J1 is not a standard IDC connector. i.e Pins 1 to 20 are on one side (LHS) and pins 40 to 21 are on RHS (in picture above). Also note that J2-J5 use standard IDC connection of pins (odd and even numbers on opposite sides).
I also used IDC pin headers to wire-wrap connections from top of the board (see pins either side of chips and additional pins that are connected to J1-J5.) It makes it easier to see things .Doing wiring from the bottom, makes everything reversed and flipped.
To look at datasheets for TMS9901 follow this link.
Circuit below is schematic for the expansion board (using diptrace software).
Note that U1 has physical address of 0040H for Port A and U2 has address of 0080H for port B.
Here is update I made a pcb for this schematic..
Testing Expansion Board
Once connected and powered up the combined current (expansion and cpu board) could be as high as 400ma, since the two 9901 chips can use up to 60ma in standby and even more if driving an output.
Board can be tested using Cortex Basic command of BASE, CRB(x) or CRF(x) commands. Picture below shows CRU map for 9901 chip from its base address.
1. Output on a Port
Following is a sample code to test all 16 bits of the 9901 based at physical address of 0040H.
10 REM TO OUTPUT ON 9901 PORT BITS 0-15
20 REM BLINK AT ABOUT 1 SEC FOR 20 SECONDS
25 REM SETUP BASE ADDRESS OF 9901 to 96 decimal
30 BASE 96
40 FOR I= 1 TO 20
45 REM SET HIGH OR ON
50 CRF(0) = -1
55 REM 1 SEC DELAY
60 FOR J=1 TO 2000 STEP 1:NEXT J
65 REM SET LOW OR OFF
70 CRF(0) = 0
75 REM 1 SEC DELAY
80 FOR J=1 TO 2000 STEP 1:NEXT J
90 NEXT I
100 STOP
Note to use the CRF() command the base address becomes BASE(physical) +32 -- >64+32 = 96. Then command CRF(0) puts out on all 16 bits. If you need the lower byte only then CRF(8) will do the job.
If you want to output individual bits on a port then use CRB() command. To reference individual bits set the BASE to physical address (0040H) and then select bits e.g CRB(16) selects bit 0 and CRB(31) selects bit15. Similar sample Basic program is shown below.
10 REM TO OUTPUT ON 9901 PORT BIT 0
20 REM BLINK AT ABOUT 1 SEC FOR 20 SECONDS
25 REM SETUP BASE ADDRESS OF 9901 to 64 decimal
30 BASE 64
40 FOR I= 1 TO 20
45 REM SET HIGH OR ON
50 CRB(16) = 1
55 REM 1 SEC DELAY
60 FOR J=1 TO 2000 STEP 1:NEXT J
65 REM SET LOW OR OFF
70 CRB(16) = 0
75 REM 1 SEC DELAY
80 FOR J=1 TO 2000 STEP 1:NEXT J
90 NEXT I
100 STOP
2. Input on a port
Following is a sample code to test digital input on Port bit0 of the 9901 based at physical address of 0040H.
10 REM TO INPUT ON 9901 PORT BIT 0
20 REM SAMPLE EVERY 1 SEC FOR 10 SECONDS
25 REM SETUP BASE ADDRESS OF 9901 to 96 decimal
30 BASE 64
40 FOR I= 1 TO 10
45 REM READ PORT BIT 0
50 VAL= CRB[16]
55 PRINT VAL
60 REM SAMPLE APPROX EVERY 1 SEC
70 FOR J=1 TO 2000 STEP 1:NEXT J
90 NEXT I
100 STOP
You can use something like this for an input. Resistor could be few K's in value pulled to ground.
Upload the above code to the microcomputer via terminal program.. the numbers after the listing show program running with switch being closed and open and value returned for each action .. 1 for +5v and 0 for 0V.
Run shows output of PortA bit0 every second for 10 seconds, with switch in OFF then ON then OFF again.