1 / 60

ELE22MIC Lectures 12 & 13

ELE22MIC Lectures 12 & 13. RS232 Line Drivers Charge Pumps Noise Earth Loops, Null Modems, Isolators, Modems RS485 Networking Designing a microprocessor: Chip Select Logic Timing diagrams. Serial communications. 16550 UART Configuration.

dareh
Télécharger la présentation

ELE22MIC Lectures 12 & 13

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ELE22MIC Lectures 12 & 13 • RS232 Line Drivers • Charge Pumps • Noise • Earth Loops, • Null Modems, Isolators, Modems • RS485 Networking • Designing a microprocessor: • Chip Select Logic • Timing diagrams

  2. Serial communications 16550 UART Configuration

  3. RS232 Isolator - for electrically noisy environments MC1488 Line driver/ MC1489 Line Receiver Converts logic levels of 0 .. 5V to RS232 levels -12V .. +12V Useful for PC-PC connection where both sides may be earthed, but at different potentials. Surge currents induce noise onto data. 1488 / 1489 - Cheap! Requires 6 voltage regulators: +5V, +12V, -12V for each side. SLOW OPTO ISOLATORS LIMIT MAXIMUM BAUD RATE

  4. Isolated Power Supplies Power Supplies provide separate 5V, -12V, +12V for each side. Limited by dielectric insulation properties of: Anti-Static Resistor, Transformers, Opto-Isolators, Cabling, connectors, Air clearances, PCBs clearance & creepage, Packaging Material & strength, moisture ! Suitable for connection within same building. Refer AS3260 or EN60950 http://www.standards.com.au/ Testing Authority ComTest etc

  5. MAX 232 • The MAX232 contains two EIA232 (RS232) Transmitters & two Receivers in one package. • The MAX232 has better noise immunity and zap and latch-up protection.

  6. MAX 232 • The MAX232 contains both a Voltage Doubler and a Voltage Inverter • Voltage is Doubled via Charge Pump • A capacitor (C1) is charged across the supply rails. • Then the charged capacitor is level shifted to the higher supply rail • The Charged capacitor transfers its charge into an output filter capacitor (C2) • Process repeats at a very high rate pumping charge onto the output filter capacitor.

  7. Simple Charge Pump

  8. Charge Pump • VDouble = (2 * 5V) - (2 x 1N914 Vdrop) = 10 - 0.8V = 9.2V • This doubler shows the principle behind the concept. • In the MAX232 the charge is transferred via FETs and so less voltage is lost. • A similar arrangement can be imagined for the voltage inverter.

  9. Serial (EIA232) Line Drivers Line driver: Converts logic levels 0..5V <=> RS232 levels -10V .. +10V Provides higher Current drive to charge capacitance produced by long lines MAX232 family: Converts 0-5V input into +10V to -10V.

  10. Modem: Modulator Demodulator • For longer distances where different buildings are interconnected via telephone system wiring. • Leased Line Modems don’t require line voltage • PABX/PSTN lines require current limited line voltage • Distance - 10 kms - determined by cable losses & noise. • Phone Line connected Equipment requires A-Tick, C-Tick, & safety approvals

  11. Modem Communications

  12. Modems • Modulation defined by ITU V. series standards or Bel standards. • Eg • BEL 212A 1200baud • V.22 2400 baud • V.32 9600 baud • V.34 32k baud • V.90 56k baud, • V.92 Fast Train Sequence V.90

  13. Bel 212A Modulation

  14. Star Wired RS232

  15. I2C Bus • Popular for peripheral interfacing • Two Wire (plus GND) bi-directional interface • 0 & 5V logic levels • Suitable for short distance communication

  16. RS232 to I2C Converter

  17. EIA/TIA/RS-485 (1) • Standard for differential multi-point data transmission • Popular over many years. • Up to 32 devices can communicate on a common RS485 bus. • Can support multi-master configuration

  18. EIA RS-485 (2) • Line terminated at both ends into resistor equal to the characteristic impedance of cable (Typically 120 ohms). • Higher noise immunity than RS232 - +/- 7 volts ground difference potential- rugged. • Tolerant of voltages -7V..+12V and short circuits - In case of data packet collisions

  19. EIA RS-485 (3) • High speed - up to 10Mbps (distance < 13metres ) • Maximum cable run 1.3km @ 100kbps. • Bus uses 2-wire shielded cable. • Cheaper than RS232 star-wiring • Trade-off speed vs power consumption of line driver

  20. HCCOM’s RS485 interface U7 and U8 are RS485 line driver ICs. To improve noise immunity of RS485: Provide a isolated power supply and drivers to remote RS485 connected devices. Use good shielded pair cable. Allow higher common mode voltage differences

  21. RS485 In an RS585 Network the master is normally node 0. The desired slave id is normally transmitted as one of the first bytes.

  22. RS485 After sending its data the Master disables its drivers and waits for the Slave’s response. All receivers must listen to the traffic to determine what is being sent to which master/slave.

  23. Ethernet Physical Layer Physical Layer for 10 Base T / 100 Base TX.

  24. Ethernet Physical Layer Twisted Pair Interface

  25. Designing a 68HC 11 based computer • Memory space considerations • We are going to outline a step-by-step procedure, using a practical example, for the design of a 68HC 11 based computer. • We will be focusing on memory space considerations only in this lecture. So, the computer we will be designing may or may not work.

  26. Designing a 68HC11 based computer • This is because we have omitted the crucial timing considerations which is the topic for the next lecture. • It is only when bothmemory space interface and signal timing considerations are correctly taken into account in our design then we shall have some chance of getting a working computer system.

  27. Designing a 68HC11 based computer • The company any you are working for is building a "radio teletype " for use as a message receiver at Mawson Base in Antarctica. • Digital status messages are received from remote weather stations. The incoming radio telemetry is decoded into ASCII by the radio receiver unit which then passes the data over a serial link to your system.

  28. Designing a 68HC11 based computer • Your system takes the ASCII codes received serially and asses them to a parallel printer. You have been given the task of writing the software that will control the system. • The interface to the printer consists of 8 data lines, one active-low BUSY line and one active-low STROBE.

  29. Designing a 68HC11 based computer • Operation of the printer interface works as follows. The processor checks the status of the BUSY input line from the printer and waits until it is high (Printer not-busy). • The processor then places data on the printer's data lines and sends the STROBE output line low, then returns it high. This tells the Printer that new data is available for it.

  30. Designing a 68HC11 based computer • The radio receiver sends serial data to your system at 1200 bps, with 8 data bus, one stop bit and no parity bit. • The PIA lies at addresses $6000 to $6003 and the ACIA lies at addresses $7000 and $7001 in your memory space. • The ACIA has a serial clock running at 19.2 kHz

  31. Designing a 68HC11 based computer • 1. Write initialisation routines to configure the ACIA appropriately. It is desirable to have the ACIA generate an interrupt when new data is received. • 2. Write intialisation routines to configure port B of the PIA as the data lines for the printer and bit 0 of port A as the BUSY line.

  32. Designing a 68HC11 based computer • In this system. We only want an interrupt generated when the ACIA receives data. so interrupts should be disabled on the PIA. The status of the BUSY line should be checked under software control, but the STROBE# may be generated using one of the PIA s output control lines. The STROBE# line should go low when data is written to port B.

  33. Designing a 68HC 11 based computer • 3. Write an Interrupt Service Routine (ISR) that will read data from the ACIA when a character is received and send this to to the printer via the PIA. Your ISR should read data from the ACIA, check the status of the printer by examining bit-0 of PIA port A) and then send the data by storing it to port B of the PIA.

  34. Design Specification (1) • Always start with a few questions, like: • 1. • What is it comprised of ? • What is it for ? • Usually the answers are provided by the design specifications. • Here, a 68HC11 is the brain of the system. We also have a MC6821 PIA and a MC6850 ACIA for handling the system I/O.

  35. Design Specification (2) • 2. What does the system do ? • Receive data with the ACIA and Print data with the PIA on a printer. • 3. How do we attach the PIA and the ACIA to the 68HC11 ? • Available alternatives : • Port ? • Memory mapped ?

  36. Design Specification (3) • What are the addresses of these devices • PIA $6000 to $6003 • ACIA $7000 to $7001 • 4. Decision - use memory mapped design Need address decoder to decode • $6000-- $6003 and $7000-- $7001

  37. Design Specification (4) • How ? • Partial decoding is acceptable here, so, PIA will occupy $6000 -- $6FFF, and ACIA will occupy $7000 -- $7FFF (echoes through memory) . • A15 A14 A13 A12 A11 A10 A8..2 • $6000 0 1 1 0 0 X • $7000 0 1 1 1 0 X

  38. Design Specification (5) • Assuming the chip-select (CS) lines for both the PIA and the ACIA are active low, we can use the following address decoder: • 5. Whenever an external device is attached to the 68HC11, we need to initialise it.

  39. Design Specification (6) 6. Set up ACIA Write an initialisation routine LDAA $#95 ; communication ; settings for the ACIA STAA $7000 ; send it to the ACIA

  40. Design Specification (7) • 7. Initialize the PIA • Port A: Input A $6000..$6001 • Port B: Output B $6002..$6003 • Init Port A: • CLR $6001 ; clear control register for Port A • CLR $6000 ; set PIA Port A as input • LDAA $#04 ; lock DDR bit & turn • STAA $6001 ; off CA1 & CA2 • Init Port B: • CLR $6003 ; clear control register for Port • LDAB $#FF ; set for output • STAB $6000 ; • LDAB $#2C ; lock it in • STAB $6003 ; • RTS ;return

  41. Design Specification (8) • 8. Write an Interrupt Service Routine (ISR) • LDAA $7000 ;load character from ACIA • check: • LDAB $6000 ; load printer status from Port A of PIA • ANDB $#01 ; mask out all bits except BUSY bit • BNE check ;if BUSY = 0, go back and check again • STAA $6002 ;if not, send char to Port B for printing, • ; assuming char is already in • ; accumulator • RTI ;return from interrupt

  42. Design Specification (9) • 9. Environmental Considerations: • Air Conditioned ? • Inside / Outside? • Environmental extremes ? • Temperature / Sunlight • Humidity / Condensation - Drain Holes • Iceing / Soot / Smoke • Vibration / Stress relief

  43. Analog to Digital Converter • Analog to Digital Converter section of 68HC11 • Requires 32 E-clock cycles to complete a conversion • 8-bit successive approximation converter. • Uses Charge re-distribution for manufacturability reasons. • As it is based upon capacitance it automatically includes Sample & Hold functionality

  44. Analog to Digital Converter • Analog switches are used to provide ADC internal capacitor switching and input multiplexor selection switching. • Uses internal charge pump -> 7 to 8V • Provides high gate voltages to operate analog switches - guarantees low impedance. • must be enabled (disabled at reset) • A/D Power Up (ADPU) control bit • after starting charge pump, must delay 100us before using ADC

  45. Analog to Digital Converter • Uses clock sources - must be selected • Four channels are converted in sequence with the results provided in registers

  46. ADC - Input Sample VX In the sample phase of the conversion: VX, the input voltage, is used to charge the bottom plate of the capacitors relative to the VL low reference (top plate).

  47. ADC - Sample Time is allowed to elapse for 12 cycles, sufficient time for VC, the voltage on the capacitors, to charge to VX - VL. Working with ratios of capacitances. Total Charge is Q = 8 + 4 + 2 + 1 + 1 = 16 units. The Charge Q = 16 (VX - VL). Setting VL =0 volts => Q = 16 VX.

  48. ADC - Hold In the hold phase of the conversion: The charge remains on the capacitors, and the capacitors bottom plate (reference) is shifted to VL. QH = - 16 Vi (assuming VL =0). Now Vi = - (VX - VL).

  49. ADC - Conversion (1)

More Related