home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / STEN / STEN08.MSA / NEWS.TXT / DIGIJUN1.ASC < prev    next >
Text File  |  2010-04-21  |  16KB  |  333 lines

  1.  
  2.                              DIGITAL JUNCTION
  3.                              ----------------
  4.  
  5.                    The right connections are made here.
  6.  
  7.     In this column I intend to show you how to interface the ST to various
  8. devices  and projects via the cartridge or MIDI ports. This will introduce
  9. you  to  an area of computing that you may find as interesting if not more
  10. so  than  playing  games or word processing etc and will perhaps encourage
  11. you to carry out your own interfacing experiments.
  12.  
  13.     Starting  with  details  of  the cartridge and MIDI ports I shall move
  14. onto  some  simple  interfacing  experiments  using  LEDs  (Light Emitting
  15. Diodes),  switches  and relays etc. I will then cover more advanced topics
  16. such  as ADC (Analogue to Digital Conversion) and DAC (Digital to Analogue
  17. Conversion)  along with some useful projects. After that? Well, we'll have
  18. to  see  -   Maybe  a  computer  controlled weather monitor or some simple
  19. robotics  such  as  a  computer  controlled  buggy  -  I  make no promises
  20. however.
  21.  
  22. The Cartridge Port
  23. ------------------
  24.     Unlike earlier micros such as the C64 or Spectrum the ST does not have
  25. a  general  purpose  interface or bus extension to allow easy expansion or
  26. interfacing  of users own projects. The nearest the ST has to offer is the
  27. cartridge  port  which  was intended for alternatives or extensions to TOS
  28. but  has been used for many other purposes, the most common probably being
  29. sound samplers or real time clocks for example.
  30.  
  31.     Although not as flexible as a purpose built interface or bus extension
  32. the  cartridge  port is quite capable of being used as an interfacing port
  33. thus  enabling  various devices and projects to be connected to the ST. It
  34. is  even  possible  to  adapt  and connect projects that were intended for
  35. other micros.
  36.  
  37.     There  are  16  data  lines  (D0-15),  15 address lines (A1-15), 2 ROM
  38. enable lines (ROM3 & ROM4), 1 Upper data strobe (UDS), 1 Lower data strobe
  39. (LDS), 2 +5V lines and 3 ground lines available at the cartridge port. You
  40. may  have noticed the A0 line is missing, this is due to the fact that the
  41. 68000   CPU  (Central  Processing  Unit)  can  only  address  even  memory
  42. locations.  However,  the  lower data strobe can be used to provide the A0
  43. line if needed (This will be covered later).
  44.  
  45.                           Cartridge port pin-out
  46.  
  47.         1  3  5  7  9  11 13 15 17 19 21 23 25 27 29 31 33 35 37 39
  48.      ----------------------------------------------------------------
  49.      |  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  |
  50.      |  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  |
  51.      |                                                              |
  52.      ----------------------------------------------------------------
  53.         2  4  6  8  10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40
  54.  
  55.                1 = +5V DC               21 = A8
  56.                2 = +5V DC               22 = A14
  57.                3 = D14                  23 = A7
  58.                4 = D15                  24 = A9
  59.                5 = D12                  25 = A6
  60.                6 = D13                  26 = A10
  61.                7 = D10                  27 = A5
  62.                8 = D11                  28 = A12
  63.                9 = D8                   29 = A11
  64.               10 = D9                   30 = A4
  65.               11 = D6                   31 = ROM 3 SELECT
  66.               12 = D7                   32 = A3
  67.               13 = D4                   33 = ROM 4 SELECT
  68.               14 = D5                   34 = A2
  69.               15 = D2                   35 = UPPER DATA STROBE
  70.               16 = D3                   36 = A1
  71.               17 = D0                   37 = LOWER DATA STROBE
  72.               18 = D1                   38 = GROUND
  73.               19 = A13                  39 = GROUND
  74.               20 = A15                  40 = GROUND
  75.  
  76.     As the port was designed for use with ROMs (Read Only Memory) there is
  77. no  read/write  line  provided  so  any  attempt to write to the port will
  78. result  in  a  bus error. Even if a read/write line was brought out to the
  79. port an error would still occur as the GLUE chip knows that this is a read
  80. only port and objects to any attempt at writing to it. However, all is not
  81. lost,  a programming trick known as address offsetting is used to write to
  82. the  port.  This places the data to be written on the address lines rather
  83. than the data lines and is then latched into the interfacing circuits when
  84. needed.
  85.  
  86.     Due  to  Atari  using  a  non-standard  pitch  for  the cartridge port
  87. connector it is rather difficult to find a suitable plug to fit it. I have
  88. not  been  able to find a supplier and if anybody knows of one please tell
  89. me.
  90.  
  91.     I have overcome the problem by installing my own connector in parallel
  92. with  the  cartridge  port. Simply, this involved soldering two lengths of
  93. 20-way  ribbon cable at the points where the cartridge port connector pins
  94. enter  the  ST's  main PCB (printed circuit board). I was unable to find a
  95. space to install my connector into the case so I brought the ribbon cables
  96. out  from  under the cartridge port and soldered a 37-way D type connector
  97. to  the ribbons making sure to leave enough length to allow a cartridge to
  98. be installed without fouling on them.
  99.  
  100.     This does mean that I now have a cable and D connector hanging out the
  101. left  hand  side of my ST but its no problem to me. After all it does mean
  102. that  I  am  able  to  connect any projects or experiments using cheap and
  103. readily available connectors.
  104.  
  105.     A couple of points should be noted.
  106.  
  107.     (1)  Carrying  out  this  type  of  modification  would invalidate any
  108. warranty   that may cover your ST.
  109.  
  110.     (2)  You  would  not  be  able  to  use  any  cartridges  while having
  111. interfaces     connected  to  the  additional  connector and vice versa of
  112. course.
  113.  
  114.     If  anyone  would  like further details of my modification then please
  115. send  a SAE and I shall return full details and diagrams. If enough people
  116. are interested then I may include the details in this column.
  117.  
  118.     For  those  that  would rather not hack their ST about, after all it's
  119. only  nutters  like  me  that  would even think of such a thing, but would
  120. still  like  to  interface projects or circuits via the cartridge port, do
  121. not fear, there is a far less drastic alternative. It is in the form of an
  122. interface  which  slots into the cartridge port providing a fully buffered
  123. 16-bit wide input, a latched 16 bit wide output and some control lines for
  124. advanced  applications. The interface also overcomes the non standard edge
  125. connector  problem  by  providing  a board interface which allows 0.1 inch
  126. pitch  double  sided edge connectors to be plugged in. There are a variety
  127. of  cheap  readily  available  edge connectors that can be used, Locost PC
  128. edge connector 2x25 with closed ends or 50-way IDC socket for ribbon cable
  129. for example.
  130.  
  131.     The  interface,  costing  about  25  pounds  well over a year ago, was
  132. designed,  built  and  supplied  by Mr. W.M.Kennerley (see 'Suppliers' for
  133. address).  I  have  recently been in contact with Mr. Kennerley and he has
  134. informed  me  that  he  is  still able to supply the interfaces. Those who
  135. would  like  one  should contact him for details of price and delivery. If
  136. writing to him please don't forget to enclose a SAE.
  137.  
  138.     I do feel that anyone really interested in interfacing should consider
  139. purchasing one of these units, after all, for less than the cost of a full
  140. priced  game  or  serious  software you are getting a really useful bit of
  141. kit.  As  mentioned earlier it saves any hacking of the ST plus the system
  142. busses  are  protected  by  the on-board buffers thus saving you having to
  143. include  them  in your own designs and Mr. Kennerley has provided the full
  144. sixteen  bit  wide  input  and  output  which  makes  the unit very useful
  145. indeed.
  146.  
  147.     I  shall  be  supporting  this  interface  with  software and projects
  148. throughout  this  series and will do like wise for those that would rather
  149. connect directly to the cartridge port.
  150.  
  151. The MIDI ports
  152. --------------
  153.  
  154.     If, like myself, you are not into music or don't own any MIDI (Musical
  155. Instrument  Digital  Interface)  equipment  then  ST's  MIDI sockets would
  156. appear  to  be  of  little  use to you. This, however, is not so. The MIDI
  157. ports  work  in  the  same  way  as any other serial port. The serial data
  158. format  used  on  the MIDI ports has the same specification as the RS-232C
  159. protocol  used  on  the serial or modem port except that the MIDI transfer
  160. rate  is fixed at 31.25KBaud. When data is sent or received it starts with
  161. a  'start  bit'  which is always a 0 then follows the eight data bits (one
  162. byte)  starting  with  the LSB (least significant bit) and finishes with a
  163. 'stop  bit'  which  is  always a 1. From this it can be seen that the MIDI
  164. ports  could  be  used  for  general  serial  communications.  There  is a
  165. multi-player  game,  MIDI  MAZE,  that  allows  up  to 16 STs to be linked
  166. together as a network and play against each other through the MIDI ports.
  167.  
  168.     Programming  the  ports  to send or receive data is catered for in the
  169. BIOS  routines  bconout,  bconin and bconstat. GFA BASIC v3 accesses these
  170. routines with the following commands:-
  171.  
  172.     bconout  =       ~BIOS(3,3,b%)    where b% = data byte to send
  173.     bconin   =       r% = BIOS(2,3)   where r% = data byte read from port
  174.     bconstat =       r% = BIOS(1,3)   Interrogates input buffer
  175.                                       r% = 0 if no byte available
  176.                                       r% = -1 if a byte is ready
  177.  
  178.     In  order  for  this  port  to  be  of use to us for interfacing, some
  179. circuits  capable  of serial to parallel and parallel to serial conversion
  180. will  be  needed.  This  is  fairly  easy  to  do  using a UART (Universal
  181. Asynchronous  Receiver/Transmitter)  but  there is a less expensive way of
  182. accomplishing  this  by using some standard CMOS ICs. I have come across a
  183. project  first  published  by  M.  Breuer in the April 91 issue of Elektor
  184. Electronics magazine that does exactly this by turning the MIDI ports into
  185. an 8-bit in/out interface.
  186.  
  187.     This  interface  cannot pass data as fast as the cartridge port nor is
  188. it  as  flexible  in  use  but it is perfectly capable of most interfacing
  189. tasks  and  is  an  ideal  project  for inclusion in this series. Like the
  190. cartridge  port,  I  shall  be  supporting  this  interface throughout the
  191. series.
  192.  
  193.     I chose the MIDI interface project as an alternative for the following
  194. reasons:-
  195.  
  196.     (1)  It  puts to use the MIDI ports that would have otherwise remained
  197. idle (at least in the case of those that don't have MIDI equipment)
  198.  
  199.     (2)  An  opto  isolator  has been included on the interface board MIDI
  200. input  which  complements  the  isolator  already built into the ST's MIDI
  201. input. This has the very desirable effect of protecting the ST from damage
  202. due  to  any  mishaps  that  may  occur  with  projects  attached  to  the
  203. interface.
  204.  
  205.     (3)  You can still carry out interfacing but still have your favourite
  206. cartridge plugged in plus it is fairly simple to program.
  207.  
  208.     The  interface  has  been  designed  to be built on a double sided PCB
  209. which is available from Elektor Electronics readers services but this will
  210. cost  £13.34  including VAT and P&P. It is possible to build the interface
  211. on  a piece of stripboard (Veroboard) costing about £1.35. I have designed
  212. a  stripboard layout for the project which I hope to have built and tested
  213. in time for the next article.
  214.  
  215.     Perhaps  I  should  point out that as far as possible I intend to make
  216. sure that it will only be necessary to use the cartridge port OR MIDI port
  217. interface  to  follow  this  series.  The choice as to which one to use is
  218. yours  but I do recommend the cartridge port as your first choice as it is
  219. the  more  flexible  of  the  two.  However,as  I  said  earlier, the MIDI
  220. interface project is capable of carrying out most interfacing tasks and is
  221. an  ideal  alternative particularly if your cartridge port is tied up with
  222. other devices that you may wish to keep on line.
  223.  
  224.  
  225. Close Box
  226. ---------
  227.  
  228.     A  lot  of  blurb  in  this first article but we will get down to some
  229. practical work next issue so get your soldering irons ready.
  230.  
  231. Next Issue
  232. ----------
  233.  
  234.     Full details of parts required and building of the MIDI Interface.
  235.     More on buffering the cartridge port.
  236.                            Stay connected......
  237.  
  238. NOTES
  239. -----
  240.  
  241.     All  modifications,  experiments,  hardware  and software discussed in
  242. this  column  are tested on an Atari STFM with high resolution monitor but
  243. should work on other set ups.
  244.  
  245.     If you spot an error or know of a better way of achieving something in
  246. the  hardware  or  software  then  please  let me know and I will pass the
  247. information  on  through this column so that we may all learn. This, after
  248. all, is what STEN is all about.
  249.  
  250.  
  251.     Whilst  every  effort  has been made to make sure that the information
  252. given in this article is correct neither I or STEN can be held responsible
  253. for  any  damage  which may arise due to you carrying out modifications or
  254. connecting any devices directly or indirectly to your ST.
  255.                                               "By Order of der Management"
  256.  
  257. *************************************************************************
  258. * Suppliers                                                             *
  259. *                                                                       *
  260. *Cartridge port Expander from:-                                         *
  261. *Mr W.M.Kennerley. 90 Lingfield Road, Stevenage,Herts. SG1 5SN          *
  262. *Tel. 0438 352847                                                       *
  263. *-----------------------------------------------------------------------*
  264. *MIDI 8-Bit Interface                                                   *
  265. *Elektor Electronics (Publishing), Down House, Broomhill Road, London   *
  266. *                                                               SW18 4JQ*
  267. *PCB  £13.34 inc.                                                       *
  268. *Software on disk  £8.64 inc.                                           *
  269. *************************************************************************
  270.  
  271. *************************************************************************
  272. * Bibliography                                                          *
  273. *                                                                       *
  274. *Concise Atari St 68000 reference guide by K.D. Peel                    *
  275. *Atari ST Internals by Bruckmann, English, Gerits                       *
  276. *ST Applications- Internals series by Paul Rossiter                     *
  277. *GFA BASIC V3.6 Manual                                                  *
  278. *April 91 issue of Elektor Electronics                                  *
  279. *************************************************************************
  280. *************************************************************************
  281. * Dave Price.  42 Foxglove Green, Willesborough, Ashford, Kent TN24 0RJ.*
  282. *************************************************************************
  283.                                   -oOo-
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.