130 likes | 207 Views
INTERFACES and PROGRAMMING for the Physics Laboratory Invited Talk, Bucharest, October 1999 Prof. Dr. R. Lincke Inst. für Experimentelle und Angewandte Physik der Universität Kiel. The Beginning: Commodore 64 8-Bit System for the PC Using the PC Printer Port
E N D
INTERFACES and PROGRAMMING for the Physics Laboratory Invited Talk, Bucharest, October 1999Prof. Dr. R. LinckeInst. für Experimentelle und Angewandte Physik der Universität Kiel • The Beginning: Commodore 64 • 8-Bit System for the PC • Using the PC Printer Port • Windows: New Possibilities and New Problems • UNIMESS • Microcontroller • Programming Under Windows
Interfaces Built in Kiel1. Commodore 64 The USERPORT of the C64 contained 1 Byte bidirectional + 1 Bit out. We used it with a) a 2-channel Preamplifier, b) a Steppermotor- and Relay-Interface, c) a Digital- and Timer-Interface. Sampling rates were as high as 60.000 8-bit values per second. The Programs were written in Commodore-BASIC with SIMON´s BASIC for Graphics: Ci= 56576; y = PEEK(Ci+1) {for reading ADC}; POKE Ci, 64 {for switching relay}.
Interfaces Built in Kiel2. 8-Bit-Card for PC This system was centered around an 8-bit card sitting in a standard slot. It contained all the logic including two ADCs and DACs, three 16 bit timers and an 8-bit digital port. Preamplifiers, Schmitt-triggers, stepper-motor controls etc. were contained in three separate inter-face boxes. The programming was done in TURBO PASCAL : adc1=$104; portB=$101; y:=PORT[adc1] {making one AD conversion}; PORT[portB]:=1 {switching relay #1}; Modern 12-bit ADCs and interrupt problems with fast PCs and basic problems with the operating system WINDOWS made this interface system obsolete.
Interfaces Built in Kiel3. ADTI on the PRINTER PORT Modern printer ports permit most bits to be defined as input or output. This allows the construction of some extremely simple interfaces: ADTI: 2-channel 12-bit ADC (multiplexed) with preamplifier, 2-channel digital in, 2-channel digital out, 12-bit DAC . RMI: 4 relays (max 3A/50V), 2 stepper-motor controls. Both interfaces can be operated simultaneously (LPT2 and extra LPT3) using Turbo Pascal.
Problems with Using Modern Hard- and Software in the Teaching Lab • Modern operating systems use multitasking. This prohibits time critical measurements. • Ports cannot be addressed directly. • Measurement of short times (<10ms) is difficult. • ISA-bus is too fast. • There are too many diverging port- and bus standards. • Programming languages (Delphi, Visual Basic, C++ etc) are very powerful and very complex. They take too much time from physics and should be left for professionals.
Interfaces Built in Kiel4) UNIMESS at the Serial Port Serial communication RS 232 An interface for a WINDOWS system needs intelligence: only with a microcontroller can one record a series of fast equidistant AD-values. The measuring routines must be programmed in the controller‘s assembly language. A programming language suitable for calling these routines, communicating with the PC and graphing and evaluating the data is the graphical language LabView.
PRO 33 independent I/O-lines 2 kB program EPROM 128 byte RAM 3 internal timers operating frequency up to 20 MHz SPI-/I2C bus etc. RISC architecture 8 stack levels minimal external hardware CONTRA no prepared data/address bus no internal data RAM no good development tools mathematical functions difficult The MicrocontrollerPIC 16C64
Producing the Source Codes Programming the PIC Compiling Emulation Universal-prommer(e.g.: ALL-03A) MPASM(Freeware) • Surrounding: • MPLAB 3.4 (Microchip Freeware) • MPDriveway (AiSys ca. 500$) Simulator PSIM(Freeware) Development Tools for thePIC 16C64 • In PIC-Assembler: • Texteditor PIC-In-Circuit-Emulator(app. 1500 DM) • In C: • C-Compiler (e.g. CCS 230DM)
UNIMESS Block Diagram 12-Bit AD-Converter 50 ksps ±10V (x1, x2, x4, x8) RAM for 1000 AD-Values 2 DA-Converters 12 Bit ±5V Motion Detector (not yet installed) Microcontroller PIC 16C64 16 Mhz 4 Digital I/O-Ports TTL Schmitt-Trigger Timer Function Basis 1s 2 Stepper-Motor Controls RS-232-Port to PC 38400 Baud 4 Relays 5A/250V/50W Power Connector +5V,±12V
Programming UNIMESS with LabViewA Graphical Programming Language The program code of an RC-control
UNIMESS and LabViewA Pair for the Physics Laboratory Contents of the Lab • no program code, object oriented programming • modern software, modern techniques of communication • frontend and program structure are produced by the student • a wide variety of physics problems can be solved parallel to learning LabView and interfacing Advantages • even students without any previous knowledge of programming can master the subjects in a very short time (about 3 times faster than with TURBO Pascal) • highly motivating by ‚instant results‘ and attractive graphics • very low price: LabView Student Edition DM 99,-- Material for Interface DM 400,--