750 sampled values in an eeprom - cdn.eleinfo.ircdn.eleinfo.ir/el1990-1999/pdf/1996/e969018.pdf ·...

5
;' ~ \~,~ MatchBox BASIC computer as data logger 1 V24 pe , _____ J paremeter setting ,"d data exchange A data logger is a cir- cuit which records, collects and stores measured values over a certain period of time. The MatchBox BASIC computer is a great starting point for such a system, because it only needs a small extern al A/D converter and a suit- able program. The MatchBox data logger we present here is capable of storing up to 750 measured val- ues. ~ Design by Dr. M Ohsmann 18 750 sampled values in an EEPROM ,......>---1+ 5V 5V + ~--------4 4flFJoon with 16 kBIT EEPROM 24164 Pt.7 MATCHBOX Pl.2 MAXIM MAX187 Pl.2 Pt.t 7 PU Pl.0 8 P1.0 4 C, 4\.17 16V 960065 - 11 TRESET Figure 7. This simple extension circuit turns the MatchBox BAS/C computer into a versa- tile data logger. Electronics tcst and measureruent jobs often mean that you are on the road, that is. not in the safe and fa- miliar surroundings of the laboratory or the workshop. The help of a data logger system Is particulary valued if you wish to record a series of measure- ments at a certain lo- cation, and also need to take the measure- ment va lues horne with you for examina- ticn, statistics or any Figure 2. Examp/e of a NICd battery discharg- ing vo/tage graph, as recorded by the data logger. 1.50\1 K: - - i'-. -- \ -- \ " ...... 1.25V 1.00V 750.00mV 500.00mV 250.00mV o.oov 0.00 150.00 450.00 600.00 750.00 960065·12 300.00 Elektor Electrorucs 9/96

Upload: dangtu

Post on 29-Jun-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

;' ~

\~, ~ MatchBox BASICcomputer as data logger

1

V24pe

,

_____ J

paremeter setting,"d

data exchange

A data logger is a cir-cuit which records,collects and stores

measured values overa certain period of

time. The MatchBoxBASIC computer is a

great starting pointfor such a system,

because it only needsa small extern al A/D

converter and a suit-able program. The

MatchBox data loggerwe present here is

capable of storing upto 750 measured val-

ues.~

Design by Dr. M Ohsmann

18

750 sampled valuesin an EEPROM

,......>---1+ 5V 5V +

~--------4 4flFJoon

with16 kBIT

EEPROM24164

Pt.7

MATCHBOXPl.2 MAXIM

MAX187Pl.2

Pt.t 7 PU

Pl.0 8 P1.0

4C,

4\.17 16V

960065 - 11

TRESETFigure 7. This simpleextension circuit turnsthe MatchBox BAS/Ccomputer into a versa-tile data logger.

Electronics tcst andmeasureruent jobsoften mean that youare on the road, that is.not in the safe and fa-miliar surroundings ofthe laboratory or theworkshop. The help ofa data logger system Is

particulary valued ifyou wish to record aseries of measure-ments at a certain lo-cation, and also needto take the measure-ment va lues hornewith you for examina-ticn, statistics or any

Figure 2. Examp/e of aNICd battery discharg-ing vo/tage graph, asrecorded by the datalogger.

1.50\1

K: -- i'-.-- \-- \" ......

1.25V

1.00V

750.00mV

500.00mV

250.00mV

o.oov0.00 150.00 450.00 600.00 750.00

960065·12

300.00

Elektor Electrorucs 9/96

Datalogger

l- ..950065 -13

Flgure 3. Circuit torthe battery capacitytest application.

form of analysis using a computcr Thedata logger. usually a small and low-cost device, uses fixed intervals to col-lect a large number of measured val-ues in a memory. The computer isthen able to read these values from themcmory, and use them in a prograrn.

As a matter of course, the data log-ger shou1d have some intelligence to en-sure that the measurement procedure istimely initiated and correctly finished.Here, these functions are carried out bya program runntng on the MatchBoxBASICcomputer (Ref. I). The programcontrols a 12-bit serial A-D (analogue-to-digital) converter and enters each andevery measurement value at the rightaddress in the mernory

