G:\DAT\DOCUMENT\GUIDE.TXT A. Circuit design guidelines -------------------------------------------------------------- A.1 On-off inputs If accessable to the end-user, on-off inputs shall withstand excess voltages up to +80 V for 5 minutes without damage. These inputs should have capacitors to snub high frequency noise and absorb ESD. If necessary, all inputs should have either a pull-up or pull-down resistor to put them in a known state when they are left unconnected. A.2 Analog inputs If accessable to the end-user, analog inputs shall withstand excess voltages up to +80 V, as above. There will be no unexpected operation in this regime e.g. the 12-bit A/D output will not reverse from 4095 steps to 0 steps as the voltage rises abnormally high. The capacitive input of a switched-capacitor A/D shall be driven with a suitably low source impedance, for accurate conversion. The use of trimpots in the amplifier circuits of amplified analog inputs is to be discouraged. 12-bit analog inputs are preferred for sensor inputs (pressure, angle, length). If the A/D is an external chip, a serial interface chip is preferable to parallel interface, for lower cost and less board space. The reference voltage(s) of the A/D shall be derived from the voltage source that powers the sensors or joysticks that drive the A/D: this rejects any drift in the output voltage of the voltage source. These inputs should have capacitors to snub high frequency noise and absorb ESD. Active lowpass filters may also be needed. Gain or attenuation of the op-amp input stage will not be dependent on source (sensor or joystick) impedance. A.3 Other inputs Input captures, counter/timer inputs, interrupt and other inputs accessable to the end-user shall withstand the application of up to +80 V for 5 minutes without damage. They should also have capacitors to snub high frequency noise and absorb ESD. If necessary, all inputs should have either a pull-up or pull-down resistor to put them in a known state when they are left unconnected. A.4 Sourcing high power FET outputs Power FET outputs, either on-off or PWM, shall withstand +200 V transients. These outputs will also be protected against inductive load dumps with a fast-recovery diode of suitable current rating. Output current limiting and short-circuit protection will also be provided. These outputs will not be damaged if the supply voltage rises abnormally high; to +80 V for 5 minutes or +200 V briefly (supply load dump). The FETs will be kept saturated or OFF at all times, to limit power dissipation. High power outputs will be shut off at power-up or whenever the CPU RESET line is asserted. A.5 Sinking low power (open drain/collector) outputs If accessable to the end-user, low power outputs shall withstand +80 V in the OFF condition; be protected against inductive load dumps with a fast-recovery diode of suitable current rating; and have output current limiting and short-circuit protection. Low power outputs will be shut off at power-up or whenever the CPU RESET line is asserted. Route these outputs through optional series resistors on the PC board; for current- limiting if these outputs drive LEDs (put the resistors on the PC board; NOT in the internal wiring harness). Because these outputs are sinking, the inductive kickback protection diode should go from output to supply. A.6 Internal on-off outputs Not accessable to the end-user; so no elaborate protection circuit is required. Nor is it necessary to ensure that these outputs are shut off at RESET if safe operation can be guaranteed otherwise. A.7 Relay outputs Relay outputs will be shut off at power-up or whenever the CPU RESET line is asserted. A.8 Analog outputs Analog outputs will be zeroed at power-up or whenever the CPU RESET line is asserted. If accessible to the end-user, the outputs will be protected against short circuits and the application of outside voltages up to +80 V. A.9 Voltage sources If accessible to the end-user, the output of on-board voltage sources, intended to power sensors or joysticks, shall withstand the application of +80 V; and output current limiting and short-circuit protection will also be provided. The output voltage shall be regulated (a simple series diode or resistor is not enough). The voltage source will drive an on-board LED to indicate that it is operational (i.e. not shorted). A.10 Serial I/O All boards shall be equipable (is that a word?) with a hardware, bidirectional serial port, if only for test. This could simply be a socket for a MAX233 chip, with the chip installed during testing and removed before shipment. It could also be a plug-in board containing a serial port chip (UART) and level shifter (MAX233) that could be removed after test and before shipment. The serial port will operate at PC-standard (115200 / N) bit rates, to facilitate interface to PCs and the use of virtual transmitters/receivers. A.11 Memory The sockets that accept memory chips shall be equipped with jumpers and/or have key control signals routed through a PAL. This will permit simple substitution of a memory chip of different capacity (16K, 32K, 64K, etc) or technology (SRAM, EPROM, EEPROM, Flash, etc). If an external EEPROM chip is used, a serial interface chip is preferable to parallel interface, for lower cost and less board space. A.12 Power supplies Neither switching nor adjustable linear power supplies should have trimpots for adjusting the output voltage: use fixed resistors. If the output voltage is not sufficiently precise or accurate, use a better circuit. Output voltages should be regulated +/- 5% over full ranges of input voltage, load current, and temperature. The voltage input to the +5 V regulator should be routed through a series diode of suitable current rating to protect against reversal of the power leads. A pre- regulator, capable of handling +80 V sustained (5 minutes) input, shall be used to protect the linear or switching regulator(s). Watch your power dissipation. A.13 Preferred components A.13.a Use electrolytic capacitors instead of tantalum where possible. A.14 System RESET line This line should be buffered before going onto any sort of buss, to prevent EMI introduced on the buss from causing faulty resets. B. Board layout guidelines -------------------------------------------------------------- B.1 Leave some room... B.1.a ...around the EPROM socket for the emulator cable (and for the plastic cap that covers the socketed EPROM for conformal coating). Leave room for a 32-pin socket (even if you use only a 28-pin socket), plus 0.1 inch on either end of the socket, plus a few millimeters on the sides. B.1.b ...around the PLCC socket of the CPU. We need a few millimeters here for the plastic cap the covers the CPU for conformal coating. B.1.c ...around the white Molex connectors. Leave enough rooom for someone to get their fingers on the locking tab. B.1.d ...along two opposite edges of the board. We need 0.15" of total clearance (no components, heat sinks, connectors, traces, etc.) so the board will fit into the wave solder racks. B.2 Silk screen: B.2.a It will prevent the device being installed rotated or backwards (e.g. the decal for Molex connectors will show the position of the locking tab on the side of the connector). B.2.b Try to make the reference designator (e.g. "R27") visible after the part is installed. B.2.c Both large AND medium valued capacitors should have some kind of polarity mark on the silk screen. This allows later revision of the circuit to use a polarized electrolytic or tantalum where a non-polarized metal film device was first used. B.2.d Production would like all polarized devices to have the same orientation on the board. e.g. all devices in TO-92 packages will face the same direction; all polarized capacitors will have their positive lead facing the same direction; all LEDS...etc. B.2.e Erroneous or ambiguous silk screens on existing boards should be repaired before the next batch of boards is ordered. B.3 Preferred board sizes: B.3.a 4" x 6". A board of this size will fit the black extruded enclosure used for the {company} load controller. B.3.b 5" x 7". This is the size of our IRCR-003 and SBC-004 boards. It will fit comfortably in a small Hoffman enclosure. B.3.c 6" x 9.5". This is the size of our IRCR-004. It will fit a large Hoffman enclosure or the green heavy duty enclosures used for the {company} wire remote control. Note that the 4" x 6" size board is roughly one-half this size. B.4 The board should have test points for at least the following signals: - CPU crystal oscillator - RESET line - AS or ALE address strobes - ground - all power supplies - serial input & output The small wire loops Dan has for test points would get covered with conformal coating. Perhaps route these signals to an inline Molex header that can be covered with a nest during conformal coating. B.5 No board should be designed in such a way that cutting traces, soldering fly-wires, or tack-soldering extra components is required. Instead of cutting traces, place pads for the installation of a jumper; and simply omit the jumper if no connection is desired. B.6 The silkscreen of the printed circuit board should indicate the stock number ("164-01-637"), "model" number ("DVD-001"), revision, and copyright. B.7 Don't forget to label any controls on the PC board (switches, trimpots, etc.) B.8 You may not want two or more Molex connectors of identical size on the PC board. This is especially important if the system will be sold as a bare board. The customer could wind up swapping the connectors, putting power in the signal connector and vice versa, damaging the board. B.9 On-off inputs should have a nine-element SIP resistor network used used as a pull-down. The ninth resistor should be routed to VCC so that the SIP can be rotated 180 degrees to turn it into a pull-up. B.10 Try to place and route all trimpots such that rotating the pot clockwise increases the controlled function, and rotating counterclockwise decreases it. This should work for both side-turn and top-turn pots. C. System design guidelines -------------------------------------------------------------- C.1 All ground leads entering a system should merge at a common point OFF the printed circuit board. This prevents damage to the board is power is reversed, or outside voltages are introduced on the leads. C.2 If a system contains multiple computers in communication over a serial link (e.g. for redundancy or functionality), limit the number of computers to two. It's too difficult to keep things manageable and consistent if more than two computers are involved. Either that, or start using formal schemes for multiprocessor systems such as CAN. C.3 Does the system have surplus analog inputs? Use them to monitor the outputs of the protected, regulated voltage sources to see if they are shorted to ground. C.4 If you add new components to the board, components that have no silk screen nor drill holes (e.g. tack-soldered to the bottom of the board), number these components starting with 500 (e.g. R500). C.5 The ground connection(s) of an RS-232 DB9 connector should not be used as grounds for other devices, such as radios or relays. This allows the system to continue working when the DB9 connector is removed so a test cable can be connected instead. D. Software design guidelines -------------------------------------------------------------- D.1 Migrate as many functions as possible into software. Software is purely NRE; it has no recurring production or component costs. This also yields a more versatile & flexible system. D.2 Remote control software: D.2.a In a packet of data sent from transmitter to receiver, it is imperative that no other byte have the same value as the start byte. Use the 9th bit to mark the first byte in a packet; or use seven-bit encapsulation. D.2.b Store received data in global variables. Update these variables when valid data is received. Zero them with a timer interrupt if no valid data is received for a certain interval. This gives robust operation (the occasional bad packet will not shut off the outputs) and safety (outputs will be turned off if transmission ceases for a known period). D.2.c Transmit data at PC-standard (115200 / N) bit rates, to facilitate use of PC for troubleshooting, simulation, and virtual tx/rx. D.2.d If it is necessary to move bits around in receiver software to route the inputs from the transmitter to the proper output, alter the transmitter or receiver wiring harness instead. Software that performs bit permutation is difficult to read, debug, and modify. D.2.e If one set of proportional outputs is driven by more than one set of joysticks, take care that the maximum PWM output is the same for full lever travel from either set of joysticks. Example: if the voltage at maximum forward lever travel is 4.5 volts from one stick and 4.0 volts from the other, clip both voltages in software to 4.0 (4.0 is closer to the center-off voltage of 2.5). If the voltage at maximum reverse lever travel is 0.5 volts from one stick and 1.0 volt from the other, clip them both to 1.0. D.2.f Keep packet size as small as possible (don't transmit unused bytes). D.3 Non-reentrant floating point Neither Borland C, Franklin C, nor ImageCraft C have re-entrant floating point libraries. You can not interrupt a floating-point operation, perform a second floating-point operation in the interrupt service routine, then return to the first operation and expect sensible results. Solutions: D.3.a Use floating point only in the main routine, or in the interrupt service routine -- not both. D.3.b Save the state of the floating point emulator when entering the interrupt service routine and restore it when the ISR is done. Franklin C provides two functions for doing this. D.3.c Make floating point operations in the main routine critical i.e. mask interrupts before doing them, unmask after. D.3.d Use fixed point math. A well-written C++ fixed-point class is just as easy to use as floats, but Franklin and ImageCraft C do not support C++. D.4 Diagnostics D.4.a Alter the C startup code to flash a 'panic' LED if something unpleasant happens; something that the normal C code can't handle: RAM failure at startup, video RAM failure in systems with graphic displays, unexpected hardware or software interrupts, return from main(), system restart. D.4.b Add C code to diagnose the external wiring harness. If the system has a graphic display, display the problem and suggested fixes to the person doing the installation. D.4.c Software that stores data in EEPROM should guard against power failure during the write cycle and also detect and correct for failure caused by wear. Store the data in blocks, with 'signature' byte(s) and checksum. After successfully writing a block, wait 2 seconds then compare it again. Worn EEPROM may appear to write correctly at first, but then fail after a short interval. D.4.d Before using the S4 Dataman to burn an EPROM, fill the Dataman's memory with hex FF bytes. This will speed the programming process, since FF is the value stored in the cells of an erased EPROM, and the Dataman will not program bytes that are already identical. It also makes it easier to identify the contents of an EPROM if the label is wrong or missing. D.4.e Use surplus analog inputs to monitor the status of the protected voltage sources that power sensors and joysticks; to see if these outputs are shorted. D.4.f For complex systems with EEPROM, log detected failures (illegal input voltages, shorted outputs, etc.) in EEPROM. If the system is returned for service, we'll know what REALLY happened to it. D.5 Add a static string to the software of each system to identify both the software and its revision, e.g.: static char ProgramID[]="File FOOBAR.C, Rev A"; D.6 Before doing any integer or floating point divide, test for a zero denominator. D.7 Reject invalid sensor calibration values as soon as they're detected. Validate stored calibration when it's read from EEPROM. D.8 For Load Moment Systems that operate valves depending on boom extension, accurate measurement and calculation of extension is vital. Calibrate the extension sensor at three or more values of extension, rather than only the two endpoints. E. Components -------------------------------------------------------------- E.1 All components must be rated for operation over the industrial temperature range (-40 degrees to +85 degrees Celsius). E.2 When switching to a new component vendor, the new component must: E.2.a have the same or "better" ratings than the old ("better" depends on component type: higher wattage and closer tolerance for resistors, faster access time and lower power dissipation for memories, etc.) E.2.b have a compatible footprint (same lead spacing, same or less board area) F. Customer documentation (user manual) -------------------------------------------------------------- F.1 Use Adobe Type-1 fonts. The manual will then have the same appearance when printed on PostScript or PCL printers. These fonts are slower than the fonts built-in to the printer, but faster than graphic fonts. F.2 Use Hewlett-Packard Graphics Language (HPGL) for graphics in the user manual. Like PostScript, this format scales cleanly. Unlike PostScript, it is visible on the screen within WordPerfect, and can be printed to PCL as well as PostScript printers. AutoCAD can plot drawings in this format F.3 Make use of your RMA or commissioning experiences when writing the "Troubleshooting" section. Example: {company} once had problems with the Boom Up function (instead of Boom Down) of a platform cutting out at the envelope. This was caused by wires swapped in two places: power & ground to the Boom Up/Down joystick, and the Boom Up/Down SAC output leads. I put this head-scratcher into the "Troubleshooting" section of the updated {company} user manual.