You are on page 1of 52
Wer eee THE INTERNATIONAL ei , AN ise? = Meise siyoe EVEKTOR) paint fui CONTENTS pintetiet “The second and final batch of prize winning designs lay seovains {in our international design competition can be found Invariably require large Septet oh ean Semianen Got 53 Microcontroller switching clock RTC56 16 Mbytes of pea By i Schacter generally accepted asa | 57 Hybrid headphones amplifier minimum for Windows By W. A. van Pelt 95: run smoothly on, | 60 PC-controiled battery tester say, a multimedia By R. Mohrlock PWM signal generator By Fabrice Baudoin 64 Intelligent motor control for R/C models, By A. Voggeneder and A. Nader ‘Green power’ By Joachim Kircher Pentium machine. A vast memory tn your re 4s great, but what do you do when it does not | gy ‘work all of a studden? To be stuck with a memory error during a Tey roads warning p.7 b ce joot-uIp sequence is a frustrating and 40 PROJECT: Passive VU meter disheartening Design by T. Giesberts experience. Moreover, finding the faulty rast en oopcssset chip is invariably a daunting task. Upto | 10 PROJECT: [°C interface for Centronics port now, that is, Design by H. Zanger! 74 COURSE: Hands-on PLC programming ~ Part 2 Pemeon a tees Software by J. Jostens present a tester that rans a thorough check fon most types of sie in nents use today. 7 PROJECT: Iey-roads warning Design by K. Walraven 44 PROJECT: Wave-sound generator Design by K. Walraven | Pas aecnneeeen ce) 30 PROJECT: FM receiver in SMT Design by I. Lemmens eur 18 PROJECT: SIMM tester Design by A. Rietjens 48 Measuring capacitance by Dr K. C, Rohwer een Copyright© 1996 Segment BV 82 Index of advertisers 70-72. Readers’ services Passive VU meter~p. 40 “letorEletronicxspobibed monty, excep in Angi, by Bekor Electronic (Publishing), RO. Box Hs, Dowcheser Dorset DT2 YH, England. The maga ovale fom newsagents, bookshops, and elsctoncs ret oats. oon subscription tan anna (1996) pos aid pie of €30C0 inde United Kingdom: a pe £€38.00in Europe, £47-0in Afi, the Middle East an South Ameri £440 Ausra, New Zealand ad the Fat Eas: and SUS 64.0 inthe USA an Canad, Second Chass Postage pai at Rabway NJ. Postma: please send adress coretions to EleKor Eesti, ef Merry Airreightlnerationl In, 2323 Randolph Avenve, Avenel, New Jersey NJ. 07001 ELEKTOR ELECTRONICS FEBRUARY 1996 ICY ROADS WARNING Winter landscapes may be beautiful, but winter weather can be treacherous for motorists: the difference between wet and icy roads is not easy to see, particularly in the dark. The circuit described measures the temperature just above the road sur- face and gives a warning when this gets close to freezing point. A useful instrument for any car. Design by K. Walraven _Axiemy a2 September (pari in northern Europe and C: there is a likelihood of icy roads, espe cially late at night or early in the ‘morning. These may oceur in certain locations only: when you leave home, all looks well until 10 miles further on you take a bend at your usual speed and find the car's wheels drifting: a potentially dangerous situation, The risk of it arising is lessened by the cir cuit deseribed. The outside tempera. ture is monitored by a sensor close to Fig. 1. The circuit of the iey roads warning unit is an example of design PLEKTOR ELECTRONICS FEBRUARY 1996 plicity. The temperature is formed by a resistor with negative temperature coefficient and the display consists of two the ground and a warning given to the driver when the temperature drops, or Is, close to zero. A salety margin is built in, since it fs clearly impossible to monitor the actual road temperature, which may be below freezing point. whereas the air just above it is still above zero. ‘This is achieved by mounting the sen sor as low as possible, for instance, inside one of the bumpers, and setting the border line between ‘sale’ and “un: safe’ at. say 3 °C (38° F). When the temperature is above that level, a green LED lights, if it Is below it, a red {ep lights. Optionally, an audible warning may be given in the latter Circuit description From the esreutt diagram in Fig. 1, st is seen that the design is straight ward. The temperature sensor is formed by Rj, a resistor with negative temperature coefficient (NTC), which is connected to Ky "The sensor is part of as bridge cir: cuit; the other parts are P), Ry. and Ry, The benefit of a bridge circuit is that both branches are affected equally by voltage variations, which makes their combined effect negligi le. The junctions of the bridge are linked to the inputs of comparator ICj,. Capacitors C; and Cs suppress any spurious voltages. A resistor with NTC has the prop: erty that its resistance rises when the ambient temperature drops. When the temperature falls below a set value, the resistance of R will exceed that of Pj. In that ease, the potential at the non-inverting (+) input of IC), be comes higher than that at the invert ing (-) input. The voltage at the -input 4s set to half the supply voltage, Up, by Ry-Ry. The output of the comparator is logic low at (relatively) high tempera tures, causing the green LED to light and logic high at (relatively) low tem: peratures, resulting in the red LED lighting. ‘The Indicator LEDS are low-current types that light brighuy at currents as Iow as 1 mA. This ts right, because the output current of the op amp is muted to about that level. It can pro vide a current higher than 1 mA, but this is at the expense of the accuracy of the output signals The audible warning signal is gen erated by the (optional) remainder of the circuit. When the output of IC, becomes logic high (low temperature}. transistor T; is switched on via Ry, and this energizes the buzzer. This is, 8 GENERAL INTEREST Fig. 2. The printed-circutt for the ey roads warning unit is available through the Readers Services (p. 70) however, not actuated until Ty is also switched on. This cannot happen until five seconds after the supply has been switched on: the time taken for Cp to be charged via Rg. When the potential across Cy has risen to half the supply voltage, the output level of IC, will change from logic high to logic low. This causes Ty, which until then con- duets, to be cut off, so that the buzzer cannot be actuated. Thus, in case of the temperature being below 3 °C, the buzzer will sound for five seconds after the supply has been switched on. This time period may be length- ened by increasing the value of Rs and Cp, oF shortened by reducing the com- ponent values, Diode Dy is a protection against po- larity reversal of the battery voltage connected to Ky. Resistor Ry and capacitor C3 pro: vide additional smoothing of the supply voltage, which Is beneficial to the reliable operation of the unit. Construction ‘The unit 4s best constructed on the printed-eireuit board shown in Fig. 2. ‘The board is small, yet provides ample space for the components. The terml- nal blocks are for connecting the sen. sor and the supply voltage. The IC should be fitted in a suitable socket. Make sure that the diodes, Laps and electrolytic capacitors are con- nected with correct polarity. which is also important in case of the (optional) ‘buzzer. In the latter ease. the + Lermi nal is usually indicated on the case. When the board has been com pleted, connect it to a supply of 13.8 V {nominal level of a car battery), and check the various voltages indicated in Fig. 1 with a (digital) multimeter, Note that the voltage at junction Ry-C should be about 12.8 V in quiescent operation; it drops to about 11.8 V when the buzzer sounds. It is important that the potential at pins 2 and 5 of IC; Is as close as pos: sible to half the supply voltage. ‘The current drain from the supply is a useful indication as to whether the circuit operates correctly or not. In quiescent operation, it should be about 10 mA and rises to about 50 mA when the buzzer sounds. ‘The correct operation of the elreutt can be checked without Ry. When Kj is open, the input impedance is intl nitely high, The circuit ‘sees’ this as a low temperature, so that the red LED should light. Ifthe buzzer is used, this should sound when the suppiy is switched on. If then the terminals of K, are short-circuited, the green LED should light. GRADE A Calibration and use Before the unit can be built into a suitable case, P; must be set for the desired temperature. To that end, connect a 12 V supply to Ky and link Ry to Kj via a good length of flexible 2 way cable. ‘Adjust the thermostat in a fridge to rather lower than usual (4-8 °C) and afier an hour so, check that the tem perature is about 3 °C. When this is So, put the resistor into the fridge. close the door over the thin cable and let let the sensor acclimatize for about Ave minutes. Then adjust P, until the red LED just lights. This completes the calibration, The unit can then be built into a suitable case, which is preferably, but not necessarily, transparent as shown, In the introductory photograph. A few holes need to be drilled for the supply cable and the cable from the sensor. Mount the unit in an easily seen posi- tion In the car with the ald of one or two pieces of double-sided adhesive tape. The supply is taken from a point after the ignition key. ‘Mount the sensor. preferably on a small piece of aluminium or tinplate. in or behind the front bumper or spoiler, where il is exposed to the out Fig. 9. In spite of the compact size of the board, there is ‘ample space for all components. ELEKTOR ELECTRONICS FEBRUARY 1996 GRADE A side alr and does not get warmted up by the engine. This position is, of course, also conveniently close to the road surface. It is best to twist the two wires of the cable linking the sensor to the in- dicator unit or. even better, to use screened 1wa-eore audio cable. The sereen should be connected to the negative supply line at Ko, If the buzzer is too loud for comfort, stick some adhesive tape across the hole at the top. Parts list Ry P)=47 KO preset Capacitors: 10 PF, 63 V, radial 7 uF. 63 V C= 100 nF Semiconductors: Dy =LED, green, low current Dz = LED, red, low current Dy= INS1a8 Dy = 1Ng002 Ty, Ta = BCS47B Integrated circuits: Ie, = 710272 Miscellaneous: 1), Ky = 2-way terminal block, piteh 5 mm. Ba; = buzzer, 12 V de. Case = to personal requirements ci order no. 960029 (see p. 70) {960029} FLEKTOR RUARY 1996 RONICS F 10 I2C INTERFACE FOR CENTRONICS PORT Many circuits, extensions and modules for the Inter-IC- Communications (IC) bus have appeared in this magazine over the past few years. This two-wire bus designed by Philips allows ICs as well as complete modules such as TV tuners to communicate with each other. The principle of the bus also allows °C circuits to communicate with a PC. Thanks to the circuit presented here, it is no longer necessary to insert a special interface card in the PC. The interface function is now taken over by the easily accessible Centronics (parallel printer) port. That allows even portable computers to make use of the PC bus. Design by H. Zinger] 2¢ represents a communication sys- ‘tem which can greatly simplify the design of complex electronic circuits. Why? Because the FC bus allows data and/or commands to be exchanged be- tween ICs via two or three lines, Considering the increasing use of mi erocontrollers, the C bus olfers a great opportunity to reduce the com: plexity of printed circuit boards, mainly beeause the ICs need to have fewer pins. An additional boon is that the same ICs become cheaper. It 1 therefore not surprising to see many FC ICs and sub-cireuits in today’s video recorders, CD-i players and colour TVs. Although there are computer manu- facturers who design an F°C interface Into their PCs (such as Acorn), nor~ mally an extra interface is required to give a PC access to the °C bus. In an article published in early 1992 (Ref. 1) we described a simple and relatively inexpensive PC insertion card, to gether with a device driver. That com- ination allowed any PC or compatible to be used for the control of host of PC devices and circuits which were subsequently published. The system allowed higher programming. lan- guages such as BASIC and Pascal to De used to access 1/0 ports, memories, switches, clocks, converters and many jore devices, via a three-wire bus. ‘The large number of reactions on this publication gives us every reason to assume that we hit upon a very pop- ular subject. None the less, the inter~ face card had one distinet disadvantage: it was an Insertion card, and could only be used if the computer had a free ISA slot. Is there a simpler way to get on to the PC bus? Yes, we think so, and you can read about it here. The interface proposed in this arti- cle has the same properties as the in sertion card mentioned above. It is also compatible as regards software so that all existing programs may be used, and it is readily connected to any PC sporting a free Centronics port Another interesting advantage is the Jow price, because the circuit board for the present design is much simpler to produce than the insertion card. The approach The circuit diagram of the interface is given in Fig. 1. The actual translation from parallel data into a serial data stream fs performed by IC4, a type PCF8584, This is a pin-compatible. improved, version of the PCD8584 which we used before, The IC receives the information to be translated at its eight data inputs, DBO-DB7. Between these inputs and the PC port sits a type 74HCT245 buffer. To make sure that the information on the databus is always properly defined (as regards logic levels. that is), all eight lines have 4,7-k9 pull-up resistors. ‘The software which belongs with this project arranges the information traffic in the following order: if the computer wants to write data to IC,, the databits first appear on the printer port. Next, a R/W signal is generated via the line marked STROBE. That sig nal enables IC» (G input pulled low), so that the data 1s conveyed, and IC; is switched to ‘read’ mode. A pulse ap. pears on the AUTOFEED line which Is converted into the CS signal for IC, by a network consisting of ICjc. IC, 1Cea, ICuy and Cy-Ris. ‘The circuit which supplies the CE pulse is pretty complex because the ELEKTOR ELECTRONICS FEBRUARY 1996 12C INTERFACE OR CENTRONICS PORT 11 Fig. 1. Circuit diagram of th R/W signal usually arrives before the CE signal. The PCF8584 then operates in so-called 68000 mode, when it does not allow the CE signal to remain ac- tive longer than one FEC clock pulse When a slow computer is used in com: bination with a slow Centronics port the active time of the CE signal easily amounts to a couple of microseconds. ‘The information on the PC bus is then corrupted. Hence, the hardware limits the length of the CE signal to about 1 ys with write operations. With read operations, however. the CE line must remain active until the computer has copied all data. That is why ICjq, (Ch, 1G4a and Cy-Rys are used to shorten the CE signal at the command of the R/W signal while the PC writes, and leaves CE untouched while the PC reads. Reading in two chunks Since the printer port does not have a bidirectional structure, it 1s not possi ble to copy 8-bit data directly from the EC interface to the PC. A trick, haw: ever, does allow data to be conveyed in this direction at reasonable speed. The levels of the control lines ERROR, SE- ELEKTOR ELE RC interface card for connection to the PC's parallel printer port. “T, PAPER EMPTY and BUSY may be read by the PC, and obviously allow four bits to be copied to the PC in one go. Consequently, the full word, ¢ sisting of eight databits, may be con. veyed in two chunks of four bits. This is done via multiplexer ICs, on two clock pulses, under the control of the signal on the INIT line. The R/W signal {generated via the STROBE line) en sures that the outputs of IC) are at high Impedance while data is being read ‘The SI line of the printer port is used to drive address line AO of IC. Via this line it 1s possible to gain ac cess to the control registers of the PCF8584. The internal architecture and the functions of the registers in the IC bus controller are deseribed in the inset. An interrupt signal gener- ated by any of the ICs on the FC bus is, passed directly to ICs, and appears at pin 10. of the Centronics port (Acknowledge). Because the interrupt facility was never used in any of the PC projects published so far, the soft- ware does not provide an interrupt handler. The hardware does, however, support this option. RONICS FEBRUARY 1996 MAIN SPECIFICATIONS °C interface via Centronics port for MS-DOS PCs. 278y or 3784 ‘Supplied on disk with board 6-pin mini-DIN mains adaptor, current 30-80 mA selectable, 1.5 kHz, AV kHz, 45 kHz ‘or 90 kHz Function: Connection: Software: Base address: Device driver: Output: Power supply: °C bus clock: From theory to practice Well you are down to cutting, bending and Soldering at this stage, The copper track layout and component overlay of the single-sided circuit board are given in Fig. 2. The advantages of a single sided board are its low price and the possibility to etch it yourself (the board is however available ready-made 12 COMPUTERS/MICROCONTROLLERS a Fig. 2. Copper track layout and component mounting plan of the single-sided citcult board designed forthe interface. Start by fitting the thirty wire links! through our Readers Services. page 70), The disadvantage Is, well thirty wire links! Start by fitting these It may be tedious, but at least you are sure that they are not overlooked later. Next, fit the IC sockets and the passive parts on {o board. Mount all parts that make up the power supply, and then check the presence of the supply volt age at the proper points on the IC sockets [refer to the circuit diagram to find these points). The supply voltage is provided by a 9-12 V d.c mains adaptor which must be capable of sup plying at least 100 mA. Ifyou have an oscilloscope, use it to check that the oscillator (IC) works. If something is amiss here, use you multimeter in continuity tester mode to eheck out all connections on the board, For this test you should use the IC pins as measuring points and refer ences, rather than the copper tracks on the board, This will enable you to trace a faulty solder joint quite easily Do not, however, push the test probes too firmly into the IC socket contacts, hecause they may lose their spring loading, causing bad IC pin contacts later I everything appears to be in order the ICs may be fitted, and the interface is ready for use, All that Is required at this point 1s the right software and COMPONENTS LIS Resistors: Ri = 8.way SiL-array 4k07 RRS = 4k007 6 1000, R7,R8-= 33002 R9|R10 = 3kQ3 RIT = 100 R12 =2200 RIS = 10k2. Capacitors: C1 = 10nF 63 radial 2,03 = 279 €8,C7,C8 = 100nF (C9 = 150pF ‘Semiconductors: 1,2 = 1N4002 lei 74HCT14 \e2=74HCT2e5 \C3=74HCT157 C4 = PCD8S84 or PCFBS84 \cs= 7805 (C6 =74HC02 (do not use HCT-ver- sion) Miscellaneous: Ki = Centronics connector, PCB mount, engled. K2= 6-way mini-DIN-socket, PCB mount, angled. 3 = socket for mains adaptor. S1= presskey, make contact, CTLS. X1 = quartz crystal 12 MH2/30 pF. PCB and control software on dlisk, ‘order code 950063-C, see page 70. Sofiware also available separately, order code 948202-1, see page 70. Kits and special components for this project available from C-l Electronics, P.O, Box 22089, NL-6360-A8, Nuth, The Netherlands. Fax: (+31) 45 5241877, is available ready disk through tha programmed Readers Services. One driver does it all In principle there are two ways of de loping thi which 18 ta work n conjunction with the present cit cuit, The first alternative ts to write a couple of routines which are to be inte grated into a larger application pro gram. That approach is simple. easity implemented in a program, and. gener ally, fast too, The disadvantage 1s, however, the difficulty you may run into while implementing these routines PKTOR ELECTRONICS FEBRUARY 1996 12C INTERFACE FOR CENTRONICS PORT 13, PCF8584 MULTI-PURPOSE I?C BUS CONTROLLER The PCF8584 is an improved version of the PCD8584, a powerful multi-purpose IC bus controller which acts as an interface between an 8-bit parallel port on a microcontroller and the serial |°C bus. The improvements over the PCD858¢ ‘mainly entail support for the so-called long-distance mode, which, by the way, is not used in the present application. For the rest, these two ICs are fully compatible. ‘The PCD/PCF858¢ supports reading and writing of bytes via the I°C bus, and is remarkably easy to implement in systems based on different types of microcontroller, including the 8048/8051, 80xx processors and Motorola’s 6800. The block diagram of the IC indicates a number of functional blocks. ‘SO, bus buffer. This is the block between the parallel computer bus and the internal shift register. This register is two- fold. The read buffer may only be read, while the shift register may only be written to. SO’, own address. In a multi-master system, this eater holds the adress fo which th ie ree ac ‘eaponde, This addrees may not be 00" because CUTTtityi then the IC goes nto a pasive monitor mode. That mode is relevent in the present i application, however, because the PCF8584 is the only master device on the IC bus. None the Jess, programmers should ensure that a value (but not 00) is written to the IC at power-up. S1, control/status register. This register also room a has a two-fold structure: the status section is read-only, and the control section is write-only. This register is accessible when AQ is logic high. When AQ is low, one of the other registers is ‘addressed. Which one depends on bits ESO, ES1 and ES2 contained in S1:control. The selection is also dependent on the serial interface being switched on or off, This is accomplished by bit SO: 0 means off, 1 means on. With the serial GaliaacaMaedisankaa we interface switched of, registers 0", $2 and $3 amie iieauais may be read and written using E51 and E52, di pep eee S1 may only be written to. With the imerface switched on, registers 50, St and $3 may be read and written using ES1 and ES2. - Consequently, atabytes can only be conveyed ifthe serial interface is switched on, ‘$2, clock register. The clock pulses on the SCL line are derived from the signal atthe CLK Input Bits $20 and S21 in register S2 allow the Bioc diagram of the PCDIPCF8584 from Philips Semiconductors. This IC con- Brogrammer to select one of four clock vers parallel data on a microprocessor bus ino the serial format needed for frequencies: 1.5 kHz, 11 kHz, 45 kHz or 90 kHz. the anao-wire PC bus. The other bits, $22, $23 and $24 enable the clock input to be matched to one of five possible quartz crystal frequencies: 3 MHz, 4.43 MHz, 6 MHz, 8 MHz or 12 MHz. The 12-Mliz option is selected as the default at power-on. 83, interrupt vector. When the controller is used on interrupt basis, iti capable of putting an interrupt vector on to the PC bus. This address is copied on to the bus as soon as the IACK line goes low, and ENI in the St register was set beforehand. This option is not used in the circuit proposed here, and not discussed further. Infact, register $3 is of no significance in the present Centronics-based interface Into higher level programming lan- originally developed for the insertion nicate, i.e., they do not use a device guages, Also, a small change in the card (see above) may also be used in driver. These programs should be used hardware then ofien means that the combination with the present with a Turbo Paseal 5.5 compiler (or software becomes useless, Centronics version. The only condition higher). Additional information, where ‘The most ‘transparent’ approach is is that you replace the old device driver required or useful, may be found in the based on the use of a so-called device with the new one. source code files (*.pas). The directory driver, which gives sofiware access to. ‘The diskette supplied for this pro- 12CP_TP6 contains the same informa: hardware in a defined manner. The ject contains three directories. The di- tion, but for Turbo Pascal 6.0 or power of that approach is already ap- Yectory [2CP_BP contains programs higher parent from the fact that the sofiware which have all code needed to commu- ‘Finally, the directory ?CP_DOS ELEKTOR ELECTRONICS FEBRUARY 1996 Fig. 3. The completed board is connected directly to any MS-DOS PC. AIIFC bus lines {are available on a 6-way mini-DIN socket. contains the previously mentioned de- vice driver, To activate it, include the following statement | in your CONFIG.SYS file: DEVICE = T2CDRIV.SYS bixxx our where xxx indicates the base address of the printer port you wish to use. For LPTI: that will be 378, for LPT2: 278). The parameter 'y’ Is used to set the SCL clock frequency, as follows: 0= 90 kHz 1= 45 kHz 2=11 ki B= 1.5 kHz For example, the setting DEVICE = T2CDRIVP.S¥S 1378 ¢10 Installs driver which makes use of the interface connected to LPTI, and sets a bus frequency of 90 kHz. The software us ready for use after a re- start of the PC. ‘The driver works lawlessly with all PC software published so far in Blektor Electronics. So, all existing PC projects may be hooked up to the present inter- face without any modification. (950063) ELEKTTOR ELECTRONICS FEBRUARY 1996 18 SIMM TESTER width of 64 bits requires a minimum of two PS/2 type SIMMs, The fact that a ‘computer contains several SIMs makes troubleshooting the memory section rather difficult It also happens frequently these days that upgrading to a faster, larger PC involves migrating the useful bits salvaged from an older computer. In that case, a SIMM tester is a very tse ful test device for any computer hard- ware specialist who wants to find out which SIMMS are okay. and which can be scrapped, It should be noted that the present tester can not be used to measure the famous access time (speed’) of SIMMs under test, because that requires spe cialized test equipment. The SIMM tester is fine for a general test, how: ever, on many different types of SIM By the way, the nominal speed of DRAMS Is usually printed on the chips In the form of a type sulfix. Before explaining the operation of the SIMM tester in detail, let’s first have a look at the structure of those memory chips that everyone seems 10 be after these days. Dynamic RAMs Today's computers invariably require vast amounts of memory, ic pants are marked by their 16 Mbytes of DRAM generally accepted as a kind of Peteindous memory deunigy Fresca minimum for Windows 95 to run smoothly on, say, a day technology allows memory capaci- multimedia Pentium machine. Having lots of memory available is, of up te 61, Mbit (2° <4) 10 be in your PC is great, but what do you do when it does not work — 34) are requised! to be able to address all of a sudden? To remain stuck with a ‘memory error’ during such a vast amount of information. To a boot-up sequence is a frustrating and disheartening ae atte Se lr experience, and finding the faulty RAM chip is pretty difficult. jexed. for instance. tn 2 12-bit lor Up to now, because we present a tester that runs a thorough = mat fora 24-bit address width ir ‘The general structure of a dynamite check on most types of SIMM in use today. PA MARCA Pie kei eae fs addressed via a matrix with an equal Design by A. Rietjens number of rows and columns. Consequently, each added address line EMORY in a modern PC consists QUICK SPECIFICATION of dynamic RAMs (with the excep- tion of the cache section). These RAMS ‘Supported refresh methods: are fitted on 30-pin or 72-pin plug-in | SIMMs that ean be tested: RAS-only modules called SIMMs. The 30-pin ver- | 256k x8, x9, X92, *36 - CAS-before-RAS sion is going a bit rusty already, and has a digital width of 8 bits (or 9 bits if Si ee ee pera sed)Te newer 72pin /2_ [2M tn aan a Se acca: A isd ae sare nese its exact type, a PC motherboard may |8M x32, x36 - manual selection of SIMM type Sonia ane oe mace sia wsvaly [16M x8, 19,232,138 “entonv est at on LCD ied special sockets om the board [aM X22, 538._wotert slots Processor wih aus wth of $s Shey ated always have a multiple of four SIMMS |¢an not be tested: “fully buffered test connectors Installed on the motherboard. “The EDO RAMs and 3-V SIMMs - RASICAS read and write cycle mighty Pentium processor with its bus ELEKTOR ELECTRONICS FEBRUARY 1996 fssce|[rooso| tresh addressing of the memory calls. 1. Block diagram of a dynamic RAM. The memory block is ad- ed Via rows and columns. A separate section arranges the re- HE Fig. 2. This timing RAM. quadruples the total amount of mem- ony. Next, row and column addresses may be conveyed on the falling edge with the aid of the RAS (Rew Address Select) and CAS (Column Address Select) signals. In combination with a read or write signal. these two active low signals determine the access to a certain memory location (Fig. 2). Data {s written on the falling edge of the CAS or WR signal (the exact moment is determined by the last active signal CAS in Fig. 2, and WR in Fig. 3} SIMMs and PS/2 SIMMs A SIMM is a small printed circuit board which contains a number of dy- namic RAMS. These RAMS together allow an 8-bit or 32-bit wide data bus to be implemented. If the parity bit is used, the width becomes 9 bits or 36 bits respectively. The dynamic RAMs themselves may be types with a width of one or four bits. So, a SIMM of the "IMx9" type may come as a PCB With nine or three chips on it ELEKTOR ELECTRONICS FEBRUARY 1996 oa a3 beer Bean is aan io On 8-bit (or 9- oe bit) stm, the |} oop, RAS and CAS || paar mes of the |} Basi DRAMS are con- nected in parallel, and bonded out as two control lines. With PS/2-type SIMMs firs SIMMs with 72 pins). parallel busing is done per byte, to which the parity bit ts added (if applicable). In this arrangement, each byte has a sep: arate CAS line (CASO through CASS). while RAS is applied for every two byles (in the order RASO, RAS2. RAS and RASS). If RASI and RASS are used, two DRAMS are connected in parallel, This is indicated by DRAMs fitted at both sides of the SIMM board. The schematic structure of such a board ts shown in Fig. 3. Note that the address lines have been left out for the sake of clarity. 2a: bir Sid Fig. 3. Schematic structure of various SIMMS In use today. For c ity’s sake, address lines are not shown. 19 SIMM TESTER ie Diy CxS AS ou Mt seas RS ve PS fro xs AE ve om C05 PAS pow M2 Tro eas Ras pe The reliability of today’s. memory chips is such that there is almost no point anymore in using parity. Hence, ‘some types of PS/2 SIMMs have a par- ity simulator which replaces the actual parity chip. Unfortunately, the parity function of these PS/2 SIMMs can not be checked with the present SIMM tester. That is because the parity bit is multiplexed with databit D7. So, al though these bits may be read individ- ually, they have to be written to at the same time, i.e, with the same data. 20 COMPUTERS/MICROPROCESSORS, a um) ee iat saad eee ‘CAS BEFORE RAS HIDDEN REFRESH Fig. 4. Currently used DRAM refresh methods. Qa EEE DOOOGEEEE BOGE te OF crepe EE we. EY cragiomn So oa The refresh story In contrast with static RAMs which are capable of retaining data by them- soowreane | selves after a write operation, the snow memory cells of dynamic RAMs have \o g-couwnn | be refreshed al certain intervals to pre vent them losing stored information. Depending on the exact type, DRAMS require a certain minimum number of refresh cycles per unit of time. The re fresh rate may vary from a modest Fas onty 256 cycles per 4 ms right up to ed, 4,096 cycles per 64 ms, Basically. three methods are available to gener: ate a single refre CAS-before-RAS This type of refresh makes use of a re fresh counter built into the RAM. The counter is incremented after each CAS-before-RAS command, and per forms the refresh automatically. As ih lustrated in Fig. 4, this command consists of a RAS pulse embedded in a CAS pulse, Without a special con. troller or additional hardware, such a combined signal is difficult to generate efficiently by software only. TEST SOCKET Hidden refresh Hidden refresh is like RAS-before-CAS inas far as an extra RAS pulse fs con- cerned which is appended to a normal read or write cycle. Here, too, use is made of the ternal refresh counter. ‘This (ype of refresh is only possible if the RAM is continuously addressed ‘each memory cell in a SIMM or PS/2 SIMUL Fig. 5. Block diagram of the SIMM tester. The circult is capable of checking the operation of Hidden refresh is now a thing of the past, and the newer generation of RAMs no longer supports this tech- nique. ‘The SIMM tester is capable of generating the ‘CAS-before- RAS’ as well as the ‘RAS-only’ type of refresh cycle. To make sure that the time spent on DRAM refreshing remains wit limits, a dedicated piece of hardware has been added: ICS. This multiplexer passes either the RAS selection for IC4a, or connects all RAS lines to the controller's PSEN signal. This switching depends on the level on address line A13 (P2.5), which is (significantly) labelled ‘RFRSH'. Any time instructions are executed from an address range where A13 is at'1’, PSEN is linked to all RAS lines. By loading ‘NOP’ (no operation} instructions in this area, a number of RAS pulses may be fed to the DRAM, along with the corresponding address. In this way, we ensure that all required addresses arrive within the desired time with ‘RAS-only’ refresh, Since the system ‘does not know (initially) what type of SINIM is fited in the test ‘socket, it has to cater for all refresh rates between 256 per 4:ms to 4,096 per 64 ms, That is why the refresh is divided into 16 oycles of 256 addresses. During each cycle, 256 adresses (A0-A7) are refreshed, while the higher-order address section (A8-A11) Is incremented during each next cycle, As regards software, each cycle consists of 255 NOPs, followed by an RET (return) instruction to give exactly 256 adresses. These refresh routines therefore occupy exactly 4 Kbytes in the EPROM memory. The refresh is initiated every 3.5 ms (instead REFRESH METHODS USED BY THE SIMM TESTER ‘of 4 ms) by means of a timer interrupt, leaving a sufficiently large noise margin. its very simplicity also makes the refresh relatively fast. ‘Address lines A12 and A2 are used to bulld a CAS-before-RAS. ‘eycle. Here, NOPs are not necessary, and 2 single RET is sufficient. The CAS line is pulled low when A12 and A2 are logic high. Next, the execution of the RET instruction ‘generates four PSEN pulses, which are sufficient for an equal ‘number of refresh cycles. Considering the software overhead or this method, more time is needed to realize 256 cycles. With this refresh method, a test will take about 30% longer. SS eee | ELEKTOR CTRONICS. FEBRUARY sium R24 RAS-only refresh No complex hardware controls the LCD. With the aid of some During a RAS pulse, a row address is additional electronics (mainly buffers) also indicated as a refresh address, The block diagram shown in Fig. 5 we are able to run a thorough check on ind copied into the refresh memory on proves that the general structure of a SIMs. he falling edge of the RAS pulse powerful SIMM tester need not be too. The practical realization of the cir: (Fig. 40), complex. The processor and the cuit is shown in Fig. 6. The processor EPROM are part and parcel of a stan- section of the eireuit should be fam dard 8032 configuration which also iar by now, consisting of little more GENERATING THE RAS AND CAS SIGNALS Before eny read or write instruction to the SIMM, a row address (RAS) and a column address (CAS) needs to be written (in that order). The RAS signal is started by reading an external address (IC7a high) of which address line A1S is low (IC7b low) | inverter IC8d ensures that the RAS signal is actuated on the falling edge of the RD or WR signal (if input D, pin 2 of ICBa, is | high, so thatthe lower address section (A0-A11) is conveyed to the SIMM as the row address. At the seme time, switches | IC8o and IC8d are opened, so that the GAS line remains inactive Next, switch IC9e is opened, so thet a CAS pulse is generated with the next read or write instruction. This CAS pulse supplies the column address, and reads or writes torom the selected memory location. When pin 12 of IC6b is logic high, the RAS line is also de-activated atthe end of the CAS pulse. The assembly code listing below gives an example of a ‘read! command. WR 70 HAM: MOY WRITEDATA,A ;SAVE DATA FOR DISPLAY cuR EA DISABLE ALL INTERRUPTS, 1.£. HO REFRESH ALLOWED sexe p7ar7 WRITE D7 RYO D7 AND PARITY BIT CLR cASBIT =; DISABLE cas PULSING MoE A,@DPTR __;DUMULE READ TO OUTPUT ROW ADDRESS SETB CASBIT ALLOW CAS PULSE FOR EXT EXTERNAL ADDRESS Movx @DPTR,A WRITE CONTENTS OF A TO RAK cur rarr cok Parrrvert CLR CASBIT «DISABLE caS PULSING ic — ELEKTOR ELECTRONICS FEBRUARY 1996 22 COMPUTERSIMICROPROCESSORS than the components already indi- cated in the block diagram, ‘glued to. gether’ by wiring, of course. The RAS pulses are generated with the ald of Ira, ICrpy Ia ICs and IC 15, IC and IG, generate the CAS pulses. Two NAND gates and an inverter (ICzu, ICrg and ICs) ensure that the LC display may be used in the external address range (A15="l’. via port P2.7). Address lines AO and A] then determine the se- lection of registers in the LCD con- troller, and also select between reading and writing. Because PS/2 SIMMs have shared RAS and CAS inputs, ICja and ICq, are needed to perform the actual address. ing of individual RAS and CAS lines. ICs enables all RAS lines to be selected, in one go during a refresh. That simpli fies the software implementation of the RAS-only’ refresh system considerably IC\), 1Cy2 and (Cg bulfer all inpt and output lines on the SIMM test sockets (K2 for 30-pin SIMMs, and K3 for 72-pin SIMs). The buffering pre- vents the test system from crashing when a faulty SIMM Is under test Because the 8032 has a databus width of only 8 bits, bit 7 is multiplexed with the parity bit (ICs, and IC) Finally, push-buttons S1 and S2 ensure easy operation of the tester aseeceseshasté EEE eRREEEE q gevescerreartgresses Fig. 6. From theory o practice. The structure of the hardware shown here bears great similarity with that of the block diagram. ELEKTOR ELECTRONICS FEBRUARY 1996 ‘The SIMM tester Is accommodated fn two printed circuit boards. That ex. plains the presence of connectors K5, K6 and K7 which convey all relevant signals between the two boards. The tester is powered by a type 7805 5-V regulator which provides a stable supply voltage. Diode D1 serves asa polarity reversal protection. It also provides a negative reference voltage for contrast adjustment of the LCD. J] es Hi sasbbaehiiee ser ooo 1 BRAM ER98 SERREREEE REGEEEEE! Tinh peteeeee ee “The SINM socket board fs shown as a sept te ELEKTOR ELECTRONICS FEBRUARY 1996 Construction and test The printed cireuit board for this pro- Ject Is double-sided and pretty com- pact (see Fig. 7). The board is available ready-made through our Readers Services {see page 70). Anyone capable of soldering accurately should be able to produce a working copy of the SIMM tester. It Is eut in two sections so that the section with the SIMM sackets may oPRERRUEREEES q getesessvese pressesy cireut SIMM TESTER 23 be mounted above the main board. Cutting is easy with the aid of the fraised groove in the ready-made board Start by building up the main board, taking care to observe the mounting direction of the ICs. Note the different orientation of IC; and IC, on the board! Depending on the enclosure used, S; and Sp are either PCB-mount or panel-mount types. Once all paris are fitted on the board, connect only the LCD. Do not insert the ICs in thelr sockets yet. with the obvious exception of ICio. Apply power (from a 12 V/150 mA mains adaptor), and check that one text line of the LCD lights up. If'you see noth- ing, adjust PI. Switch off, fit IC, IC, ICs. IC; and ICs, and switch on again. The welcome screen should appear on the LCD, and it should be possible to select all functions by pressing the two push-buttons. Switch off again, and fit Iz, ICs, ICe and IC;. The circuit should start again without problems. If everything is all right so far, buffers TC41, ICyz and ICys may be fitted. The main board and the socket board are connected via a header (Ks) and mating sockets (Ks or Kz) which ‘come in strips of 36 pins. The remain ing pieces are used to attach the LCD (6) in a similar way. The plug-in con. structions allow the socket board and the LCD module to be taken off easily If you have just a little more space available, you may mount the socket on Ke as illustrated in Fig. 8. If Ky is used, the unit may be made even more compact. If the connector is secured to the front panel of the case. it may be handy to mount capacitor Cyp at the solder side of the board About the software ‘The software burned into the EPROM allows (PS/2) SIMMs with capacities be tween 256kx8 up to 32MX36 to be tested. The tester is operated via push- buttons $1 and S;. Depending on the progress of the test procedure, push Dutton Sp acts as a START, PAUSE or STOP control. SI. on the other hand. s used as the SELECT or CONTINUE con trol. Before testing a SIMM, the elreult should be switched off. Next, carefully ‘insert and secure the SIMM in the rele- vant socket. Switch on again. Go to the main ment of the start program by pressing one of the keys after the start message has appeared. Four options are offered: AUTO, MANUAL. RAS ONLY and FAST. The function which is se lected after S, ts pressed flashes on the display. You step through the menu by pressing $;. During all tests, the dis. play indicates the currently tested ad dress. That address is determined by address lines AO through ALI (max.) li.e., OFF, with 16-MB SIMMs), and 24 2 O G2 ios ce ere | 3 Sf =< 3 c a3 18 e : 58 : . 8 3 nae 3 8 DS f? . <3 é > =s pg = 3 me eee oe ESS a 3 on |e 8 Se HE hens 8 35 eo ge 6 Fig. 7. Track layouts and component mounting plan of the double-sided through-plated board (avaliable ready-made through the Readers, Services). the RAS and CAS lines. The display also data being written and As soon as errors are en Indicates th read back: countered, the display shows a message telling you which memory location is faulty. Below ss a brief summary of the function of each of the menu options of fered by the SIMM tester AUTO When AUTO is selected. the software automatically detects the type of SIMM Ated in the test socket. The detection process is based on a shortened test algorithm. The result appears on the display. Next, the actual test may be started by pressing 8, MANUAL After choosing this option, $y may be used to select the type of SIMM you wish to test. This option is useful if the auto’ function fails to establish the right type. If that is the case, by the way, iC is almost certain that the rele vant SIMM has a serious fault. Start fore toe Resistors: Ri = 47k. Re = 1000 R3 = 1k Ra = 2240. Pi = 10k02 preset Capacitors: C1-C10;612;617;618;C19 = 1000F C11 = 100uF 25V radial C13 = 10uF 16V 614,015 = 22F 18 = 220pF Semiconductors: Dt = 1Na002 {C1 = 8032 (16MHz, 40-pin DIL) legiien1jIC12 = 74HCTS73 27128 (order code 9665031) 74HCT139 7aHCT244 Ios = 74HCTT4 74HCTOO, 74HCTO4 Ice = 7aHcT4086 Ict0 = 7805 IC13 = 74HCT245 Miscellaneous: K1 = 16-character LC display, e.g. sharp LM16a21 K2 = 30-pin SIMM socket or ZIF socket K3 = 72-pin PS/2 SIMM socket or ZIF | socket | a= Zway PCB terminal biock pitch | Bah | | | Keo s0-in singl-row pnheader: KB orK7 = 40; singlerow sockat tees tex S182 = Oataswitch prosskey (with mae cop X= 16MHe quartz crystal low- prot tapi Header {ein socket PB and contol software in EPROM: fer order cove 960030 (eee page 70). | Programmed EPROM also avaloble Separately, order code 956503- (see pone 70) ELEKTOR ELECTRONICS FEBRUARY 1996 Fig. 8. The SIMM socket board may be attached to the main board in two ways. Here, itis fitted as the test by pressing Sa, RAS ONLY versus CAS g 00 re o 5 B ® e | coneowewrs ust ] capac: {aren chant) Che 204 10v CaGatser 08 «2200 4 He fei: ‘ims Brent Chery 10 ca focama Cav 3 = 200250 B00 (SF) | razzmn 2 Jy 200 se Prk0 05 | eae Zope on sy | es2ium aon 0 sw | semiconductors tox | Heres ins | 122 bose 380026 1 = 825001500/1000 soo Rito = 20220 128)R12b = 10002 preset (Bours 3006? or Bckrnan 90°) Connectors: Capacitors: (09596 = 10,0009 16 6-pn boxheader > ttminal loc, pitch Sm Semiconductors: ioisiciy= LNs POWER SUPPLY ‘02= 8400500078300 40V (per section) Connectors: | 6-pin boshoua Resistors: t= POB terminal back, asar Sun Atta 198201 ELEKTOR ELECTRONICS FEBRUARY 1996 DESIGN COMPETITION. WINNERS. 59 i _80__DESIGN.COMPETITION WINNERS ~ PC-CONTROLLED BATTERY 1 TESTER Design by R. Mohrlock This battery tester is capable of measuring the capacity of batteries up to 17 V ata maximum discharge current of 1 A. Remarkably, the tester is Controlled hy a PC. Aller entering all data, in- battery. This 1s a remarkable cluding the nominal dis- feature of the tester, because charging current and the measuring residual battery lowest battery voltage, the energy requires integrating battery is discharged unttl the ‘deep discharge’ voltage is reached. The process 1s stopped automatically to prevent damage caused by deep discharging. During the entire process. PC display shows the power aver ime, and that means complex circuitry in conventional discharging How it works the The heart of the ereuit is a battery voltage. the dis- 12-bit A-D converter with an charging current, the cur- internal reference and an 8- rently absorbed power and channel multiplexer. ‘The ADC is used to measure the battery voltage, but also as-a the capacity. Also indicated he energy supplied by the DAC (yes!) 10 control the dis charging current. The input multiplexer of the MAX186 15 configured with the ald of an 8-bit dataword supplied by the Pc Signals CLOCK and DATA IN are generated by the PC software via status lines on the serial interlace (S292). The rectified sig nals (DI and D2) are filtered (C6), Umtted to about 5 V [D9), filtered once more (C5) nd, finally, applied to the A D converter. Signals CLOCK and DATA IN are applied via resistors R2 and R6. ‘The current consumption of the MAX186 is so small at 2 mA thal a separate power supply is really unne sary. Capacitors CI and serve to filler the reference valtage which is generated ‘internally by the MAX186, rd Prize (6) The battery voltage, the gate voltage of TI and the drive voltage of the current sink (C4) are measured one after another by the control software. The exirrent sink is essentially formed by U3 and TI. Resistor RS draps a volt age which is proportional 10 the discharging current This voltage is compared to the scaled-down | (R4/R5) control voltage (on C4) by U3. US then controls the gate voltage of TL such that a-constant discharging cur rent Is established. Exsential in the operation of the cireuit is the way in. which a drive voltage ap pears on C4. At the far end fof the control byte that con: figures the MAX186 is a bit which may be set to 0 or 1 without changing the func tion of the ADC. When the Tee Hels . o | many 1] 4&8 eae i | | Fig. 1. Circult diagram of the intelligent battery tester —a PC driven 12-bit analogue-to-igital convert doubles as a digital-o-analogue converter for the control of a current sink for the voltage measurement which ELEKTOR ELECTRONICS FEBRUARY 1996 strobe output, pin 16, gener ates a ‘high’ pulse. This sig enables bistable UIA to plek oul the last bit in the control word, and use It to charge capacitor C4 via RI The PC software then. com: pares the voltage on C4 (which depends on the de sired discharging current) with the voltage actually measured by the ADC Depending on the outcome of the comparison, the soft sets or resets the cur ent sink control bit. Because this bit can he set and reset seyeral thousand limes per second on modern | Pes, a smooth control volt: | age is obtained across C4, The main purpose of ‘monitoring the gate voltage ss to enable the circuit to de {eet errors. If the fuse blows (ior example, alter a mistake with the battery potarity) the gate voltage rises, and that ean be detected by the A measurement accuracy which Is a few classes better tan most conventional -quipment may be achieved by using an opamp with a ow oll-set voltage is position U3. a special measuremen resistor in position RS. and a separate supply in lieu of diodes DI and D2, The stated (regular) compo: nents, however, will do a good job, too. because they allord a measurement acct racy better than 1%, Construction With the exception of the MAXI86, the components used are uneritical and should be generally avail able, The circuit is simple to build on the single-sided printed circuit board. Some extra care should be taken lo make sure th pads are not accidentally connected to the large ground plane. Depending on sure you do not lose too Your reqitirements as re- much voltage, use heavy gards accuracy. the resistors duty eables to connect the should be close-tolerance tester to the battery, The cir ‘metal filma types. cult 1s designed such that individual cells may be mea the unit is connected to sured also. At a current of the PC via a standard 9-way 1 A.and a cell voltage of 1 V RS292 cable (fully wired, however, a valtage drop of pin-to-pin) purchased from 100 mV across the cables computer shop. To make means an error of 10) FLEKTOR EL CTRONICS FEBRUARY 1996 solder Fig. 2. PCB track Iayout and component mounting pla Software The control software was written in BASIC so. it should run on any PC, appeal of the whole story is the ability 1o make one’s own application on. the basis of a short program. With speed in mind, the serial interface driver 1s programmed DESIGN COMPETITION WINNERS 61 NENTS US esis | Rite 108 ROG AIO = ATACL RS =200k81 RAAT = 100402 | Rs sw Ag 1h Alt = 150K ‘capacitors: C1 CR CA:C8 - roy a5 C27 ior BAY = 100K 16V ‘Semiconductors DH,02 = aad ut = anova a= MAXrBEOOPP oy MAKIG2 va=casia0€ Miscellaneous Sasi J24)3 = 5018 pn Jom 1 = fuse TA pus hold Heatsink SABBIBS (isc noun Sub-D ‘straightforward’ instead of as.a loop. No attempt should bbe made to change the driver bbecatise #18 essential for the ration of the eur rent sink. Ifyou are interested ine: perimenting with the soft ware, do note that the result any ADC interrogation is not available until one ¢ afier the call to the relevant subroutine. Consequently. the result of an A-D conver sion always lags the assoct ated control byte by one ADC call, (960309) Fig. 3. Example of a measure: ‘ment protocol obtained trom the tester in combination with « PC. PWM SIGNAL GENERATOR Design by Fabrice Baudoin This circuit, aimed at electronic and power electrical engineers, is a test and simulation instrument for ambitious experiments. In combination with a PC, the ‘pulse-width modulation (PWM) signal generator broduces rapid command sequences for modulators, switch-mode power supplies, or other PWM amplifiers. as the ‘coarse’ control. When push-button BPS ts pressed together with BPI or BP2, the frequeney increases. or decreases respectively {up/down control. ‘The mumbers shown with the different labels in the di: agram refer to pin numbers on the 25-way sub-D con: neetor which links the cir cult to the PC's Centronics port Note: ‘The software men: toned in this article ts avail able on disk (see page 70) ‘This software has not been tested by Blektor Electronics ard Prize " The — current consumption of the eirewit being very small, the power supply consisis of no more than a 9-V battery and a type 7805 5-V regulator Construction and component selection The cireult i builé on a printed circuit board of The present design demon: | strates ante wre thet alo ple and useful projects can Berealized withauta maso af The hardware iat . In the eireuit diagram shown 112 im Fig. 1, three type IL112 opto-solators provide full electrical isolation on the three channels, while resis: tors RI, R3 and R5 mit the 4 current through the diodes in the opto-isolaters. The electrically isolated signals are recovered by inverting amplifiers which serve to give sulficient drive capacity to the modulated signal. The green LED, D1, indicates the presence of signals on the 2 three channels, while a red RD ED, D2, indicates that the cireuit is busy computing THL 492 the relevant signals. The push-fo-make buttons. BPL B2 and BPS, enable you ta set the frequency of the | modulated signal. BP1 acts as the ‘line’ control, and BP2 TIL TIL 112 nsquoncysetng BPI Fig. 1. The PWM Signal Generator hardware Is of an amazing simplicity, ELEKTOR ELECTRONICS FEBRUARY 1996 _—— —___DESIGN.COMPETITION. WINNERS... 63. LPT PSU PWM GENERATOR MODE+/— COARSE, FINE Fig. 2, PCB track layout, Fig. 8. Component mounting plan. Which Ghe artwork (designed Applications COMPONENTS LIST —— hy the author) 1s Figs. 2 and 3. The signal nal generator will be found jown in Applications of the PWM sig. 7 7002 iscllaneous: generator is relatively simple mainly in the ‘power control’ | AURORE SEO Me malar Teri Ww construct. The cireuit fleld, more specifically. the | PARAS irene eartiaene board has no wire links. setting up of sehen iar wait Dhetdeteey Special or programmed parts - wave sources {no-break PC | By=LED, le gieen ‘0-way aa; one side 1 ate not required. (D2= LED, ound, 1 ua IOC sce, the oy, a 25 ‘The opto-isolators and the (etscaNcs TiLine way Sub-D plug ‘Tieircutt can be picked up (simulating a 3-phase , at low prices. The cable to source is possible) the Centronics port may be - motor controllers (asyn- you are looking at DOS soft- conversion of signal files to salvaged from an older PC — chronous motors driven by ware which runs at impec- hexadecimal (EPROM) for with a hard disk controller a PWM generator): cably. and at good speed, mat card. The same for the push- - dc, motor controllers (ac- even in a Windows 95 win- - controlling the phase of buttons, which may be re- celeration under the con- dow. Here are the functions channels 2 and 3 moved from a scrapped — trol of the PWM signal recognized by the control (channel 1 is a reference) keyboard, Im keeping with generator) software digital frequency contra the Competition rules, the - sound generators for audio ~ editing signal files, computing the frequency design has no more than amplifiers (try it, Us great __(fichiers.sig) spectrum of PWM signals 30 components. font: building signal files dot oF signals 10 be modu The cable between the - sequences to be loaded by-dot lated: generator board and the — into EPROM (for microcon- - various existing functions; - simulation of first or sec PC's Centronics port con- troller systems). utilize non-linear functions —_ond-order pass-band, low sists of a short length of flat (threshold, saturation pass or high-pass filters table. The circult diagram The software exp, function) > recovering a filtered signal indicates pin 1 of the LPT It goes without saying that is. - production of 3-phase and - using parameters for the socket, The blue (or red) wire it dilficult to get a circuit as 2-phase systems with spectrum analyser (up to in the flatcable should go to. simple as the one shown phase(s)as parameter(s): 250 harmonies. display that pin. Table 1 shows all here to function without an - conversion of signal files to type, et) information required to ac- efficient piece of software, Excel formal for reporting ~ and more, for you to ex ually make the cable. The sofiware written for this purposes, plore (960311) ea j sah || Faso | several nn, ere 7 6 {initiaize} | for this article, the descrip- 22k z 1 tion below has been kept as eae zo concise as possible. AL the ios end of this article is an ex or | pees ample showing the practical Fee use of the generator eos | L 71s) SE) Control software: the op- a tions eave ‘The software that goes with eat oe this project offers quite a few Fig. 4. Example showing the practical use of the PWM Signal possibilities, Essentially, Generator. ‘ate Oy HLEKTOR ELECTRONICS FEBRUARY 1996 * _.64__DESIGN.COMPETITION WINNERS. Note: the software for this through Readers project is available on disk Services (see page 70). Note PRACTICAL USE Lens assume that you wis to tst a creut as shown in i, 4, The diagram ‘hows an opamg-bases arpa whose inverting input acca a va alge supped by a potentiometer or an aostabie resistor, “The transer function, ofthe AC network may be expressed as Hevtny inet x=, and reRQeD 1s. ‘We vish fo symnesz a sinewave. Laune the progam by hpi GO. Net, Sele! option 1 fo generate cassc' signal, hen select anothar" fr sinewave Tne lve ofthe maduator§ 120% of thera, and tha trequercy ais 90, Visuals the ouput sonal by adjusting the PWM signal raquency wih ne id ot the FINE ano COARSE presskeys, Tne MODE (s+ pressty allows you to ‘ozrease or wcrease th frequency. iN cecin system requres a PWM sigal to be adjusted tean be cn asing the simulation mode. Reurn fo he main men. and selec option 3 oaunch the specttam analyzer furcion. Loos the fe ‘Smuspunn (wou is exension "3g. The sofvare wil respond by unning@enlculaton Activate aphion 22 tin dgplay of fe signal Spectrum. A this gat, you may chonss a Miter "ype: press option 4, hen) 0 ge a fyst-rdes low-pass iter with a ehopging frequency of 2 (value of) Re-soly the spectrum 2 i ol oa he ha latehane sereendus Fig. 5, Here you see te fier tanser tation tho signal spectrum, an tne new signal spectrum ater ilering_ 5 seacing ‘option 5 you ay reconstruet the signal (ih te fite oto). Intis way, you area to generate al kinds of signals wih tad of te | eokur. You may ao assur parameters othe yereato' channels phase the shanna. and use the spectrum anal. The res for you to discover Fig, 8. These two program screens (captured from the PC display | that belongs with this project. The lower sereen- | ump shows another example of signa. that this software has not Electronics been tested by Elekior | Hh INTELLIGENT MOTOR FOR R/C MODELS Design by A. Voggeneder and A. Nader This miniaturized motor controller uses pulse-width modulation (PWM) for loss-free speed control of d.c. motors up to about 40 amps. The extremely small size and low weight of the controller will appeal to builders of radio-controlled model airplanes, cars and boats, in which space is always at a premium. The however. equally suitable for use in model cars simply by swap: ping the more of operation to ‘bidirectional’ (jumper 4), Motor reversing 1s achieved with the aid af a 2-pale relay To make the model drive i reverse, the relay is ener: ized to swap the motor sup: ply polarity. The relay is driven only if no current circuits, flows, That is achieved by electronic control to prevent the contacts from burning out ar being welded because of the high motor eurrenis. Another advantage of this, type of drive is that the relay contacts need not be rated al the motor's switehing cur- rent. Instead, far lower. con. tinuous, currents apply CONTROL =. (6) Also, the motor controller is easily linked to a new remote (radio) control, By contrast conventional motor con: trollers used to require com: plex adjustments. The present controller only re quires the upper and lower Joystick position to be pro: grammed, as well as the ‘dead zone’. All relevant data jomatically stored in an Internal EEPROM. The motor controller also fea tures s temperature monitor for either the motor or the ‘over-température protection may be omitted simply by nol canneeting the NTC. An on-board low-drop volage regulator allows the motor controller to take over the power stipply of the receiver and the servos, if desired. If you do not need this fune tion, the motor controller may be powered vie the re ceiver, In that case, you may also omit the low-drop volt age regulator. Hardware: a PIC MOSFET power stage. This Goes it all protection is actuated at a femperature of about At the heart of the circu 120°C, and responds by di abling the output. The cir teuit is re-enabled when the ‘measured temperature has dropped 10 about 80 °C. The ELEKTOR ELECTRONICS FEBRUARY 1996 shown in Fig. 1 is a type 16C84 PIC from Microchip Technology. This 18-pin IC boasts the following fune tons: 0.75 Mone unarecton uss PA = 03) ery or crea v9 PE = open) Fg.1. Circuit diagram of the inteligent motor controller for RIC models. 1K « 14 EEPROM; 61 byte user EEPROM: = SB.byte RAM: B-bit mer with 7-bit prescaler: 13 programmable 1/0 pins: + external interrupt input; integrated watchdog and reset timer; <4 MHz max. clock speed: wide supply voltage range (3.5 to 6V); 2:mA current consump: The controller measures the output pulses supplied by the radio receiver, and uses this information to caleulate Ue required pulse/pulse ratia of the motor drive sig- pal. The Iength of the re- ceiver's output pulses. is typically between 1 ms (Joy- stick up) and 2 ms joystick down), The length is about 15 ms with the joystick in the centre position, All pulses have a frequericy of about 40 Hz, Practical expe- rience indicates that the pulsewidth of the R/C signal may vary up te 500 ps. espe ally with older R/C trans- millers, Some adjustment 1 therefore unavoidable, ‘The BUZI1 MOSFET is firiven via a dual optocou- pler. For this the microcon. troller generates an alternat {ing voltage via RB6 and RB7. This voltage alternately switches on one of the opto: ‘couplers, One of these pulls the gate of the BUZIL di rectly to the positive battery voltage. while the other pulls the gate to ground. This ‘rough’ drive method guar: antees the shortest possible switching time (MOSFETS have a relatively high gate capacitance). as well as a very low drain-souree resis- tance (0.04 0, thanks to the high and low gate voltages), Resistor R2 acts as a cur rent limiter, while R4 pulls the gates to ground during a reset, when the controller outputs are at high imped ance, and the two optocou- plers are switehed off. ‘The motor direction relay fs connected to the relevant points in the circuit. The relay contacts are wired as usual. To suppress motor noise, in particular when re versing. fit a 470-nF 250-V rated MKT (polycarbonate) capacitor across the motor terminals, The PIC measures the temperature by comparing a fixed 100-k2 resistor with an NTC af the same nominal value, First, the PIC pulls. port line RAS to +5 V, and HLEKTOR ELECTRONICS FEBRUARY 1996 then measures the time for C4 to be charged (0 +2.5 V via R6. Next, C4 ts dis charged, and the NTC takes over the charging. The ratio of the two charging times al- lows the PIC to compute the actual resistance of the NTC. When the value drops below a certain threshold, the out. put is disabled, When an- ther threshold is exceeded, itis enabled again. That cre- aves the necessary amount of hysteresis, K5 limits the capacitor discharging cur rent. The controller 1s clocked by a 4-MHz quartz crystal {Q1) which 1s loaded by two small capacitors (C1 and 2). [Cs recommended to fit @ miniature crystal. If you use a ceramie resonator in: stead ofa crystal, CL and C2 have to be increased to 98 pr. Building the controller ‘The motor controller is built on a printed cireuit board of which the artwork 1s shown in Fig. 2. The PIC controller should be mounted i an IC socket. The TO-220 case semicanductars, are arranged in a neat row in the high-current area of the board. ‘To prevent them. burning oul because of the high motor currents, the wide tracks between the MOSFETs and the PCB ter muinals must be tinned. It is, even belier to strengthen them with I-mm dia, silver- plated wire. ‘The way the board is pop- ulated depends to some ex. fenton the application. Model airplanes require uni directional operation. Boats and cars, on the other hand, need bidirectional operation, If the motor eontroller is mounted tn a motorized sail- boat, a motor brake is usu- ally required to prevent the propeller from turning in the water current behind the model. If a braking function Js required, fit the relevant P-MOSFET (T5) and resistor R9, and omit flyback diode D1. Transistor TS short-cir cults the motor as soon as this is switched off, and so brakes the propeller. Because this transistor is driven by the same output as the motor reversing relay, it 1s essential for JP4 to be Ntted, because else TS is de- stroyed when the motor is reversed. The upshot is Utat the motor brake function may only be used tn unidi- reetional mode. LWINNERS Fig. 2. The motor controller is built on this small printed cireult board. The copper tracks that cary high currents are best tinned oF strengthened with ver-plated wir. COMPONENTS UST Resistors: R= aka Re 1000, 75 = 1081 7 = NTC 100K Ra = tt Ra 108 Capacitors: C102 = 15pF ceramic (Ca t00nF came o {nF ceramic Semiconductors: Die anid (D202 = MBRZ04S (aus Schothy code) ty =BOsI7 127874 = BU21) (Semers) 78 = |AF9530(imeratonal ect) ‘Okt = P6827 optonaupler ict = Picteces Ve = Lapaovs iseetianeous: ‘Ot = ante quartz crystal Fey = 5 relay 2/0 S71 «3-9 pmiweaer ‘572 100ay bowteader Rs=4700, Ba = 100K | To adjust the cireuit move the Joystick on the R/C transmitter to the upper (front) position. and then briefly fit jumper Pl (for about 1 5). The other ex: ireme of the joystick ts ad- justed similarly with jumper 2. To set the dead zone, the Joystick is pulled to the desired position from ‘zero’ and jumper 3 ts briefly Connection diagram for model airplane (with motor brake) Connection diagram for two-direction use (car, boat, etc.) 6.10 cells 6.10 cells Fig. 8. The board has to be configured for unidirectional or bidirectional operation ofthe dc. motor. Also role the important function of jumper 4, fitted. This procedure en- ables the controller to Com: pute the current calibration values. which are subse: quently stored in the on-chip EEPROM, Jumper 4, as al ready mentioned, selects be tween unidirectional mode umper fitted) and bidiree- Honal mode (jumper not fit ted. Jumper 5 allows the con. figuration to be overwritten by standard values. This is achieved by fitting the Jumper, switching the sup. ply vollage off and on, and removing the jumper again. PIC ports RBI through RBd are actually programnied for connection to pusb-butions. Because the actual switch {ng funetion is only rarely re quired in this application, and because of the limited space available onthe board, jumpers are used in stead of switches, 1960313) Nate: the control software 10 be programmed into the PICIGCS4 is available on disk through the Readers Services (sec page 70). This software has nat been tested by Elektor Electronics. BLEKTOR EL {ONICS PRBRUARY 1996 Design by Joachim Kircher Most of today's 486 and Pentium PCs offer a ‘Green Power’ function which serves to switch off external components automatically when the computer has not been used for some time, All equipment is restored to (ull power again the instant you move the mouse or ress a Key on the keyboard. This wonderful Design Competition entry tells you how a Green Power function can be installed on older computers. As you probably know, the munilor is the component negative monostable trigger input of IClA. The with the highest current bistable responds by gener consumption of all PC pe- ating a ‘high’ signal of about ‘ipherals. The cirewit pre- two seconds at ils output sented here saves power and The transmi( data supplied prevents sereen burn-in DESIGN.COMPETITION. WINNERS. 6?_ GREEN POWER’ FOR PCs by the mouse are also ‘stolen’ via the adaptor, and arrive at the efreult via pin 2 of the 9-way plug. Moving the mouse causes the volt age level to jump trom -5 V (or “12 V) to +5 V (or +12 Vi. Diode D3 ensures that only positive levels arrive at the clreuit. R5 and Ré create a TTL level which (riggers the positive input of monostable ICIB. The output of the monostable supplies an ac- tive high level of about 2 sec- onds, Diodes DI and D2 form an OR function, The “high” leyels ensure the discharg- Ing of the timing eapacitor, C4, via R6, TH and R10. The 6th Prize (6) latter determines the actual discharging cur rent. The two monostables are necessary because C4 is relatively large at 1,000 pF, and can not be fully dis charged by a keyboard or ‘mouse pulse Timer IC2 (a 7585 MOS version of the 555) and transistor Tl form a re triggerable_monostable. T2 acts as a driver for a power relay that switches the mons tor on and off. Assuming that the two. monostables ICIA/ICIb are not re-trig gered by the mouse or the keyboard within their mono. time, T2 is switched off, and (C4 ts charged via RB and po problems by switching olf the monitor when no key board or mouse activity 1s detected during a predeter mined period (adjustable be tween 1 and about 20 minutes}. A simple switch allows you to override the Green Power controller at ony time. The eireuit has the jollowing additional fea monitor supply automat cally restored as soon as a key is pressed, or the mouse is moved: powered by the Pt ternal supply required: monitor power-on delay to prevent current surges when the PC and the monitor are switched on simultaneously. About the circuit To avoid all compatibility problems, the Green Power function was implemented asa pure hardware solution, To enable the controller 10 monitor keyboard and tb? mouse activity, the required A scrcendump of the program is shown in Fig. 5. All locations are initially filed with "26", the code for ‘Return to Program Mode’. Reading a program into memory is simple: select the op: lion ‘Load Butler with Fae’ and choose, for example, the file “loop. ple” [tis also possible fo enter a program. After starting the program, select “Bait Buller Contents’, and go to the Mnemonics’ option. Enter the program with the aid of mnemonies, and save it (o the hard disk with the ald of the op: Hon ‘Save Buller to File’. Next. select Program —MicroPLC’, and then. Download & Autostart’. At that point you have (0 reset the Micro PLC. Once the data have been recejved, the red LED goes oul, and the green one lights. The program is being executed, The switehes on the Micro PLC may be lised to check if the program does what you want I 19 do, Alternative application: an intelligent /0 card Besides its obvious function as a Programmable Logie Controller with a hmited instruction set, the Micro PLC fers the functionality of an intelligent W/O card for PCs. As long as the Micro PLC is in ‘programming’ mode, it considers all characters with an ASCIL value smaller than 250 as data, while characters in the range 251 through 255 are Interpreted as commands. The function of these commands is as fol- Jon Code Application 251 return value of inputs as char- acters (0 - 63) 252 write next character in binary to outputs, 252 return value of outputs as ehar- acters (0 - 63) 254 Tetum software version number 255 switch Micro PLC to run mode To simplify the use as an 1/0 module, the diskette offers the Turbo Pascal program 'PLC.TPU’. This program eon- Jains a series of procedures and fine ons which are useful to the programmer who develops his/her yn software, Here are shart descrip. lions of the available Turbo Pascal pro. cedures, Procedure: setcom (comadr = integer): Initialize the serial port with the base address ‘comadr’ for the communica. tion with the Micro PLC The following procedures/finctions may only be used after the procedure ‘seicom’ has been called, PLEKTOR ELECTRONICS FEBRUARY 1996 HANDS-ON PLE PROGRAMMING (2) 7 Fig. 3, Motor and switch connections for the shutter control Location Mnemonic a6 20 ° 18 stu ° 20 on 6 22 an 2 en am 4 as am 7 a8 our 6 30 sm 2 2 ons 7 4 am 2 a6 am 3 38 a 5 so am 5 a our 7 a sm ‘ 46 our: 8 a sm. 5 50 our . 32 ue i Fig. 4. Listing of the window shutter control program. Function readinputs : byte: Reads the inputs of the Miero PLC. and returns the value as a binary: number between 0 and 63 Procedure output (number byte): Puts the value of “number" (be: ween O and 63, binary} on the out puts of the Miero PL Function readback : byte: Reads and returns the values of the outputs. The short demonstration program ppletest.exe’ on the diskette shows you some of (he possibilities of the Micro PLO when tsed as an intelligent 1/0 card. The program Is written in Turbo Pascal, and makes copious se of the unit ‘ple.tpus Like mnierople.exe’. the program ppletesi.exe’ must be Started with the number of the communteation port Comment Reset ali outputs Read input 0 (52) into accun OR function with output 6 (Ki) AND function with input 2 (S2) AND function with input 4 ($4) anv function with tfeutput 7 (#2) ) Write acum. to output 5 (#1) nad input 1 (83) into accum OR function with output 7 (K2) AND function with input 2 (51) AND function with input 2 (86) AND function with input 5 (85) AUD function with !foutput 6 (X1)) Write acum. to output 7 (42) | Koad [input 4 (58)] into accum. Write accum. to output 8 (ith) | Read {input 5 (85)] into accun. © acum. to output $ (#2) wat program Fig. 5. The programming and downloading utility, mierople.exe, in action on a PC. (com) as a parameter. For example: pletest ~com? ‘The program drives the Micro PLC ont puls like an incrementing binary eounter. Apart from this function, the inputs are read continuously, and their states are displayed on the PC screen, (960001-

You might also like