The measurement interval is de-fined beforehand in the laberatory er athome using the PC and the serial in-terface. Because the measurement val-ues are stored in an EEPROM, thepower supply may be switched offwithout problems once all sampies aremeasured and collected. This obviatesthe use of a complex battery backup cir-cuit.

BEFORE THE MEA-SUREMENT

The extension circuit that turns theMatchBox BAS1C computer into a datalogger is shown in Figure 1. A 12-bit A-D converter with serial output is COI1-

nected to the MatchBox BASIC com-puter via port PI. The data loggingprocess is started by pressing theswitch connected to line P1.6. An LED,Dl, enables the user to monitor the op-eration of the da ta logger. The pe isconnected to the RS232 interface onthe MatchBox BASICcomputer. It es-sential that the Matchbox computer befitted with a 16-kBit EEPROM (for ex-ample, an X24164 from Xicor). If not,you may not have enough memorycapacity to store 750 values.

The circuit is easily built on a small

Figure 4. This program en-ables the MatchBox BASICcomputer to act as a datalogger.

Elektor Electronics

end of RAM or key-hit stops LOGGING

project OATLOG1_MBLsubject:

Matchbox Oatalogger with MAX187

24C16 EEPROMprogramdata

750 Values, 1 per1 per1 per

about 512 bytes2048-512=1536 bytes

sec -> > 12 minutesmin -> > 12 h

10 min -> > 5 days

750 integer values

RESOURCEIIC-EEPROM 0800H BYTES @05000HRESOURCE80S1-IRAM lOH BYTES @070H

BYTE COMCHR ;INTEGER PTR,DUMPPTRINTEGER EEPROMT j

; for MAXIM conversionINTEGER LOGMAX,K,value,Tcnt

