video colour inverter with tricks in hand dynamic pre-amplifier a program for your 6845 video controller simple battery condition meter clean those ZX81 pulses! dial another computer: data exchange by modem RS232/ Centronics interface news • views • people news — views — people the Sinclair QL: first impressions Our assessment of a first-class personal computer. dynamic RAM power supply balancing transformers J Simple ways of matching aerials to transmission lines. video colour inverter Changing the phase of the composite colour signal gives rise to a multitude of interesting and often useful effects on the TV screen. programming the 6845 The screen format selected by this cathode ray tube controller is deter- mined by the contents of its internal registers. We offer a short BASIC pro- gram to simplify the calculation of the contents. ZX81 cassette pulse cleaner j A circuit to improve the reliability of the FSK system used by many personal computers. direct-coupled modem As promised last month, this article describes the hardware for a versatile, direct-coupled modem. battery tester A meter for quickly and simply determining the condition of any dry cell or battery. RS 232 centronics converter I A very useful device for overcoming problems caused by the incompati- bility of RS 232 and Centronics interfaces. dynamic pre-amplifier A new design, based on a single 1C, of a unit that is always welcome with many readers. depicts some samples of 1 * 2i the effects that can be obtained with our video colour inverter featured on page 1 1 22 With this unit it becomes possible to invert 11.34 either the contrast fb/ack- and-whitel or the composite colour signal ! including the B/W information). An 1 1 .42 interesting project for video film makers and amateur photographers. Starting with this issue. ' ' **** we will regularly publish projects for which compo- nents are normally available 11.50 s " h- 1 logic tester 11 .55 how to recycle dry cell batteries 11 .56 flashing badge 1 1 58 market 1 1 .59 switchboard 11.71 missing link 11.74 Important modifications to, additions to, improvements to, or corrections in, Elektor circuits. index of advertisers 11 .74 ow LUXeo INTRODUC Speakers _ for: The range Colour TV Speakers: already covers 10»15 LCT 6 D (4"x6" Oval) Speakers for: 8x13 LCT 5 (3Vi"x5" Oval) Transistors, 1 0 LCT 5 D (4" Square) Tape recorders, B/W TV Speakers: ! Stereo systems, 10x15 LG 6 TV (4"x6" Oval) Car Stereos, 7x10 LG 2 TV (2 1 / 2 "x 4" Oval) Intercoms, and 10 LG 5 TV (4" Square) Now LUXCO widens the range by introducing Speakers for TV Wanted Stockists all over India ■ Manufactured by : LUXCO Electronics Allahabad 211-003 Telex: 540-286 ■ Sole Selling Agent : LUXMI & CO. 56, Johnstongani Allahabad-21 1-003 Phone: 54041 ■ Distributors for Gujarat & South India: precious' Electronics Corporation ■ Chotani Building 52, Proctor Road Grant Road (E) Bombay-400 007 Phones: 367459, 369478 ■ 9, Athipattan Street Mount Road Madras 600-002. Phone: 842718 ■ Distribtors for Delhi & Haryana Railton Electronics Radio, Palace, Chandni Chowk Delhi- 1 10-006 Phone: 239944/233187 sound technology from a sound source .05 Components for the entertainment electronics industry. From the Keltron supermarket. Power transistors You name it, we have it. Devices in TO-3, T0- 66,TO-39and TO-18. Both NPN and PNP types. Current capacity upto 30 A. Power ratings from 1 45 MW to 1 50 W. Voltage ratings from 20 V to 1 500 V. T ransition frequency upto 550 MHz. 2N 3055. BU 205, 2N 3773, BD 1 15, BC 177, even BU 326, BU 536, BU 208D Resistors There's a lot more to them than the film coating. A high degree of vacuum; extra protection against climates; lead pulling and high voltage tests; high stability and low temperature coefficients; computer control of gases and power for strict adherence to specifications; carbon film resistors in % W and H W power. Electrolytic capacitors Made at the biggest plant in all Asia. In collaboration with Sprague, the world's best name in the field. Result : smaller sizes. Low dissipation. Tighter controls for ripple current factors. Greater tolerances. A range from 0.47 Mfd to 10000 Mfd and upto 500 Volts. LCSO approval. Ceramic capacitors Designed to withstand all climatic vicissitudes With high insulation resistance, low dissipation factor, good dielectric strength and operating stability. In a range of voltages for both temperature compensating and high dielectric constant types. Regd. Office : □ Kerala State Electronics Development Corporation Lid.. Keltron House, Vellayambalam, Trivandrum-695 001 . Telephone ; 60621 Telex : 0884-273 KEDC IN Telegram . ELECTRONIC Trikava.KC6.85 elektor india november 1984 1 1 .07 OMC Computers Limited Looking beyond the computer horizon . In an age of rapidly changing technology, the test of a good computer cannot end with its features — however excellent they may be by today’s standards. The real test lies in the technology and the people behind the company. Hie adaptability and innovativeness of the organisation that makes the computer. An organisation which can keep abreast of latest technology and continuously implement them. An organisation which has the experience in providing quick and efficient service. OMC. Computers Limited, inherits these qualities from its promoters. • Technology from I)r. Raj Reddy, the well known Computer Scientist and Director of Robotics Institute at Carnegie Mellon University, Pittsburgh, USA. • Marketing and senicing philosophy from Voltas Limited, which has years of experience In a sendee oriented market. • Governmental participation through Andhra Pradesh Electronics Development Corporation. This dynamic company, now announces the OMEGA 58000, the first indigenous super mini computer which can handle Engineering and Commercial applications with equal efficiency. One that draws graphic patterns of precision as easily as it handles day to day business operations. If excellence is a language you understand and computer superiority is what you are looking for, OMC stands out as the Computer company of the future. l Ye®, I'd like to know more about the 1 OMEGA 58000. Please send I □ Product literature □ Your Sales Executive to call on us Designation Name & Address of organisation Tel: Signature OMC COMPUTERS LIMITED 2- 1 1 -30/7, Surdur Patel Road, Sccunderabad-500 003 Htone: 70556 Phones: Bombay: 8026212, 2028261 New Delhi: 666971 The smart counter PM 6668:1 GHz (pr • Microcomputer control • Self-diagnostic routine • Reciprocal frequency counting • High-stability TCXO: 10-'/month ' Auto-triggering on all waveforms 1 High-contrast liquid crystal display High resolution and easy operation for a low price This new counter gets it all together. It gives you high resolution and accuracy plus easy operation and compact construction. The high resolution comes from the use of reciprocal frequency counting, which gives an intrinsically higher resolution without the traditional ± 1 cycle error. For example, a full 7-digit resolution is obtained in only one second. It therefore avoids the need for long gate times. K riod measurements or the litations of phase-locked frequency multipliers. Other big benefits that the micro-computer design brings are easy operation and minimal controls, since the built-in intelligence gives automatic triggering and range switching. Other features include further improvement in accuracy via the optional high stability TCXO, The 1 GHz PM 6668 does it all Another advanced Philips timer/counter: PM 6624D: 600 MHz For further details, contact: Philips India Test & Measuring Instruments Division Plot 80. Bhosari Industrial Estate PUNE 411 026 ® Test & Measuring Instruments PHILIPS Philips - the trusted Indian household name for over fifty years. OBM/9262 : » LRTEST FRGfl RPLR8 Rplab —Leadership through technology feaas s^...„-333crim l Aplab’s new _ J autoranging 4V4 DMM model 1085S ensures precision measurements economically. Automatic selection of ranges of AC/DC voltages, currents and resistances. It is a versatile multimeter with high resolution, accuracy and reliability. Easy to use. A must in repair or maintenance shops, research, design and development laboratories. Features: * AUTORANGING * HIGH ACCURACY * HIGH RESOLUTION: lOuV ON 200 mV RANGE * 10M HIGH INPUT IMPEDANCE * 4 'h DIGIT, 11mm HIGH LCD DISPLAY * OVERRANGE INDICATION WITH BEEPS AND BLINKERS * AUTOZERO AND AUTO POLARITY * SAMPLE HOLD FACILITY * MAINS CUM BATTERY OPERATED * DIODE TEST FACILITY Applied Electronics Limited AVAILABLE EX-STOCK Aplab House. A-5 Wagle Industrial Estate, Thane 400 604. Phone: 591861 (3 lines). Telex: 011-71979 APEL IN. Nos. 44 & 45 Residency Road, Bangalore 560 025. Phone: 578977, Telex: 0845-8125 APLB IN. 8/A Gandhi Nagar. Secunderabad 500 003. Phone: 73351. 22C. Manohar Pukur Road, Calcutta 700 029. MF-3 Stutee Building, Bank Street. Karol Bagh, New Delhi 110 005. Phone: 578842, Telex: 031-5133 APLB IN. 11.13 The Superswitch 5 range of Thomson- CSF. A family of switching transistors and diodes. Now available in India through Meltron. Meltron now makes available to the Indian Industry a complete range of sophisticated Semiconductor Devices and other components against AUL/OGL. The highlights of this range 1 . Superswitch ? range of Transistors and Diodes for use in switch mode power supply exceeding 1KW, Invertors, Convertors, etc 2. Transient Voltage Suppressors ••TRANSIL” for high surge capability 3. Schottky Diodes for extremely fast switching and for replacing Germanium Diodes o THOMSON -CSF 4. Temperature Compensated Zener Diodes 5 Microwave Components like Semiconductors, MICs. Ferrite Devices & Materials. Optical Components and other Passive Components 6 Space qualified components 7 Integrated Circuits — Consumer Audio & TV Circuits, Operational Amplifiers. Voltage Regulators & Comparators. Special Circuits. Mos Micro Processors Memories, etc. 8. Crystals and Crystal Oscillators 9. Discrete High Power Semiconductors — Power Diodes. Fast Recovery Rectifiers. Invertor Grade Thyristors. Darlistors. Triacs & Alternistors THOMSON-CSF components group, one of the world’s largest component producer, also has a complete range of Passive Components to offer. This range includes Connectors, Reed Relays. Reed Switches. Plastic Film Capacitors. Commutator Capacitors. Ceramic Capacitors. Ferrites. Delay Lines. Semiconductor piece-parts, etc. For technical details and prices, please contact: Maharashtra Electronics Corporation Limited Plot No 214. Backbay Reclamation. Raheja Centie, 13th floor. Nariman Point. Bombay 400 021. Telephone 240538 Telex 011-6817 ME Cable: MELTRON 7A. Hansalava. 15 Barakhamba Road. New Delhi 110 001. Telephone: 40641 Telex 031-2815 MELN 55, Rama Nivas. 10th Cross, West of Chord Road, II Stage. Bangalore 560 086. Telephone: 350772 Telex 0845-8136 rnELRon Meeting the challenge of tomorrow. 1.15 the QL: first impressions We have spent the past few months getting ourselves acquainted with the three QLs we finally received in late June. Our first impression is that Sinclair has once again succeeded in setting new standards in up-to-date engineering and performance at a highly competitve price. The hardware produced by Thorn is faultless: a traditional (by Sinclair's standards: good) keyboard that lacks a certain amount of 'feel', two microdrives that function well, and an uncluttered printed circuit. The picture quality is excellent: our tele- vision receiver (fitted with a SCART connector) constantly gave a sharp picture without any streaking or shifting and with good saturation of the colours. These features were cer- tainly not so noticeable in the ZX and Spectrum equipment. The super-BASIC, together with the Q-DOS operating system, is stored in a 48 K ROM (EPROM!). Super- BASIC is a new variant of BASIC in which aspects of Pascal and Algol have been incorporated. It makes programming a pleasure and avoids, for instance, those eternal declara- tions that are needed in Pascal. As may be expected, there are also aspects that fall below standard. The handbook, for instance, appears to have been printed before it had been edited and without typeset correc- tions. We also found that the con- nection diagrams of the RS232 socket and the video socket were incorrect. Sadly lacking is a contents list, not to mention an index: the consequent constant leafing through the voluminous ring binder is certain- ly not our idea of tun! Good points in the handbook are the clear warnings and cautions which can save a lot of frustrations. There is, for instance, the advice to format new microdrive cartridges more than once. Our first format request was met by the reply that the cassette cannot be formatted. The second attempt was, however, successful and we have never looked back since. We assume that the head of one of the drives had become somewhat dusty during the long delivery time. . . Although the reading of our own files gave no cause for complaint, it would appear that the software delivered with the QL has been copied a little hastily. In one case we found it impossible to load the archive program supplied, and in another the text compiler cassette displayed a stubborn fault. For- tunately not a problem for us with three QLs, because we can inter- change parts, but otherwise. . One of the three models suffered initially from picture distortion: ver- tical stripes, accompanied whenever the microdrive was started by horizontal ones. This fault was traced to low supply voltage and has since been corrected. The power supply is a gem: con- tained separate from the QL in a black, plastic cube, it hardly gets warm and generates not a trace of hum. The 5 V voltage regulator in the QL itself is fitted onto a 'judicious' heat sink and gives the appearance of thermal excellence and reliability. Each QL comes complete with four programs: 'quill', a text compiler; 'abacus' for arithmetical computa- tions; 'easel' which enables the graphical representation of arithmetical work; and 'archive', a database. As far as operation is con- cerned, we have no complaint: instructions are always clearly indicated and invariably followed by further actions required. What we do not like is the speed at which various operations take place. Writing text gives no real problems, but during corrections the cursor moves exasperatingly slowly. It appears that after only half a page the text is written onto the microdrive, and since that means that the data have to be recovered first, reading back takes a lot of time. On the other hand, this is not unique to the QL: other well-known text compilers such as Wordstar suffer (but not so badly) from this inadequacy. However, when the cursor inertia is combined with the relatively slow microdrives, the times are only just acceptable in BASIC. It would seem that at least part of the programs will have to be rewritten soon! The software was produced by PSION, the London software com- pany, probably in a higher language and then translated to the 68000 code, which would explain the slow tempo. It appears that in spite of the 128 K RAM there is not all that much room left for text, so that storing in the microdrive is necessary almost immediately. There is no indication of this in the handbook, but our tests indicate that there is at most 40 K available for text. We can only hope that we have made a mistake, because after allowing for the 32 K for the video display, there are 96 K left: according to our findings this means that almost half of the remaining capacity is used for the internal management of BASIC and Q-DOS and that sounds unbeliev- able! But even the designers had reckoned on only 32 K ROM and consequently provided only two 1C sockets. One of the three EPROMs fitted is therefore simply soldered piggy-back onto another! In the light of our experiences, we find the level and volume of criticism levelled at the QL from virtually all sides grossly exaggerated. We accept that some of it is warranted by the delays and other factors reported in an earlier issue of Elektor, but criticisms such as "Why another new computer?", and "Surely there is no market for this" just do not hold. Or do we detect an underlying tone in the vein of "At that price it cannot possibly be as good as claimed"? the hobby market and it is supposed to be here that there is no need for another machine. (It is true, of course, that the QL is based on a slightly simpler construction.) This would, indeed, be a remarkable philosophy, because what can there possibly be against an excellent piece of equipment that is available at a highly competitive price and is, moreover, so easy to operate? It is, of course, true that the software is not perfect, but when the redoub- table IBM-PC was launched, it offered little more than a text com- piler. But, to remain with the Mac: its associated text compiler cannot handle more than 10 pages (!). And is it really so convenient to have to take your hand off the keyboard every time the cursor has to be posi- tioned? But enough of all this — we have no intension of criticizing any particular machine, only to draw fair com- parisons. Nowadays, all systems tend to be so complex that teething troubles are unavoidable, and, as always, it's only a question of time for these to be solved. It is therefore even more surprising that there have been so many over-the-top reactions and demands that this new machine be perfect from day one. M What is the difference between the QL and, say, a Macintosh, which, by the way, is about four times as expensive as the QL. Is it that the Mac has a 'real' drive? Or a built-in monitor? Or is it the 16-bit wide 68000 microprocessor which makes the Mac slightly faster? In other aspect the two are quite similar: both have 128 K RAM and excellent graphic, the Mac only in black-and- white but with a superior resolution. Yet, nobody says about the Mac: "And what are we going to do with that?". And we have not heard too many complaints in respect of the Mac’s RS232 printer output which is suddenlly called 'non standard' in the QL. Moreover, nobody is in the least bit surprised that Apple have implemented their own operating system. One theory is that the Mac (mainly because of its price?) is geared towards the professional market, while the QL (mainly because of its price?) is intended for dynamic RAM power supply It is often a common wish to extend the memory range of a microprocessor system with the aid of economically priced dynamic RAMs. On consider- ation, the first point to arise is the different supply voltages required by this type of memory device. Generally speaking, dynamic RAMs require supply voltages of +5V.+12V and -5V. Unfortunately, it is not very often that all three supply rails can be found inside the computer concerned. Most micro- processor systems operate on a single 5 volt supply. How, therefore, can the missing supply voltages be obtained easily? The most obvious solution, of course, is to replace the existing mains transformer by one which has three secondary windings and then add the required extra rectifiers and voltage regulators etc. However, this could prove to be rather expensive. A much cheaper solution is suggested by the circuit shown in The principle used is the so-called 'chopper' The heart of the design is the well known 555 timer 1C. It is used here as an astable multivibrator with an output frequency, at pin 3, of approximately 15.5 kHz. The actual frequency can be altered if required and can be calculated from the formula: The squarewave output at pin 3 of the 555 timer drives transistor T 1 , which in turn controls the current passing through the primary of the transformer. Different output voltages can now be obtained from the secondary windings. Obviously, these signals will still approximate a squarewave and will therefore require rectification, regulation and smoothing in the normal manner. This is ac- complished by D 1 . C3, C4 and I C2 for the + 1 2 volt supply and by D2, C5, C6 and IC3 for the -5 volt supply. Capacitors C4 and C6 should be tantalum types. The transformer can be constructed using a Siemens pot-core type B 65561 - A 250 - A 028 This has an A|_ value of 250 nH and an air gap of 0. 1 7 mm. -- .19 A balancing transformer (often called a balun, which is a contraction of Z>a/anced/u/7balanced) is any device used to couple a balanced impedance, for instance an aerial, to an unbalanced transmission line, such as a coaxial aerial feeder cable. balancing transformers aerial matching made simple An example of a balancing transformer is given in figure 1: in la it consists of two pieces of twin feeder cable, while in lb coaxial cable is used. In either case, the pieces of cable are a quarter wavelength long and are connected in parallel at one end and in series at the other. The two most important properties of such a balun are impedance transformation and sym- metry transformation. Textbooks refer to these baluns as quarter-wave matching sections. In such sections, the parallel-connected ends pre- sent an impedance of Z/2, where Z is the characteristic impedance of the cable used in the transformer. This termination of the section is asymmetrical. The series-connected ends present an impedance of 2Z, and the section here is open-circuited and symmetrical. 1b 1 1 ,20 Air-cored transformers Dipole aerials for short-wave, UHF, and TV reception are normally connected to the radio or television receiver by a coaxial (75-Q) cable. This causes the aerial to be loaded asymmetrically, even though its base impedance is equal to the characteristic impedance of the coaxial feeder cable. One effect of this is the flow of transient currents in the screen of the cable: the screen then acts as an aerial and this, of course, is not the intention! The simplest way of preventing the flow of these transient currents is connecting the aerial to the feeder cable via a transformer intended for matching 75-ohm impedances as shown in figure 2a. The transformer is wide-band, no changes are necessary to the coaxial cable, and there is nothing to adjust: it could not be easier. Unfortu- nately, this set-up has the disadvantage of no longer acting as a pure inductor at high frequencies. Figure 2b illustrates a matching trans- former for connecting a 300-ohm aerial to a 75-ohm feeder cable. The transformer is wound from lengths of coaxial cable with a characteristic impedance, Z 0 , of 150 ohms. The relation between Z c , the aerial base impedance, Z a , and the characteristic impedance of the feeder cable, Zf, is given by Z 0 = \/Z a Zf. The length of the pieces of coaxial cable from which the transformer is wound should be not less than one tenth of the maximum wavelength and at least four times the inner diameter of the trans- former. For an operating frequency of 100 MHz, therefore, the length should be not less than 30 cm, while the inner diameter of the transformer should not exceed 7.5 cm. The turns should be close spaced and the connecting points should be protected against moisture ingress by a plastic spray. balancing transformers 3b Toroidal transformers Winding the transformers on a ferrite toroid results in a small, space-saving balun. Figure 3a shows an arrangement electrically similar to that in figure 2a: two lengths of enamelled copper wire of 0.25 mm diameter (SWG 32. . .34) are twisted together and then laid in ten turns around the toroid. If a T50-2 core is used, the transformer may be used over a frequency range of 12 . . . 280 MHz. The configuration in figure 3b is similar to that in 2b and here again a bifilar winding of twisted enamelled copper wire of SWG 32 ... 34 is used. This transformer matches a 300-ohm aerial to a 75-ohm feeder cable, that is, the impedance transformation ratio is 1:4. The correct terminals may be deter- mined with a continuity test and then con- nected as indicated. The advantage is that this arrangement does not need 150-ohm cable which is not easy to obtain. On the other hand, a toroidal transformer is slightly more expensive. M 11.21 video colour inverter with a host of * Inverting the phase of video signals causes interesting effects on the Other interesting screen - As proprietary equipment for this purpose is expensive, the , ° low-cost inverter presented here may be of interest to many of you. The unit offers the choice of inverting the composite colour (= luminance + chrominance) signal, or the luminance (black and white information) signal only. j The inverter is of interest to three groups of people: video recorder owners who I want to change the image on their tele- i vision screens, video camera operators I who want to incorporate trick images in their work, and amateur photographers who want to view their negatives as positives. | Depending on the setting of the relevant switch, the circuit provides normal, that is, | non-inverted, images (which means that the inverter may be connected perma- I nently), or inversion of the luminance and i chrominance signals, or inversion of the luminance and adjustable inversion of the chrominance signal. The range of adjust- ment lies between full inversion and near- normal: the setting of the relevant control, P2, depends on the required effect and individual taste. Applications It should be noted that the inverter func- tions on the composite colour signal. Its input and output are therefore suitable for use only with equipment where this signal is readily available, for instance, via an A/V socket or BNC plug. This is, of course, no problem with modem video cameras, VCRs, and television receivers. Moreover, such a connection is easily fit- ted retrospectively to most older equip- ment. If you do not feel confident of carrying out this modification yourself, ask your local TV repair shop. The use of the inverter as image modifier for video recordings is illustrated in figure 1. Your favourite piece of equipment may, for instance, be co-opted to function as part of a home discotheque. All you have to do is to record some suitable con- certs and during playback to switch in the inverter at appropriate passages. Figure 2a shows a suitable set-up for video camera operators. It is best to use a recorder with an electronic editing fa- cility: the recorder is then stopped at the moment the switch-over from normal to inverted image, or vice versa, takes place, so that synchronization upsets are prevented. If you are fortunate enough to possess two VCRs (for instance, a mains operated and a portable model), the set-up in figure 2b may be used. The advantage of this arrangement is that filming may be carried out as normal and the image modifications may be inserted during editing of the november 1984 .22 recording. The video amplifier (for instance, the video distribution amplifier featured on page 1-30 of the January 1984 issue of Elektor) serves not only to com- pensate for losses in the recording and playback chain, but also to provide the possibility of using a TV receiver with A/V socket as monitor. A suitable configuration for amateur photographers is shown in figure 3 which is self-evident, but has two important limitations. Firstly, the set-up is restricted to black-and-white negatives because it would be quite difficult to compensate for the orange mask on the negative, and, secondly, the video camera must be of .23 reasonable quality and be fitted with a good macro lens to ensure usable results. Video signal We have no intentions of embarking on a full course in video technology but will restrict ourselves to those aspects which are important to the circuit. The single line scan shown in figure 4 illustrates nor- mal traversal of the composite colour signal. If we want to invert this signal without affecting the other functions of the TV receiver, it is necessary to invert the line scans as shown in figure 5. Both the luminance and the chrominance signals are inverted, because the chrominance signal is ‘interwoven’ with the luminance signal. If the phase of the colour burst signal is also shifted by 180°, the colour information returns to normal while the luminance signsil remains inverted. How this is achieved will be explained in the circuit description. Circuit description Switch SI in figure 6 switches the inverter in, or out of, circuit. With SI in position as shown, the incoming signal is applied via input network C1-C2-R1-R2 to a clamping circuit formed by opamp IC2 and diode D3. The input network is necessary to transfer the signal bom the camera or VR undistorted and present it with the right impedance. Unfortunately, it causes the signal to lose its d.c. off-set which is required for the proper functioning of the inverter. The clamping circuit reintroduces the off-set by pulling the lowest (most negative) component of the line scan to 0 V. Because the clamping circuit has a high- impedance output, it is followed by buffer (voltage follower), IC1. The output of IC1 is available at pins 2 and 6 and is divided One part of the output is applied to com- parator IC3 which regenerates the line .24 sync(hronizing) pulse (available at pin 7). The leading edge of this pulse triggers monostable multivibrator IC4. This monostable controls the actual run-off via electronic switches ESI . . . ES3. Switch ES4 is controlled direct by the output of the comparator, which we will return to later in this article. The other part of the output of IC1 is applied across colour saturation control PI. The 0 output of IC4 is at logic 1, which keeps switch ES2 closed, until the end of the colour burst pulse train. With colour inversion switch S2 in position 1, the signal from PI is then applied to the non-inverting input (pin 1) of opamp IC6 via ES2; the phase of this signal is therefore not (yet) inverted. When the monostable changes state, output Q goes low and output 0 becomes logic 1. Switches ESI and ES3 are then ‘ori and ES2 is open. The signal from PI is applied to the inverting input (pin 14) of IC6 via ESI, so that the phase of the composite colour signal at pin 7 of IC6 is shifted by 180°. At the same time, ES3 applies a reference voltage from voltage divider P3/R9 to the non-inverting input of IC6, ensuring a correct and positive signal level at the output. When S2 is set to position 2 and P2 is turned fully open (wiper at M), the colour burst signal is phase-shifted 180° by the action of Tl. The colour information at pin 7 of IC6 is then shifted a total of 360° and is in phase again with the incoming 6 It is evident that both inverted and non- inverted colour burst signals are present across P2 and this makes it possible for the degree of inversion of the colour infor- mation to be adjusted as required. In other words: colour may be continuously changed from normal to fully complemen- tary; with P2 at the centre of its travel, there is no colour. The line sync signal must, of course, be fed to the following circuit (TV receiver or video recorder) non-inverted and this is ensured by T2 and ES4. The switch is con- trolled direct by the output of comparator IC3. Transistor T3 and resistors R16, R17 ensure a correct output impedance of 75 S. The power supply is a conventional, voltage regulated +5 V circuit. As the negative line is not loaded as heavily as the positive, the value of C13 may be rather smaller than that of C12. Construction and calibration If the printed circuit of figure 7 is used, there should be no special problems in the construction. The compact design enables the unit to be installed in a neat case. Amateur photographers should use presets in the PI . . . P3 positions, and this arrangement is also advisable for disco applications (so that not everybody can play around with the inversion settings). Others should find it advantageous to use normal potentiometers and fit these onto the case; connections between them and Figure 6. The circuit diagram of the inverter: possible extensions are explained in the text. .25 Resistors: R1 = 82 Q R2, R7 = 100 k R3 = 15 k R4.R5 = 220 k R6.R11.R12.R14 - 2k2 R8.R9.R13 = 1 k RIO - 2k7 R15 = 8k2 R16 = 120 Q' R17 68 Q* R18 = 470 Q P1.P2.P3 = 1 k preset or Capacitors: Cl = 100 p/16 V C2 = 10 n C3 = 1 p/16 V C4 = 47 n C5.C14.C15.C16 = 100 n C6.C7 = 33 p C8 = 1 n C9 = 56 p CIO = 27 p C11 = 100 p C12 = 220 p/25 V C13 47 p/25 V Semiconductors: D1.D2.D3 AA119 D4.D5 = 1N4O01 T1 = BF 494 T2 = BC547B T3 = BC 141 IC1.IC2 = LF 356 IC3 LM 311 IC4 - 4047B IC5 = 4066B IC6 = pA733 IC7 - 79L05 IC8 = 7805 Miscellaneous: 51 -- double pole change- over switch 52 = single-pole change- s' 6 DPST mains switch Trl - mains transformer 12 V/100 mA secondary printed circuit board 84084 case two BNC or A/V sockets' Optional: R16 = 82 O R17' = 68 B P4 = Ik. 100 k the printed circuit should be made in screened wire with the screen connected to earth. Where potentiometers are used, it is convenient to provide a graduated scale around, or a skirt under, the control The type of input and output connector depends really on the equipment the inverter is to be used with. BNC connec- tors are very convenient and easily fitted but lose their advantages if adapter cables become necessary. If you use A/V sockets, interconnect all pins, except 2 (= composite colour signal), and connect pin 3 to the nearest earth point in the circuit. Calibration is relatively simple and requires a video signal source and a test card (this may, for instance, be one recorded from a broadcasting station). Set switch SI to position 'inverter on’ and S2 to position 1. Controls PI and P3 should then be adjusted to give rich colours and a good contrast respectively. Finally, set S2 to position 2 and check that colours can be continuously changed from normal to complementary by P2. Other interesting facets For another of our experiments we needed one half of the screen image inverted and the other half normal. This requires a lenghtening of the time IC4 is triggered and this is achieved by connec- ting an additional preset in series with R10: the switch-over to inverting then takes place sometime during the line scan. If the trigger period is further extended, inversion does not take place until the next line scan. This gives the interesting picture of alternate normal and phase- inverted lines. Making the trigger period longer still (a 100 k preset in series with R10) causes the effect to be visible over one part of the screen image only. The additional preset is connected as shown 11.26 in figure 8. As the inverter is relatively inexpensive, particularly when compared with commer- cially available models, it is quite feasible to connect two or more of them in cascade. We think that four or five of them so connected will function without any problems, although we have not built so many prototypes ourselves and cannot therefore prove it. Such a set-up offers so many possibilities for achieving trick effects that it is impossible to envisage them all: we'll give you two. When two inverters are connected in series of which only one inverts the colour, the resulting picture is normal as far as black-and-white information is con- cerned, but the colour is inverted. The second example is illustrated in figure 9. Here, the onset of the first inverter is arranged so that one part of the picture remains normal; the second part, in the centre, has the black-and-white information inverted. The second inverter inverts the inverted black-and-white infor- mation and inverts the colour. The overall picture will then show: normal — black- and-white inverted — colour inverted. This all presupposes that both inverters are fit- ted with the additional preset P4. For really accurate settings, you could use multi-turn presets or potentiometers, but this is really a matter of cost. In our experience, the inverter can be calibrated very well with just fingertip control. A final tip: if you want to monitor the modified image being recorded, reduce R16 to 82 Q, connect a 68 Q resistor, R17', in parallel with R17 as shown in figure 10, and add a socket as appropriate. H 8 Figure 8. This shows how possible by this simple means are explained in Figure 9. When two this sort of trick be possible. I recorded. 11.27 programming ,p. 6846 Computers do not always have to perform difficult tasks to be useful. Very often it is the boring, repetitive, soul-destroying type of work we make them carry out. Calculating the hexadecimal values of the registers in the 6845 (or 6545) cathode ray tube controller (CRTC) for any given screen format could hardly be called mind-taxing but it is the sort of job that any computer, using this BASIC program, will perform correctly and as often as you like. programming the 6845 a BASIC description < the CRTC registers The value of changing the screen format on your Elektor VDU card (or any other VDU card that uses a 6845 or 6545 CRTC) may not be immediately obvious but once hooked on the technique it is something you are likely to do more and more often. Furthermore this program is interesting and instructive in its own right. The parameters The 6845, and all the various details about structure, organisation of the screen for- mat and the signals used, have already been dealt with in Elektor and in other books so we will not bother about that here. Any information required can be found in the literature listed at the end of this article. The video norms currently in force in Europe use a line frequency of 15625 Hz and an frame frequency of 50 Hz. The time needed to sweep one line on the screen 1/15625 s = 64 ffS, and the time to sweep a complete frame is 1/50 s = 20 ms. I We must now calculate the clock fre- quency required by the system. Each character is based on a horizontal width of eight screen dots, each of which is scanned in one clock period. Knowing the number of horizontal characters now enables the clock frequency (which we will call lx) to be calculated. The dot fre- quency is l/f x and the character fre- quency is eight times this value. With a total of 128 horizontal characters the clock frequency is: This is no coincidence, actually, as the figure of 128 characters is chosen because it allows the common, inexpensive 16 MHz crystal to be used. Working out the character duration gives The total number of horizontal characters (minus one) between two horizontal sync pulses forms the contents of register R8 In this example we get: 128 - 1 = 127 or 7FHEX- The contents of register R1 indicates the number of characters per line which in most cases will be 80, or 50HEX- The position of the horizontal sync pulse is determined by the contents of register R2 (see figure 1). This is calculated as follows: HP = ((TSL - DT - 1.5 xLPB)/2) +DTZ where DT = the width of the usable win- dow (in (i s) TSL = the line time (in ms) LPB = breadth of the line sync pulse (in ms), and HP = the position of the line sync pulse (in ms). The value of DT is: 80 x 0.5= 40 ms. The value of LPB (see R3) is 8 x 0.5 = 4 ms. Inserting these values into the formula, we get HP = ((64 - 40 - 1.5 x 4)/2) + 40 = 49 ms. The factor 1.5 is an optional character to permit the position of the window on the screen to be accurately set. Register R2 will contain 49/0.5 = 98 which is represented by 62 heX- Image synchronisation In order to calculate the image synchron- isation the number of screen lines per character must be known. The minimum number is eight, and this is generally used both for text and graphics characters. As the maximum number of character lines is 25, nine screen lines per character line are generally chosen. This gives 24 lines of characters on the screen. Each line then has a duration of 9 x TSL = 9 x 64 = S76 ms. .28 and sweeping the whole 24 lines takes 24 x 576 = 13,824 ms. This time is generally indicated by VT. The contents of register 6 will be 24, or 18HEX- The frame time must be as close as poss- ible to 20 ms. With the line time calculated above we see that 20,000/576 = 34.72 lines. Rounded off, this gives 34 lines (24 of which are usable) between successive frame sync pulses. From this we obtain the contents of R4: 34, or 21 heX- As -the frame time is only 34 x 576 = 19,584 there are still 20,000 - 19,584 j=? 1300 REM HHHHH RI2. RI3. RI4 k RI5 Iiiiiiiiii | 1310 R(12)=0 1320 R(13>=0 1330 R( 14) =0 1340 R( 15) =0 1350 PRINT : PRINT 1352 PRINT "SCREEN FORMAT = ":R(1>:" i ":( 1354 PRINT: PRINT 1708 FOR 0=0 TO 15 1710 PRINT K$:" R*:Q: 1720 PRINT TA8<20> :* = "j 1727 Z2=R(Q) 1730 G0SUB 2000 1740 PRINT 1750 ttXT Q 1740 PRINT : PRINT: 1880 PRINT " CLOCK PERIOD 1810 PRINT " LINE SYNC. PULSE HIDTH 1815 PRINT " LII€ SYNC. PULSE PERI00 1838 PRINT " HORIZONTAL DISPLAY TIME 1840 PRINT " HORIZONTAL POSITION 1850 PRINT " CHABMTTER LINE PERIOD 1855 VE=YiTR*R(5)iTSL 1840 PRINT " RASTER SYNC. PERIOD 1845 PRINT " VERTICAL DISPLAY TIME 1847 PRINT " VERTICAL POSITION 1990 DC 2000 REM HHHHH DEC TO HEX HHHHH 2010 PRINT "♦": 2820 FOR 2=1 TO 0 STEP -I 2830 Z1=INT(Z2/14*Z) 2040 Z2=Z2-ZH14*Z 2050 Z1=ZI*48 2040 IF Zl>57 THEN Z 1=21*7 2070 PRINT CHR0CZ1) : 2080 NEXT 2: RETURN This value is divided by the line time 16,146/576 = 28.03 giving 28 when rounded, or ICheX- Register 8 will almost invariably contain laced frame. The contents of register 9 is simply the number of screen lines per character line. Table 2. RIH HORIZONTAL LINE LENGTH (CHAR.) : ? 128 FREQUENCY = 16 MHZ CRYSTAL FREQUENCY (MHZ) : ? 16 NUMBER OF CHARACTERS PER LINE: ? 88 NUMBER Of SCPN LINES: The cursor The program dealt with in this article does not permit a very flexible program- ming of the cursor. This can be improved by including a few BASIC lines to add a choice of options as we will now see. Registers 10 and 11 define the upper and lower limits (the size, in other words) of the cursor respectively. Bits 5 and 6 of register 10 determine whether the cursor is present at all and if so whether it flashes or simply lights. As an example, assume we want a non-flashing cursor which has the form of a single underline. The register 10 configuration needed is given by the value 48 heX (more details of this are given in Paperware 3). As the lower limit of the cursor will be the last line swept (for any given character Une), register 11 must contain 08 heX- Unlike what we have dealt with up to now, registers 12—17 do not lend themselves to individual calculations so we will have to be content simply to initialise them. NUMBER Of CHARACTER LINES: ? 24 SCREEN FOBttt = 88 J 24 REGISTER R 8 * *7F REGISTER R 1 = *58 REGISTER R 2 = *62 REGISTER R 3 = *88 REGISTER R 4 = *21 REGISTER R 5 = *86 REGISTER R 6 = *18 REGISTER R 7 = *1C REGISTER R 8 = *88 REGISTER R 9 = *88 REGISTER R 10 = *4? REGISTER R It = *8? REGISTER R 12 = *8« REGISTER R 13 = *88 REGISTER R 14 = *00 REGISTER R 15 = *88 CLOCK PERIOO LINE SYNC. PULSE HIDTH UNE SYNC. PULSE PERIOO HORIZONTAL DISPLAY T»€ HORIZONTAL POSITION CHARACTER LINE PERIOO IHSTER SYNC. PERIOO VERTICAL DISPLAY TIME .5 MICROSECONDS 4 HICROSECONOS 64 MICROSECONDS 40 MICROSECONDS 49 MICROSECONDS 576 MICROSECttBS 19968 MICROSECONDS 13824 MICROSEQWDS A few examples Programming the 6845 is made easier in any system with the aid of the program shown in table 1. Given four parameters (the number of characters between two line sync pulses [horizontal total], which gives the ideal crystal frequency that should be used, the number of characters used per line, the number of screen lines per character line and the number of character lines on the screen) it returns the hexadecimal contents of all the 6845 registers concerned. An example of this result is shown in table 2. All the parameters can also be stated in decimal base. Having let the program work out all these results the next question is what to do with them. If you are not using the Elektor VDU card and its software you will have to study your system's software to find out how to access the 6845 initialisation routine. In the Elektor system (detailed in Paperware 3) this initialisation procedure carries out two operations: one (routine MOVCRT) to change the look-up table containing the RAM and ROM parameters (CRT timing table) and the other to transfer the RAM parameters to the CRTC (routine CRTINT). This latter routine is the one we are interested in. Before starting it (by means of DISK! GO F36C, for example) the data calculated by the BASIC program of table 1 must be saved from address EFDCheX (61404 decimal) onwards. As is often the case, changing the screen format demands a total erasure so execute the RESET routine (F330HEX) immediately and this simply calls the CRTINT routine needed to program the CRTC. VERTICAL POSITION 16128 MICROSECONDS Ok References: Elektor Paperware 3 and 4 Motorola 8-bit Micropressors Manual Synertek Data Book .30 The ZX81 is one of the most popular personal computers but it does 2X81 leave a lot to be desired in certain respects, one of the most notable of which being its cassette interface. Any ZX81 user who has had to type in a complete program again because it could no longer be loaded from cassette will confirm this. The pulse cleaner described here is designed to make such problems a thing of the past. This makes it a must not only for ZX81 users but also for any other computer that uses a similar type of pulse/pause system for the cassette connection. ZX81 cassette pulse a cassette output signal cleaner for computers with single-frequency FSK passed through a band-pass filter. This is followed by another amplifier and a high- pass filter. All this is necessary to remove any low frequency oscillations from the signal as the computer could interpret them as extra pulses. The filtered signal is then fed through a negative and positive peak rectifier. A Schmitt trigger compares these output signals with the signal from the high-pass filter to ensure that short noise pulses are also removed. The result is a clean digital cassette signal at the out- put. The output signal from the positive peak rectifier, incidentally, is also used to control the attenuator at the input. The Sinclair ZX 81’s cassette interface uses frequency shift keying (FSK) with a single frequency. The signal is built up of a number of pulses, a pause, a number of pulses again, another pause, and so on (see figure la). The number of pulses be- tween two pauses indicates the logic level: four pulses represent a logic zero and eight pulses are used to indicate a logic one. If this signal is stored on a cassette tape the 'digital' shape cannot be properly processed due to limitations in the recorder's electronics and the qualities of the tape itself. When the data is read from the tape it will enter the com- puter as a signal that looks something like that shown in figure lb. The oscillation on the last pulse before a pause could cause the computer to falsely consider this as an extra pulse, with dire consequences. In order for the computer to be able to pro- cess it properly this signal should really be made into a digital signal with all the interference removed. The layout The various parts of the circuit are see the block diagram of figure 2. The incc ing signal from the cassette recorder is first passed through an adjustable attenuator before being amplified and block diagram ca The circuit The circuit diagram for the pulse cleaner is shown in figure 3. The input signal is first of all attenuated by preset PI and then passes to the adjustable attenuator. The output of positive peak rectifier A2 determines the d.c. voltage at the base of transistor Tl, which, in turn, decides the current passed through diodes D1 and D2 and therefore the impedance (or, strictly speaking, the differential resistance) of the diodes. When the output voltage of A2 is high the attenuation of the input signal will be correspondingly high. The moving coil meter in the collector line of Tl gives a visual indication of the strength of the The attenuator is followed by op-amp IC1 which amplifies the signal by a factor of eleven and then feeds it to the band-pass filter consisting of R4 . . . R9 and C3 . . . C8. The filtered signal is amplified by a factor of 100, by Al, to compensate for the attenuation introduced by the band-pass filter. The low frequency part of the signal is then removed by high-pass filter R12 . . . R14/C11 . . . C13 whose cut-off point is at about 9 kHz. The treated signal is fed to the inputs of the two peak rectifiers, A2 and A3, and the non-inverting input of Schmitt trigger A4. Each rectifier consists of an op-amp with a diode at the output. A 22 n capacitor (C15 or C17) is charged to the maximum value of the input voltage via the diode, which is part of the op-amp's feedback loop. The 100 2 resistors are needed to limit the charging current that the op-amps provide. The output signals from the two rectifiers are added via resistors R19 and R21 and then go to the inverting input of A4. The other input of the Schmitt trigger, as we have already noted, is connected to the output of the high-pass filter so that A4 compares the rectifier signals with the dif- ferentiated cassette pulses provided by the filter. The output of the circuit is a clean rectangular waveform that can be fed directly to the ZX 81 cassette input. In practice Small though this circuit is we thought it worthy of a printed circuit board design. This is shown in figure 4. As the power supply is included on the printed circuit board the only external components are the transformer and, of course, the meter. The various connection points, input, out- put, meter and power, are all clearly marked. When everything is connected and mounted the two presets must be set. Calibrating and testing the circuit is done with the pulse cleaner connected be- tween ZX 81 and cassette recorder. Now, while trying to load some (well recorded) programs from the cassette, trim preset PI until all programs are received correctly. When this is done set P2 so that the needle of the meter is in mid scale while programs are being loaded. The meter reading can be used as a reference point when loading programs. If the needle does not indicate mid scale PI should be trimmed until the reference position is again indicated. In this way even programs that have been difficult to load in the past can now be loaded properly. M direct- coupled modem a multi-standard alternative to the acoustically- coupled modem for this modem will be available from Technomatic Ltd. Please contact them directly for details. A direct-coupled modem is the most reliable method of sending data via a telephone line that a computer user could hope for. It is not particularly easy to design a good and reliable direct-coupled modem 1 but this is greatly simplified by using a dedicated modem 1C. Using this 1C, the AM7910, such a modem can be kept relatively small and inexpensive, as the design here shows. An important point about this modem is that it allows various different standards to be used, V21 and V23 being the ones that most concern us. The auto-answer facility enables the modem to receive messages without the computer user necessarily having to be present. The connection between modem and computer is made via an RS232 connector with V24 protocol and a modified connector for TTL levels. In preparation for this project we pub- lished an article in last month's issue (‘data transmission by telephone') to deal with the theory behind the connection of a modem to the telephone network. That article also dealt briefly with the AM7910 modem IC that is used in this project. Knowing that this IC is a ‘single-chip modem’ it may be surprising how many external components are needed to make it tick. All this is required for the two interfaces present and to generate and process the various signals used. In ad- dition to this the modem must be able to receive the data even in the presence of interference and it must not itself generate any interference. We have, of course, designed this modem to the very highest standards but it must be noted here that, like any equipment connected to the telephone line, it must have type approval Type Approval Quite understandably the Indian Telecom Research Centre will want to be sure that any equipment connected to the telephone network meets certain standard For this reason modems and other telecommunication equipment will probably have to be submitted to the appropriate authority for approval It is advisable to contact the Telecom Research Centre, New Delhi, for full details before it may be used. The direct-coupled modem's superiority over its acoustically-coupled counterpart is easily stated: the chance of errors occur- ring during data transmission is much smaller. If you have ever had to spend hours debugging a program received via an acoustically-coupled modem it will soon seem that it might have been better to simply send a floppy disk in the post in the first case. As someone once said ‘reliability is everything'. Features ■ The modem can be switched to various different standards. The ones that most concern us are V21 and V23. As we noted in last month’s article, V21 is the more common and has a 300 baud full-duplex operation. The V23 standard, on the other hand, is half-duplex with speeds of 1200 and 75 baud for the two channels. There are various other different standards poss- ible with the AM7910 but, as we do not intend to use them, we will not deal with them here. Suffice it to say that they exist. ■ The auto answer facility means that the modem can accept data messages if there is nobody home. In order to do this the modem detects the bell signal and then it looks to see if there is actually another modem at the other end of the line. If not it simply 'hangs up'. ■ There are two input connectors: one RS232 with V24 protocol and a modified RS232 that operates with normal TTL levels. These two connectors make it possible to send and receive at a speed of 1200 baud. Signals for the 75 baud back channel are automatically converted to this low speed by the modem circuit and later reconverted. During this conversion the appropriate wait signals are, of course, sent to the computer. ■ The complete transmitter and receiver sections, including all the necessary filters, are contained in the AM7910. The great advantage of this is that the modem needs no calibration. The actual circuit The basics of the circuit are seen in the block diagram of figure 1. The heart of the circuit is the AM7910, which contains a complete modem (transmitter, receiver, interface logic and so on). This is sur- rounded by various extras that are needed for the RS232 and TTL ports, the 1200/75 baud converter, the switching logic to select the different modes, the automatic switch-off facility if the carrier is not detected for a certain length of time and the bell detector that is needed for the auto answer facility. As the block diagram is fairly self-explanatory we will not spend any more time on it. We will move on to the actual circuit diagram, figure 2, instead. Once again IC1 is clearly the heart of the circuit so we will start by looking at the functions of its most important pins. ■ Transmitted carrier, pin 8. The modulated signal that is to be transmit- ted is found at this pin. ■ Received carrier, pin 5. This is the input for the incoming analogue signal that m ust be processed by the modem. ■ RING, pin 1. If this input is made ‘0’ and DTR is also ‘0’ the IC transmits a reply tone via TC to find out if is is being ca lled by another modem. ■ RESET, pin 3. A reset pulse is fed to this input from an RC network as soon as the power is switched on. ■ XTAL1, pin 24. As could be expected, this pin is the clock input for the IC. The clock signal is supplied by the crystal oscillator based on T1 and operating at a frequency of 2.4576 MHz. ■ MC0, MCI, MC2, MC3 and MC4, pins 17, 18, 19, 20 and 21 respectively. These inputs are used to enable the mode to be selected from the 32 different Bell or CCITT specifications available. A summary of these possibilities is given in table 1. In this modem we will only use the CCITT V21 and V23 modes so only MC0 and MCI are connected to the ‘switching logic'. The normal communication between the AM7910 and a computer (or terminal) is co nducted via the foll owing pins: ■ Data terminal ready, pin 16. This signal indicates that the terminal is ready to work with the modem. As long as the ter- minal and modem are communicating wi th one a nother t his signal must be low. ■ Request to send, pin 12. This indicates that the modem must switch to send mode. While data is being sent this input m ust remain low. ■ Sack request to send, pin 11. The back channel (in V23 mode) must also be switched to send, by means of this pin. 1 Br 1984 1 1 .35* Jirect-coupled modem This input is not, how eve r, use d for V21 mode. Note that RTS and BETS may never both be low at the same time; in our cir- cuit this is prevented by linking pin 11 to pi n 12 via an inv erter. ■ Clear to sen d, pin 13. After the terminal has given an RTS signal this input goes low to indicate that the modem is ready to begin transmission. ■ Back clear to send, p m 14 . This pm ha: the same function as CTS except that i is for the back channel in V23 mode. ■ Transmitted data, pin 10. The data that must be transmitted is presented to thi input. ■ Back transmitted data, pin 28. Data that must be sent via the back channel is fed to this input. This is only possible in Bell 103 Originate 300bps full duplex Bell 103 Answer 300bps full duplex Bell 202 1200bps half duplex Bell 202 with equalizer 1200bps half duplex CCITT V.21 Orig 300bps full duplex CCITT V.21 Ans 300bps full duplex CCITT V.23 Mode 2 1200bps half duplex CCITT V.23 Mode 2 with equalizer 1200bps half duplex CCITT V.23 Mode 1 600bps half duplex Bell 103 Orig loopback Bell 103 Ans loopback Bell 202 Main loopback Bell 202 with equalizer loopback CCITT V.21 Orig loopback CCITT V.21 Ans loopback CCITT V.23 Mode 2 main loopback CCITT V.23 Mode 2 with equalizer lor CCITT V.23 Mode 1 main loopback CCITT V.23 Back loopback V23 originate mode, otherwise BTD must be T. ■ Received data, pin 26. The data re- ceived by the modem is available at this output. ■ Back received data, pin 15. Data re- ceived by the modem on the back channel in V23 answer mode is available at this output. ■ Carrier detect, pin 2S. When the carrier wave is present at the input of the m odem this pin is low . ■ Back carrier detect, pin 27. This pin has the same function as CD except that in this case the earner is received on the back channel in V23 answer mode. The RS232 section of the circuit is seen at the upper left-hand side of the circuit diagram, complete with the 25 pin D-type connector. Details about both connectors (K1 and K2) are contained in table 2. Some of the pins (2, 4, 14 and 20) are connected to IC1 via an RS232 to TTL-level converter (R3...R6, D3...D6) and four three-state in- verting buffers (to convert to the active low levels required). Signals from IC1 to the RS232 connector are inverted and con- verted to RS232 levels by op-amps A1...A6. There is no need for any level conversion in the case of the second connector but four three-state buffers are included after the inputs, pins 1, 2, 9 and 10. Remember that the output pins in the TTL connector have exactly the same signals as the out- puts of IC1 and some of these are active low. Note that pin 3 in the TTL connector must be connected through to pin 8 (ground). When a connector is inserted into this TTL socket the input signals are fed to IC1 via N17...N20 and three-state buffers N13...N16 make the RS232 inputs high impedance. If both connectors are inserted into the modem K2 (the TTL con- Table 1. All the variou! different possible com municatlons standard: that the AM7910 can handle are indicated ii this table. Selection is nector) will therefore always have priority. When the UART, IC19, is converting a character from 1200 to 75 baud pin 7 of K2 feeds a busy signal ('0') to the terminal so that it will not transmit any new data. As soon as the transmitter buffer is empty TBMT (pin 22) goes high. The four LEDs are used to indicate various conditions: main channel carrier present (Dl), back channel carrier present (D2), incoming data on main channel (D3) and incoming data on back channel (D4). The baud rate converter, formed by IC18, IC19 and ES1...ES8, is only used in V23 mode. The clock signal provided by T1 is reduced to frequencies of 19,200 Hz (output Q7 of the 4040) and 1200 Hz (out- put OH)- These frequencies are sixteen times as high as the transmission rates of 1200 and 75 baud because the UART needs a clock frequency sixteen times as high as its transfer rate. The electronic | "S232/V24 TTL-port m " odem .; Received Data Request to Send Clear to Send Data Set Ready Signal Ground Back channel Data Carrier Detect Back channel Clear to Send Back channel Transmitted Data Back channel Received Data Data Terminal Ready RS232-TTL port 1.37 switches are used to ensure that the data travels in the right direction. When a back carrier is detected the 1200 Hz clock is used for inputting data and the 19,200 Hz clock for outputting data. The back chan- nel data is fed to the serial input of the UART, whose serial output goes to the ‘back transmitted data’ line in the two con- nectors. Characters are therefore input via the back channel at 75 baud and output at 1200 baud on the main channel. Data may also travel in the other direction on the two channels if the two clock connections as well as the serial input and output are interchanged. The 1200 baud data that the terminal wants to send on the back chan- nel is now converted to 75 baud data by the UART. While it is doing this IC19 feeds a busy signal to pin 7 of the TTL connec- tor. This conversion works for both con- nectors and has the great advantage that the terminal need only work with data at 1200 baud. This whole conversion section is not used at all when the modem is operating in V21 mode. The next section we will deal with is the switching logic based around SI. Using this switch MC0 or MCI or both can be grounded. This gives a choice of four dif- ferent modes: 300 baud originate, 300 baud answer, 1200 baud originate and 1200 baud answer. LEDs D10...D13 indicate which mode has been selected. For 1200 baud transmission and reception only MC0 is zero. The change from trans- mission to reception, or vice ver sa, is made by switching the RTS and BRTS level (via N8, N31 and N9). Whenever a new switch position is selected the circuit aroun d A7 and N30 supplies a short pulse to the DTR input of IC1 in order to reset this chip. The bell detector section, which also takes care of the switching between telephone and modem, is quite extensive. The transmit and receive inputs of the AM7910 are connected to transformer Tr2. Although outgoing TC signals do not pass through IC22, incoming signals cure amplified by this op-amp before being passed through to RC. The other winding of the transformer is connected to the telephone network via relays Rel and Re2. In the output mode (when neither relay is operated) the telephone is linked to the line connection. Part of the reason for this set-up is to enable the telephone to be used normally when the modem is switched off. Whenever the power is switched on flip-flop FF2 is reset with the result that the selector circuit (N4...N6, N21, N22, N26, N27 and MMV2) will automatically select the ‘telephone’ pos- ition and neither relay will be operated. A relay can then only be operated when a different position is selected with switch S2. When this happens N22 triggers MMV2 and this monostable then sends a set pulse to FF2 causing it to deselect the obligatory (‘telephone’) position. If the ’modem’ position is selected R1 is operated via N5 so the telephone is disconnected from the line. At the same time FF1 is set and Re2 is then operated Resistors: R1. . R6.R11.R12.R15. R21 . R27.R31.R32.R45. R55,R59,R60.R61 = 4k7 R7,R8,R13,R14,R33. R49 = 220 Q R9 = 680 k RIO = 120 k R16.R50 = 1 k R17.R18 = 2k7 R19.R20.R40.R41 = 22 k R28 = 18 k R29 = 15 k R30 = 1 M R34.R57.R58 = 2k2 R35 = 100 Q R36 = 33 k R37.R38.R46...R48. R51 = 100 k R39 = 390 Q R42 = 39 k R43.R44 = 8k2 R52 = 4M7 R53 = 82 k R54 = 470 k R56 = 56 k Capacitors: Cl = 4p7/6 V C2.C3 = 470 n C4.C15.C27.C28, C31...C35 = lOOn C5 = 10 n C6.C7.C16.C17 = 1 n C8 = 39 p C9 = 120 p CIO = 10 p/6 V Ta C11. C12 = 47 p C13 = 47 n C14 = 10 p/6 V C18 = 100 n/400 V C19 - 2p2/6 V C20 = 1 p/6 V Ta C21 « 22 p/16 V C22, C23, C25 = 1000 p/ 16 V (preferably C24.C26 = 1 p/6 V C29 = 2p2 MKC C30 = 220 n Semiconductors: D1.D2.07.D8.D10. . . D13, D19...D21 = LED. 3 mm D3...D6 = 4V7/400 mW D9.D14. . D18, D40 = AA119 D22...D24.D27.D28.031, D38.D39 = 1N4148 D25.D26 = 5V6/400 mW D29.D30 = 27 V/400 mW zener D32. . . D37 = 1N4001 T1 = BC547B IC1 = AM7910 (AMD) IC2.IC3.IC23 = 74LS05 IC4.IC5 = 4538B IC6.IC7 = 4013B IC8 = 74LS366 IC9 = 74LS365 IC10.IC12 = 4071 B IC11 = 4081 B IC13 = Till 11 IC14 = 7805 105 = 7905 IC16.IC17 = 4066B 108 = 4040B 109 = AY-3-1015D IC20.IC21 = TL084 IC22 = LF356 Miscellaneous: FI - fuse, 500 mA, complete with PCB- mounting fuse holder K1 = 25-pin D-type connector, female 90° K2 = 15-pin D-type connector, female 90° LI = coil, 10 pH Re1.Re2 = miniature 5 V Trl = mains transformer, 8 V/375 mA Tr2 = line transformer, type VLL3719 XI = crystal. 2.4676 MHz in HC18 package Case = Retex Elbox RE.3 Hmhof-Bedco Standard Products Ltd.) Heatsink for 104 1 off telephone plug and via N7. The line is then connected to Tr2 and the modem can operate via the telephone network. In the ‘auto’ position only Rel is operated (via N6) so in this case the line is linked to opto-coupler IC13 via Rll, C18, D29 and D30. The telephone is now switched off but if a bell signal (about 75 V a.c. at 25 Hz) is detected the LED in the opto-coupler lights and causes the photo transistor to conduct. As long as the bell signal is present for at least the RC time of R55 and C19 MMV3 will be triggered. This feeds a clock signal to FF1, which, in turn, operates relay Re2 to connect the modem to the line. At the same time the modem receives a RING signal via N35 so IC1 initiates a procedure to find out if there is another modem connected to the line. If the carrier disappears in the course of a transmission this is detected by the action of N25, MMV1, FF3, FF4 and MMV4. If the carrier is absent for more than about a half second, or if the second modem does not transmit any carrier at all, the connection is automatically broken. The power supply section is unremark- able. A pair of voltage regulators provide the necessary + and —5 V. Note that the transformer in the power supply will become warm in use; this is quite normal and nothing to become alarmed about. Construction Great care should be exercised when building this modem as it will be con- nected to the telephone network. The component overlay shown in figure 3 indicates where everything should be fit- ted, in the usual order. The relays are soldered directly to the printed circuit board. When all the components have Figure 3. The printed ci cuit board for the mod is quite crowded but tf does help keep the size small. The actual layou of the copper tracks is not shown here as the board is only available direct-coupled modem been mounted on the board the case must be prepared. If the LEDs are fitted directly into the front panel each will require a hole of 3 mm diameter. If clips are used the holes should be 4.5 mm diameter. Suitable holes must also be drilled for the rotary switch spindles. The diameter will depend on the type of switch used. A number of holes and slots must be cut in the back of the case for the mains cable, telephone cable, two connectors and mains switch. The old carpenter’s maxim of 'measure twice and cut once’ is very appropriate here. After sticking the adhesive front panel to the case the LEDs and rotary switches can be fitted. There is no difficulty in wiring switch S2 as this is simply a matter of con- necting it to points 10, 11, 12 and + on the board. The anodes of LEDs D19, D20 and D21 are linked together and this junction is then wired to point 9 on the board. The | cathodes are connected to points 6, 7 and | 8 respectively. Wiring SI requires slightly more attention. The contacts of the switch must be connected to points 2, 3, 4 and 5 and to the cathodes of LEDs D10...D13, and the common pole is connected to ground. The anodes of the remaining four LEDs, Dl, D2, D7 and D8, are first linked together and this common point is then fed to the + point on the board. The cathodes connect to points Dl, D2, D7 and D8. Table 3. A number of dif- can be selected using DIL switches S4 located beside the UART chip IIC19I. The mains cable can now be connected, via S3, to the board. The power can then be switched on and the voltages checked. If both positive and negative 5 V supplies are correct the power can be switched off I again and the ICs (with the exception of IC1) inserted into their sockets. When the power is switched on again the ’telephone’ LED beside the leftmost switch lights, and only when the switch is operated will a different LED light to indicate the position selected. The logic levels appearing at pins 17 and 18 of IC1 can be measured at SI for the four pos- itions that can be selected. The table in the margin here indicates what the levels should be. If this is correct the power can be switched off again so that IC1 can be inserted into its socket. Be careful when doing this as the AM7910 is an expensive IC and it can easily be damaged by static. Connect a telephone to the ‘line’ connec- tion and select ’MODEM' with S2. (The white and blue wires in the telephone cable are connected to the points marked ‘phone’ on the board and the red and green wires go to the points marked ‘line’.) If SI is now switched a peep tone should be heard (after a few seconds delay) for each of the four positions. The AUTO ANSR' position is then selected with SI. Link pins 4 and 5 of IC13 (the opto-coupler) via a 1 k resistor and a tone should be heard for about 10 to 15 seconds. This should happen for all pos- itions of S2. The tone's pitch varies gradu- ally but this may not be noticeable in all positions. ‘MODEM’ is again selected and pin 2 of the RS232 connector is connected to —5 V. A change in pitch should be heard. This applies for the two 300 baud and the 1200 baud answer positions. For 1200 baud originate pin 14 is connected to —5 V via a 1 k resistor instead and this pin is then touched with a finger. Finally pin 20 is connected to —5 V and then no tone should be heard. If all these tests are cor- rect then you can assume that the modem is working. The operation of the circuit can be more carefully checked using an oscilloscope. To measure the output voltage start by disconnecting the modem from the telephone and connect a load of 600 Q (560 Q in series with 39 Q) across the ‘line’ terminals. There should be an a.c. voltage of 275 mV^s across this load. Next test to see if the right frequencies are being produced: V21 ORIG: space = 1180 Hz mark = 980 Hz V21 ANSR: space = 1850 Hz mark = 1650 Hz V23 ORIG: space = 450 Hz mark = 390 Hz V23 ANSR; space = 2100 Hz mark = 1300 Hz The frequency of the reply tone (except for V21 ORIG which does not give any reply tone) is always 2100 Hz. The start-up cycle can easily be followed on the oscilloscope: first there is 1.9 s of silence, then a reply tone for 3 s and then the mark or space tone. The modem can now be placed into its case and the wiring tidied up but do not close it just yet. The DIL switches still have to be set: refer to table 3 to find the correct settings. Using the modem One point we have not yet mentioned is the communication between computer and terminal, which is very important because if this is not correct there is no way data can be transferred properly. This presupposes that the connection between computer and terminal will be a serial one. With a real terminal this is taken into account so all that is needed is an RS232 cable as the necessary communication software will already be available. The 11.40 Elektor universal terminal described in microprocessor (and remember to con- the December 1983 issue is an example of this. There is another possibility if you have a computer with an RS232 interface. The computer’s handbook should advise about the signals present at the various pins of the RS232 connector and the soft- ware used to drive the interface. Some computers with an RS232 interface even allow operation at 1200 and 75 baud, which does away with the need for the baud rate converter in the modem. In this case IC16...IC19 can be removed and wire bridges can be used to connect pins 2 and 3 and also pins 9 and 10 of the IC16 socket. Some computers, unfortunately, do not have any serial connector so for these computers the only thing to do is to make a parallel port and write a small machine code program to control it. We will deal with this latter point in a very general sense to give an idea of how to go about writing this routine but each user will have to 'tune' our ideas to suit a particular machine. If this seems like a daunting task you may be lucky enough to find somebody in your computer club or user's group who already has such a routine. It may be better in any case to use an existing program if it is available as it is very important to standardise as much as possible when transmitting data over the telephone lines. The first thing to decide is what format the character will have. The most common format uses 8 data bits for the character, preceded by a start bit (which is always ‘0’) and followed by a stop bit (which is always T). If no data is being transmitted there is always a T on the line. The build- up of this sort of character is shown in figure 5, from which it is clear that bit 0 is transmitted first and bit 7 (the highest bit) last. In the Elektor modem transmission rates of 300, 1200 and 75 baud are poss- ible. Other points to note are: ■ Use a parallel I/O port on the 5 nect pin 3 of the modem’s TTL port to ground, pin 8). ■ Initially the control signals are not used. The modem itself switches automatically to ‘transmit’. ■ One bit in the port is used as serial input and one bit is used as serial output. ■ At the modem side the TTL-compatible port is used. ■ The serial to parallel and parallel to serial conversions are carried out by means of a few software loops (with the necessary shift operations). ■ It may prove advantageous to introduce a small change into the system to jump to an interrupt routine whenever a start bit appears. This is can be particularly useful in conjunction with scrolling. ■ Ensure that the bytes read in are written to the correct memory locations. ■ The output driver often ends with a RAM memory address and a RETURN. The address of the modem output driver is then stored at the position indicated by this return. ■ The stop bit must not be used for test purposes as this costs too much pro- cessor time. ■ Not all terminals can work with full- duplex but as long as this is taken into account at both ends of the telephone line it is not a problem. These are the basic guidelines to keep to when writing the machine code routine. We have purposely not dealt with certain points such as recognising specific ter- minal commands as these are not necessarily standard. Note, however, that the busy line in the TTL port can be used when the UART is making a conversion from 1200 to 75 baud. An alternative for the parallel to serial conversion is to use an ACIA just as the 6551 was used in the CPU card published in Elektor in December 1983. This sort of terminal or modem program can be as basic or as extensive as any particular user wants provided both sides of the line keep to the same protocol. Deciding this protocol within a user’s group will make standardisation of pro- grams for any processor much easier and will facilitate the exchange of data. M The advances in electronics and, in particular, the push towards ever greater miniaturisation means that our lives are becoming more and more filled with battery-powered radios, clocks, cassette recorders, calculators and so on. It is very often a matter of guesswork to know how long the batteries will last as it is not possible to estimate a dry cell's capacity simply by looking at it. This battery meter simplifies matters considerably and, as it has been kept as uncomplicated as possible, the price is low enough to make this circuit a very attractive proposition. battery meter indicates the approximate capacity of a dry cell The more battery-powered equipment we use the more difficult it becomes to remember how old all the various bat- teries are. All the various aspects of Murphy's Law come into the equation and just in the middle of an important recor- ding the batteries in your cassette recorder give up the ghost. (The law of conservation of energy immediately starts working, of course, with you rushing around trying to find some good batteries thereby compensating the universe for the energy no longer supplied by the bat- teries.) With all due respect for the Laws of Life it is a bit annoying not knowing the capacity remaining in a battery. A battery ‘contents' meter is what is needed but this is not quite as simple to implement as it might appear at first sight. The first thing that must be determined is how the battery capacity is measured. Looking for an answer to this question we note that batteries can be divided into two broad types. The first type consists of bat- teries that supply an almost constant voltage during their whole life. Examples of this type are lithium, mercury and silver oxide batteries, all of whose voltage drops so little (about 0.05...0.1 V) that it is virtually impossible to measure the remaining | capacity as a function of the output voltage. Other methods are too com- plicated to enable a measurement to be made quickly so we must conclude that there is no simple way to estimate the contents of these batteries. This type of battery is used mostly in watches, calculators and cameras and, as the leakage is so small (only a few percent per year), it is probably best to leave the battery in the equipment until it fails and keep a replacement close at hand. The second group of batteries includes the carbon zinc and alkaline manganese types, the first of these being much cheaper and more common. Most 'normal' batteries sold in the shops are carbon zinc types but recently the alkaline manganese types have been gaining popularity. The reason for this is that they last longer, which, the consumer hopes, makes up for the higher price. Both of these types display a marked voltage drop during their lifetime and this fact can be used to determine the capacity remaining in the battery. To do this we need a voltage meter that can provide fairly accurate measurements in the range of 1...1.B V (per cell) and a suitable load (in the form of a resistor). This resistor is necessary to enable the terminal voltage of the battery to be determined at any point in its life, knowing that the internal resistance increases with decreasing capacity. 1 The meter As we stated at the beginning of this article the layout of this circuit is very simple. The method used does not give a perfectly accurate indication of the remaining capacity, but this was never the intention and it is hardly needed consider- ing that the batteries in question are themselves not very accurate. Further- more, accepting this slight 'imperfection' makes our task much easier. The circuit for the battery meter is shown in figure 2. The load for the battery to be measured is provided by resistors R1...R6. The load cur- rent is based on the IEC’s so-called radio test. This gives about 20 mA for HP11, HP7, 'duplex' and ‘normal’ types, 40 mA for HP2 11.42 and about 10 mA for a PP3 9 V power pack. Alkaline manganese batteries are now being offered as an inexpensive alternative for silver oxide types so our meter includes a position (with a load cur- rent of 1 mA) to enable these cells to be tested. The meter section consists of Ml. D1...D6 and R7...R11. A normal 100 ^A fs.d. moving coil meter is used for Ml. A single diode (Dl) and resistor (R7) are in series with the meter when measuring 1.5 V bat- teries. With the values shown the meter deflects fully at a voltage of about 1.6 V. The diode provides a threshold so that the measuring range of Ml lies from 0.6 to 1.6 V. This suits our purpose admirably as the voltages that interest us are from 1.5 V down to 0.8 V. This latter value is gener- ally held by the battery manufacturers to signal the end of an alkaline manganese cell's life; the corresponding value for car- bon zinc is 0.9 V. This range may seem to be a bit limited given the different batteries we need to measure but the difficulty is overcome by ‘spreading it’ over almost the whole meter range. Different battery types are catered for by changing the resistance (from a minimum of 8k2, R7 only, up to a max- imum of 49k3, R7...R11) and the number of diodes in series with this (from one, Dl, up to six, D1...D6). The result of this is to change the effective range of the meter so it always shows a relative value (the ‘con- tents' of the battery) rather than an actual one (the battery voltage). Without a scale the meter is useless, so a scale suitable for Ml is given in figure 3. The white section indicates that the bat- tery still contains more than half of its maximum capacity, grey shows that the battery is between half and completely empty and a reading in the black end of the scale can mean only one thing: the battery is flat. Two scales are shown: one for carbon zinc and the other for alkali n e manganese. For those of you interested in specific values, we classify ‘half full' as 1.3 V for carbon zinc and 1.2 V for alkaline manganese. The 'empty' points are 0.9 V and 0.8 V respectively. The battery meter is as simple to use as it is to make: connect the battery to be measured to the circuit’s terminals and see if the meter deflects. If not either the battery is flat or its polarity is incorrect. In the latter case Ml is protected by Dl. If the meter does deflect the test button must be pressed to connect the load across the battery. The reading on the meter then clearly shows the remaining capacity of the battery. H I Note: more information about batteries can be found in infocard 62. etekior mdia november 1984 1 1 .43 Nobody can seriously claim that the continuing progress in the field of electronics and computers is neither necessary nor useful. Progress rarely comes without any drawbacks, however, and, particularly as regards computers, this often manifests itself as new equipment not retaining compatibility with older machines or standards. One of the most frustrating aspects of this incompatibility is the difficulty encountered when trying to use some peripheral equipment with a computer where one of these has a parallel and the other has a serial port. This interface is designed to counter just this difficulty, thus making it easy to interconnect an RS232 and a Centronics port. RS232 / Centronics converter a serial to parallel and parallel to serial converter. . . with handshake lines Characteristics RS232 - Centronics converter with handshake signals. Parallel to serial mode ■ buffered Centronics input Strobe/Busy/ Acknowledge ■ RS232 0 V/5 V or - 12 V/5 V output Data Terminal Ready input Serial to parallel mode ■ RS232 0 V/5 V or - 12 V/5 V input Data Terminal Ready output ■ buffered Centronics output Strobe/ Busy/ Acknowledge Format of the serial data —5,6.7 or 8 data bits —parity enabled/disabled -1 or 2 stop bits -error signals (parity, format and overflow) Transmission speeds -Two different speeds can be used during simultaneous parallel to serial and serial to parallel conversions. -75 - 109.9 - 135 - 150 200 - 300 600 - 1200 - 1800 - 2400 - 3600 4800 7200 - 9600 the flip-flop alternately indicates that the serial to parallel converter cannot receive any new information and then, after the converted data has been accepted by the Centronics peripheral, that the converter can again accept serial data. The format of the data during transmission (number of data bits, stop bits, etc.) can be pro- grammed by means of switches S1...S5. Any errors detected during the conversion are indicated by LEDs D12...D14. Glancing at figure 1 we notice input buf- fers N1...N9 and output buffers N10...N18 for the Centronics interface; figure lb shows the oscillator used to generate the various different transmission speeds. To get a clear idea of the operation of the converter it is essential to study the in- ternal structure of the AY-3-1015 UART (IC2) so we will have a quick look at that. The basic blocks making up the UART are shown in figure 2. There is a block The value of this parallel to serial and serial to parallel converter will be obvious from the list of characteristics given in the table here. A look at figure 1 shows that most of the various parts and functions are fairly self-evident so we will concentrate instead on a number of specific points. Points to note The serial output (pin 2 of the RS232 con- nector) and the DTR output (Data Terminal Ready, pin 20 of the RS232 connector) are switched by normal current sources (T1 and T2). Their low logic level can be changed by the user to suit the peripherals in use. (We will return to this point later.) The DTR output is controlled by flip-flop N23/N24, which itself is fed by the DAV output signa l (pin 19 of IC2) and the Cen- tronics ACK or BUSY signals. In this way 1.44 elekio* inaia november 1984 1 1 .45 line with it. This indicates to the peripheral that the converter has correctly received the data. If new C BQ-jt- Q W5DO ! LoEM oH[-o-o*c 5 >*o -