INTEGER EEPROMLOGRAM [ 750 j

ON INT GOSUBLOGDATA

P1_7:=0 ; turn on LED

RESTART:PRINT(' "OD"OA*>' )TlMER(O,O)Tcnt :=0FORMAT(DLENGTH=O ZUr)LOGMAX:=750WHILE PL 6:1 00

IF TSTC THENGOSUBCOMMAND

PRINT( "'OO"OA*>')ENDIF

WHENDPL7:=0 ;WHILE P1. 6=0 00

WHENOPI.7:=1 ij turn off LEO, logging startsSTARTLOG:

PTR:=O ; point to first memorySETBITS(INTena,TIMena) ; enable timer interruptTlMER( 192,4800) ; start the timerPRINT( '''OD''OASTART T=' ,T, '''OO''OA') ; print a start message via RS232WEILE TESTBITS{INTena) 00 while INTena is set, the datalogger is logging

WHENOGOTO RESTART

send the PROMPTto RS232stop the timercounts time between sampiesok, simple decimal outputsamples run from O•• LOGMAXwait for KEY-pressedif RS232 char then res pond to it

send prompt again

; key is pressed, turn on LEO again; wait for key release

; after logging restart with LED off

execute RS232 commandsCOMMAND:COMCHR::GETCIF COMCHR='T' THEN

PRINT( 'T=')T:=GETDECPRINT( '''OOH''OAT=' ,TlENDIF

IF COMCHR='O' THENPRINT('DUMP, T=',T,'''OO''OA')DUMPPTR:=O ;WHILE OUMPPTR<T45>GMAX00

IF TSTC THENGOTO COMMANOENDIF

PRINT(DUMPPTR,' ',LOGRAM[OUMPPTRj,'''OD''OA') ;OUMPPTR:=DUMPPTR+1WHENO

PRINT('!')ENOIF

RETURN

time set command

enter time between sampies in secondsEcho (acknowledge)

OUMPdata command

i any CHAR aborts durnp

i this says all data Ls dumped

LOGDATA:PL7:=0Tcnt:=Tcnt+lPL7:=1IF Tcnt>=T THEN

PL7::0Tcnt:=OGOSUBREADMAXIMPRINT(PTR,':' ,value,' "OOI/OA')PL 7 :=1LOGRAM[PTR)r=va.IuePTR::PTR+lENDIF

LED on flash

LED off flashtime between samples over ?(makel long flashre set time between sampiesread in the AD converter

; printout to enable watch of LOGGING

store valueincrement memory pointer

IF PTR>LOGMAX OR s i .6=0 THENPTR:=O

9/96 19

piece of stripboard, which is connectedto the Matchbox BASIC computer viaconnector Kl. The board is then builtinto a small case. This results in aportable data logger which is capableof gathering data for hOLUSon end, allalone, and onJy powered by a battery.

The A-D converter used ls a typeMAX187 from Maxim. lt is capable ofconverting measurement va lues be-tween ° V and 4.096 V If you wish tomeasure other voltage levels, then anappropriate voltage divider or a smallpreamplifier may have to be con-nected at the input of the MAX187.

The normal Input voltage range is,however; perfect for measuring the dis-eherging voltage of a rechargeable bat-tery, to mention but an example. Agraph that indicates the results of sucha measurement session is shown inFigure 2. The relevant measurementset up is shown in Figure 3. Sam pieswere recorded at 5-second intervals.After about 450 times 5 seconds, orabout 40 mlnutes, the voltage dropsrapidly, indicating that the battery isexhausted.

The program listed in Figure 4 issent to the MatchBox BASIC computerusing the download utility whichcomes with the MBC softwate. Theoperation of the program 1Seasily un-ravelled by refemng to the commentwith most instructions. Once the pro-gram is stored in the EEPROM on theMatchbox board, a terminal emulationprogram (like Procomm or Hyper Ter-minal) may be used to communicatewith the data logger.

The procedure to program the in-terval between sam pies is as fallows.Interconnect the pe and the MatchBoxBASIC computer via the respective se-riaJ interfaces, then start the Matchbox.The data logger program should re-port with the *> prompt. Next, type Tand then the number of seconds (0 to30,000) which should eJapse betweenthe sampling instants. The data loggershould then re port again with its ">prompt.

LOGGING AND READINGTa actually record measurement val-lies, the pe is disconnected frOITIthedata logger. If you wish, you mayswitch off the MatchBox supply Be-cause the previously entered mea-surement interval is stored in EEP-ROM, this Information is not lost.Next, you connect the measurementinput of the data logger to the signalto be measured, and power up theMatchBox computer. LED D1 willlight. Press SI to start the measuringprocess. The data logger starts torecord measured values as soon as yourelease the presskey. LED DI lightsbriefly at a rate of about 1 Hz, and a lit-tIe longer dunng the actual measure-ment. It goes out after a11 750 mea-

Ejektor EJectronics

CLEARBITS(INTena)ENDIF

CLEARBITS(TIMint)IRETURN

stop DATAlogging

signalise end of interrupt

The following subroutine reads the MAXIM187 I2-Bit AO converterconnection of the MAX187:

Pl.l MAXI87 CLOCKPI. Q Max187 CSPI.2 MAX187DOUT

READ MAXIM:PloO:=1Pl.l:=OPlo2:=1P1.0:=Q; the MAX187is fast,i WHILEPl.2=0 00; WHENDP1.1 :=1value:=OK:=l1 ;WHILEK>=Q 00

Pl.l:=Ovalue:=(value SHL 1)+Pl.2Pl.l: =1K:=K-l

WHEND;RETURN

; CSset clock line LOW

; we want port as input pi nes active

so we need not waitwait for MAX187-0UTline to become HIGH

END

DUMP, T=5o 12231 1214

749 46750 46

Figure 5. Output for-mat of the data col-lected by the data log-ger system (example).

surements have been made. You maythen switeh off the MatehBox and takeit back to the PC to enable the col-leeted data to be read out.

The data logging operation may bere-started any time simply by pressing5]. while the data logger is measuring,it also transmits the currently readvalue via the serial interface.

Onee reconneeted to the PC, youstart the MatchBox BASIC computeragain. The unit should report with the"> prompt. Transmit the character 0(for Dump) frorn the PC The Match-Box will respond by returning all pre-viously recorded data as illustrated bythe example shown in Figure 5. Thefirst line teils you the timing interval atwh ich sampies were captured. Thenfollow 75] lines, all containing mea-surement values. In the rechargeablebattery example, the initial voltage(found in line 0) was 1,223 mY, whilethe final volta ge (751st measurementresulr) was 46 mv First, the number ofthe measurement is produced, thenthe measured value.

9/96

clockvalue holds theread 12 bits

MAX conversion result

clockshiftclock

goes lowin the bi t;goes high again

Measured values are in milli volts(mV). In the last line, the exclamationmark (!) marks the end of the ITIea-surement values. Using the terminalprogram running on the PC, these val-ues may be stored in a file for pro-cessing later.

PROGRAM DESCRIPTIONThe program that turns the Matchßoxinto a data logger is shown in Figure 4.H is not too long, and eastly entered bytyping it in. Store the program as anASCII file on your PC Unfortunately,the program is not available on diskthrough our Readers Services.

A few points may be no ted aboutthe program. The timing of the sam-pling process is arranged by the inter-nal MatchBox timer; which is pro-grammed (in lines 28 and 45) to gen-erate an interrupf every second. Therelevant MatchBox interrupt is enabledby line 44, so that the interrupf routinein lines 73 to 92 is selected onee everyseeond during the Jogging process.

The program may be modified inmany ways to suit individual require-ments. You may, for example, decideto use the rc compatible typePCF9591 A-D converter to enable datato be captured on four channels at aresolution of eight bits. The programshould require only minor modifica-tions to support this cornponent. Theprocedure which reads data from theMAX187 may, of course, also be usedfor other MatchBox projects in whicha 12-bit A-D converter is applied.

(%0065)

Reference:1. MatchBox BASIC computcr, ElektorElectronics Oetober, November, De-cember 1995.

21

64-channel logic analyser(May 1996, p. 35-43, 960033)

Constructors using the ready-made print-ed circuit boards lor this project shouldnote that capacitors C25, C35 and C45were not included in the circuit diagrams,PCS layouts and parts lists as printed inthe magazine. These capacitors affordadditional supply decoupling, and shouldhave a value 0110!1F,16V.

Channels 48 through 64 (probe D) arenot available because IC40 can not beselected. The problem is simple to solveby connecting pin 28 (CSTI)and 32 (CSl)01 IC40 to ground (see drawing). The cir-cuit diagram on page 38 should be cor-rected likewise.

Finally, on the main board, coppertracks run very close to the board mount-ing hole near pins 49/50 01connector K4.Care should be taken notto cause short-circuits here by PCB spacers or screws.

Matchbox BASIC computeras data logger(September 1996, p. 18-21, 960065)

Dwing to a conversion mistake in the elec-tronic page layout process, all underscorecharacters (_) have disappeared lram thelisting on page 19. Readers wishing toobtain a Iree copy 01the corrected listing(on paper) may apply to our CustomerServices department in Dorchester.

SIMM tester(February 1996, p. 18-26, 960039)

II last SIMMs are tested, a bus conllictmay arise, causing a latch-up situationand an incorrect message stating that theSIMM is laulty. This ~ happen becausebuffer IC13 uses the RD signal to reverseits direction, while the SIMM does sousing the WR signal.This problem may be solved as lollows:a. Disconnect pin 1 01 IC13, and connect

itto pin 12 01ICB (a non-used inverter).b. Disconnect pin 1301 ICB, and connect

it to pin 2 01 IC7 (WR).c. Disconnect pin 19 01 IC13, and con-

nect itto pin 2 01 ICB.

Keyboard swap for PCs(June 1996, p. 40-43, 950126)

Secause resistors R5 and R6 may lorma too large load lor IC1, the PC may notreceive any1hing although the LEDs indi-cate that one 01the keyboards is active.This problem may be solved by increas-ing the value 01R5 and R6 to 1kQ. II theLED intensity is reduced too much, high-efficiency LEDs should be used.

86

960033-2d

Video test chart generator(October 1996, p. 24-29, 960076)The S-VHS output may oscillate. Thisproblem may be solved by litting a330-pF ceramic capacitor betweenjunction R16/C3 and the ground con-

nection 01 C11 (at the underside 01the board, see drawing).

The value 01capacitor C14 has to beincreased Irom 1OOnFto 470nF.

The modulator case has to be solderedto the ground plane 01the PCB. This maybe achieved by litting solder pins near thecorners 01the modulator (drill additionalholes), or by removing the protective lac-Quer in these locations, and sold er themodulator case directly to the groundplane.

U2402B ballery charger(April 1996, p. 10-15, 950120)

In the circuit diagram on page 12, theswitch idenüfiedas S2a (near R22) shouldbe S2c.

Oscilloscope prescaler(November 1995, p. 28-34, 950115)A number 01 readers have reported tim-ing problems with the RAMs used in thecircuit. For these RAMs, a short periodappears to be necessary between the'address stable' and 'write enable low'instants.

Two solutions are available:1. Use the type GM76C2BA-10 lrom Gold-

star in position IC13. This RAM chipwas also used in our prototype.

2. Modily the PCB as lollows:- desolder the socket for IC9;- cut the connection between pins 1 and

2 of IC9 at the component side 01theboard;

- fit a new IC socket;- connect a short isolated wire between

pin 2 01 IC9, and pin 10 011C6.

The latter solutlon causes a delay 0123B ns on the WE line, enabling the cir-cuit to work with RAMs having a specifi-cation other than tas=0 also.

Elektor Electronics 12/96

SWITCHBOARDSwitchboard allows all PRIVATE READERS ofElektor Electronicsone FREE advertisementof up 10108 characters, including spaces,commaa. numerals, etc., per month.

Write the advertisement, which MUSTrelate 10 electronics, in the coupon on thispage; it MUST INCLUDE a private telephonenumber or name and address; post officeboxes are NOT acceptable.

Elektor Electronics (Publishing) can not ac-cept responsibility for any correspondence ortransaction as a result of a tree advertisementor of any inaccuracy in the text 01 such an ad-vertisement.

Advertisements will be placed In the orderin whlch they are received.

Elektor Electronics (Publishing) reservethe right 10 refuse advertisements withoutgiving reasons or without returning them.

FOR SALE. EPROM programmer and agreat deal of hardware add-ons for aBBC computer. Write to Robert Sprow-san, 6 Bolinbrook Road, Macclesfield,Cheshire SKI9 3DJ.

WANTED. COM3XOI Twinax controllerchip: please contact Indrajit one-mail:[email protected]

FOR SALE. I Mbit EPROMs. 5:2 each.Phone Andrew on 01315567181.

WANTED. Sage Audio Supermos 2modules. Desperately needed. Phone DBell at 01656725319 (South Wales).

FOR SALE. WEKAElectronic RepoirManual and Modern Amateur Electronic

Manual. Both plus two supplements:>:20 each (MO new). wrtte to W. Allen.47 Westthorpe Gardens, Hendon, Lon-don NW4 lTU or phone 0181 2036023.

WANTED. Details on radio data systemencoders, circutt dtagrams or w.h.y.Phone Paul on 0976 725 684 or e-mail1D6004.2306

WANTED. Someone to flntsh RF pro-ject. Willing to pay. Phone Paul on04D2 742744.

WANTED for Casio keyboard IT -50.RAM pack; also TA-I interface plug-inmodule requjred. Have tried every-where - please help. Write to N.H.HilI.179 Mersey House. H.M.P. Channingswood. Denbury. Newton Abbot. DevonTQI26DW.

FOR SALE. vtdeocrypt decoders TypeSVAI, price >:1Deach plus postage.Phone 0118 970 1163.

FOR SALE. Tektronox Logic AnalyserModel 7603+DFl+7D01. Has no podsor manuals, but believed working.Price >:295. Phone Mark on 01817617259.

WANTED. 2764 EPROM (programmed)for MIDI-to-CV interface from ElektorElectronics January 1991. Phone Larson +45 4353 3218 (Denmark)

WANTED. Someone to build TV signalprocesstng project. PCB and most bitssupplied. Willing to pay. Phone Ron onD402 742744 or 0976 895273.

WANTED. Late Labcenter PCB draw-tng, software wtth manuals. PhoneMark on 01817617259.

Send this coupon toElektor Electronics (Publishing)

P.O. Box 1414Derchester DT2 8VH

England

Block capttats please - one character to each box

ELEKTOR ELECTRONICS 5/97

Name and address MUSTbe given

FOR SALE. Low-cost PCB drill-stand &UV Ughtbox plans. >:2·00 each. wrttcto R. Hammond. 34 Gould Firm Lane,Aldrtdge, West Midlands WS9 Ol.X,

~CDRRECTIDN§ ~ U. ~

Dark-room timer(October 1996 . 960086)The proposed stop scale for thetimer (Figure 5) should be turnedaround because the delay timeincreases when the control isturned clockwise. Also, the valueof C1 is incorrectly given as 1 fJFin the parts list, whereas the cor-rect value is 1.8 fJF as shown inthe circuit diagram.

Matchbox BASIC comput-er as data logger(September 1996 - 960065)Owing to a text conversion error,all underscores in the names ofvariables have dropped out 01 theprogram listing shown in Figure 4.The correct variable names areLOG MAX, START LOG,COl\tCHR. LOG":-RAM,LOG_oATA, REAo_MAXIM andoUMP_PTR.Also. The compiler is unable toprocess the lineWHILE oUMP _PTRG MAX 00which is best replaced byWHILE oUMP ]TR GMAX 00

ElektorElectronics

Motor controller lor R/Cmodels(February 1997 • 960095) ,jXThe text incorrectly states that 01and O2 are not required for unidi-rectional mode. This should be 01and T1. The penultimate paragraphon page 17 and the first completeparagraph in the right-hand col-umn on page 18 should beamended accordingly.

68HC11 Emulator(February 1997 . 970008~The correct name of the Talker foruse with a 5 MHz crystal isTKAXTS_ BOO(inset Talkers tor usewith Ihe emulaIar, page 25).Contrary to what is stated underthe Applications examples, FAQsheading, the Hi-Tech compiler isnot in the M11 oISK\UTILI\ dlrec-tory. Users having access to ver-sion 7 of this compiler may,however. use SYMWICE.EXE tobuild a small high· level debugger.Likewise, the SYMWICE.Cfile mayhelp users of other compilers orearlier versions of the Hi-Tech

5/97

compiler. SYMWICE.EXE alsoworks for the WICE emulator.The text In the laffer case, ports Band C ... (page23, third linetrom thebottom) should be corrected to read:In both cases, ports Band C ..The TL7705 will switch at a low-supply voltage of 4.5 V, not 3.6 Vas stated at the top of the right·hand column on page 24. The ref-erence voltaqe is calculated from:Vrer (R2+R1)/R1 =2.53x178/10 = 4.5 V.

oscillation may upset the normaloperation 01 the circurr.The problemls remedied by fitting a 47fJF/25Veleclrolytic cspacnor in parallel wrrhC2 at the track side ot the board. Therelevantconnections should be keptas short as possible.The settings 01 the three presetson the board are determined to alarge extent by the quality of theapplied S/POIFsignal. The settingsare, therefore, dependent on thedigital signal source.

Simple inductance meter Icr meter - part 1(February 1997-970009) K (April 1997 . 970028/1)In the circult diagram on page 32. Some unlortunate errors havediodes O2 through 09 should be crept into some text and the boxconnected to K1 pins 2 through 9, on p. 32.not pins 1 through 8. The layout In the 8th line, centre colurnn,of the printed circuit board is not 102/105 should read 102//105.affected. leut in the 9th and 12th lines

should read ldot (where dot is thedevice on test).

In the formulas in the box, 2nishould read 21[i in all five cases.The first formula should start:U1COS~1 = ,and the second for-mula: U1sinf1'

Copybit inverter l\.. /(January 1996 - 950104) \)'-The input stage around gate IC1,may start to oscillate when the opti·mum sensitivity is reached byadiusting preset P1. This spurious

61