599 Menlo Drive, Suite 100 Rocklin, California 95765, USA Office: (916) 624-8333 Fax: (916) 624-8003

General: [email protected] Technical: [email protected] Web Site: www.parallax.com Educational: www.parallax.com/sic

BS2pe Data Logger Application Note Parts used: • • • • • • •

BS2pe (#BS2PE) BS2p24 demo board (#45183) (suggested but not required) Parallel LCD (#603-00006) DS1822 (#604-00013) Push button (#400-00001) 10k ohm resistor (#150-01030) 4.7k ohm resistor (#150-04720)

General Information

The following code and setup will implement the BS2pe features of data logging, Parallel LCD interface, and expanded EEprom.

Control from a BASIC Stamp For easy wiring of the LCD, Parallax would suggest the BS2p24 demo board, but it is not required. The wiring for the LCD does require numerous I/O pins as seen below. If you use the demo board then you will not need to wire the LCD section below. DB7

P7 P6 P5 P4 P0 P2 P3

DB6 DB5 DB4

NOTE: Potentiometer between LCD pin 3 and ground is for optional contrast control.

E R/W RS

10 kΩ

Vdd

Connect LCD pin 3 directly to ground for maximum contrast.

Vss

Vdd 1

2

3

4

5

6

7

8

9

11 12 13 14

10 kΩ P13

Vss

Parallax, Inc. •

BS2pe data logger Version 1.0

Page 1

Vdd DS1822

4.7 kΩ

Vdd DQ

P15

GND

Vss

' Temp_lcd_data_demo.bs2 ' Purpose... Reads and displays information from a Dallas DS1822,and stores data across memory blocks. ' {$STAMP BS2pe} ' {$PBASIC 2.5} ' -----[ Declarations ]---------------------------------------------------OWpin CON 15 LCDpin CON 0 NoCmd CON $00 ' No command in LCDOUT ClrLCD CON $01 ' clear the LCD CrsrHm CON $02 ' move cursor to home position CrsLf CON $10 ' move cursor left CrsRt CON $14 ' move cursor right DispLf CON $18 ' shift displayed chars left DispRt CON $1C ' shift displayed chars right DDRam CON $80 ' Display Data RAM control CGRam CON $40 ' Custom character RAM Line1 CON $80 ' DDRAM address of line 1 Line2 CON $C0 ' DDRAM address of line 2 UNit_off CON $08 Unit_on CON $0d OW_FERst OW_BERst OW_BitMode OW_HighSpd

CON CON CON CON

%0001 %0010 %0100 %1000

' Front-End Reset ' Back-End Reset

ReadROM MatchROM SkipROM SearchROM

CON CON CON CON

$33 $55 $CC $F0

' ' ' '

CnvrtTemp RdScratch

CON CON

$44 $BE

' do temperature conversion ' read scratchpad

NoDevice DS1822 DegSym

CON CON CON

%11 $22 176

' no device present ' device code

DevCheck Idx RomData TempIn Sign TLo THi TSign TempF TempC Run_bit Bank Address Readings Temp

VAR Nib VAR Byte VAR Byte(8) VAR Word VAR tempIn.Bit11 VAR tempIn.LowByte VAR tempIn.HighByte VAR Bit VAR Word VAR Word Word VAR Byte Word Word VAR Word

VAR VAR VAR

' ' ' ' '

read ID, serial num, CRC look for specific device skip rom (one device) search

device check return ocde loop counter ROM data from DS1820 raw temperature 1 = negative temperature

' Fahrenheit ' Celsius 'bank address 'address 'Readings 'Work space varablie

' -----[ Initialization ]-------------------------------------------------' Initialize:

PAUSE 500 LCDCMD LCDpin,%00110000 LCDCMD LCDpin,%00110000 LCDCMD LCDpin,%00110000 LCDCMD LCDpin,%00100000 LCDCMD LCDpin,%00001100 LCDCMD LCDpin,%00000110 LCDCMD LCDpin,%00101000

Parallax, Inc. •

: : : : : : :

PAUSE PAUSE PAUSE PAUSE PAUSE PAUSE PAUSE

' let the LCD settle ' 8-bit mode

5 0 0 0 0 0 0

BS2pe data logger Version 1.0

' 4-bit mode ' no crsr, no blink ' inc crsr, no disp shift ' 2 Line 5x8 font

Page 2

LCDCMD LCDpin,ClrLCD pause 1000

' -----[ Main Routine ]---------------------------------------------------Bank = 1 Main: IF run_bit = 1 then Display_Temperatures GOSUB Device_Check ' look for device IF (devCheck <> NoDevice) THEN Get_ROM

No_Device_Found: LCDOUT LCDpin,Line1,[" No DS1822"] : PAUSE 5 LCDOUT LCDpin,Line2,[" Present"] PAUSE 1500 LCDCMD LCDpin,ClrLCD : PAUSE 0 LCDOUT LCDpin,Line1,["Insert Ds1822"] : PAUSE 5 LCDOUT LCDpin,Line2,["and reset stamp"] PAUSE 1500 LCDCMD LCDpin,ClrLCD : PAUSE 0 goto main Get_ROM: OWOUT OWpin,OW_FERst,[ReadROM] ' send Read ROM command OWIN OWpin,OW_BERst,[STR romData\8] ' read serial number & CRC IF (romData(0) = DS1822) THEN Show_Data LCDCMD LCDpin,ClrLCD : PAUSE 0 LCDOUT LCDpin,Line1,["Installed device"] PAUSE 5 LCDOUT LCDpin,Line2,["is not DS1822"] : PAUSE 5 LCDOUT LCDpin,NoCmd,["Code = ",HEX2 romData(0)] PAUSE 1500 goto main Show_Data: LCDCMD LCDpin,ClrLCD : PAUSE 0 LCDOUT LCDpin,Line1,["DS1822 Data"] PAUSE 1500 LCDCMD LCDpin,ClrLCD : PAUSE 0 LCDOUT LCDpin,Line1,["Serial Number : "] FOR idx = 6 TO 1 LCDOUT LCDpin,Line2,[HEX2 romData(idx)]

: PAUSE 5

NEXT PAUSE 1500 LCDCMD LCDpin,ClrLCD : PAUSE 0 LCDOUT LCDpin,Line1,["Checksum : ",HEX2 romData(7)] PAUSE 2000

Display_Temperatures: run_bit = 1 GOSUB Get_Temp LCDCMD LCDpin,ClrLCD : PAUSE 0 LCDOUT LCDpin,Line1,["Temp ","F:", SDEC tempF]

: PAUSE 0

skip_over: readings = tempF IF in13 = 0 THEN full GOSUB record GOTO Main ' -----[ Subroutines ]----------------------------------------------------' ' This subroutine checks to see if any 1-Wire devices are present on the ' bus. It does NOT search for ROM codes ' Device_Check: devCheck = 0 OWOUT OWpin,OW_FERst,[SearchROM] ' reset and start search OWIN OWpin,OW_BitMode,[devCheck.Bit1,devCheck.Bit0] RETURN

Parallax, Inc. •

BS2pe data logger Version 1.0

Page 3

Get_Temp: FOR temp = 1 TO 250 OWOUT OWpin,OW_FERst,[SkipROM,CnvrtTemp] PAUSE 1

' send conversion command ' give it some time

NEXT OWOUT OWIN tSign tempC tempC

OWpin,OW_FERst,[SkipROM,RdScratch] OWpin,OW_BERst,[tLo,tHi] = sign = tempIn = tempC >> 4

IF (tSign = 0) THEN NoNegC tempC = tempC | $FF00

' go get the temperature ' save sign bit ' round to whole degrees ' extend sign bits for negs

NoNegC: tempF = tempC */ $01CD IF tSign = 0 THEN NoNegF tempF = tempF | $FF00

' multiply by 1.8 ' if neg, extend sign bits

NoNegF: tempF = tempF + 32

' finish C -> F conversion

RETURN Full: FOR bank = 1 TO 15 FOR address = 0 TO 2048 step 2 STORE bank READ address ,readings.lowbyte READ address + 1,readings.highbyte LCDCMD LCDpin,ClrLCD : PAUSE 0 LCDOUT LCDpin,Line1,["Reading: ",dec address/2] : PAUSE 0 LCDOUT LCDpin,Line2,["Bank:",dec bank,"Temp ","F:", SDEC tempF] PAUSE 1000 ' lessen this pause to increase rate of display NEXT NEXT

: PAUSE 0

Sleeping: SLEEP 3 LCDCMD LCDpin,unit_off : PAUSE 0 IF IN12 = 1 THEN sleeping LCDCMD LCDpin,unit_on : PAUSE 0 GOTO sleeping

Record: PAUSE 1000 ‘Adjust to vary the rate of storage If address < 2040 THEN no_up bank = bank +1 address = 0 No_up: 'DEBUG 0,cr,"record: ",? bank,? address,? readings," Low ",dec readings.lowbyte," ",dec readings.highbyte STORE bank WRITE address ,readings.lowbyte WRITE address + 1,readings.highbyte address = address + 2 IF bank = 15 AND address = 2040 THEN filled return filled: LCDCMD LCDpin,ClrLCD : PAUSE 0 LCDOUT LCDpin,Line1,["Full"] : PAUSE 5 STOP

Parallax, Inc. •

BS2pe data logger Version 1.0

Page 4

High

Parallax BASIC Stamp 2pe Microcontroller Module - bs2pe-data ...

This subroutine checks to see if any 1-Wire devices are present on the ... BASIC Stamp 2pe Microcontroller Module - bs2pe-data-logger-appnote-bs2pe.pdf.

143KB Sizes 1 Downloads 82 Views

Recommend Documents

Basic Micro Basic ATOM Nano 18 Microcontroller Module - datasheet ...
Data Sheet. BasicATOM Nano 18 Data Sheet ... The BasicATOM Nano 18 uses the same IDE and language as the BasicATOM ... SER Programming pin. ... Basic Micro Basic ATOM Nano 18 Microcontroller Module - datasheet-b0086.pdf.

28140, 28340 - Parallax Inc
Oct 9, 2014 - Web Site: www.parallax.com ... RFID Card Reader Serial & USB (#28140 / 28340) v2.3 10/9/2014 Page 2 of 11 ... When the Parallax RFID Card Reader is connected to the host computer, it will appear as a Virtual COM.

PDF Download PIC Microcontroller Projects in C: Basic ...
PDF Download PIC Microcontroller Projects in C: Basic to Advanced Online Ebook. Books detail. Title : PDF Download PIC Microcontroller Projects in q. C: Basic to Advanced Online Ebook isbn : 0080999247 q. Book synopsis. [ PIC Microcontroller Projects

Module I Module II Module III Module IV Module V
THANKS FOR YOUR SUPPORT.MORE FILES DOWNLOAD ... Module VII. Marketing-Importance ,Scope-Creating and Delivering customer value-The marketing.

Read PIC Microcontroller Projects in C: Basic to ...
... Advanced E-Books, PIC Microcontroller Projects in C: Basic to Advanced Online , Read Best Book Online PIC Microcontroller Projects in C: Basic to Advanced ...

stamp act.pdf
Sign in. Page. 1. /. 4. Loading… Page 1 of 4. Page 1 of 4. Page 2 of 4. Page 2 of 4. Page 3 of 4. Page 3 of 4. stamp act.pdf. stamp act.pdf. Open. Extract.

THE BOMBAY STAMP ACT, 1958 - Mumbai Stamp Duty Mumbai ...
by Companies Act, securities contracts (Regulation)Act, SEBI Act and the latest being the. Depositories ..... and M/s. Century Enterprises were the Developers.

THE BOMBAY STAMP ACT, 1958 - Mumbai Stamp Duty Mumbai ...
promissory notes, bills of lading, letters of credit, policies of insurance, transfer of ... Act. Procedure for offences and for penalties are provided in Chapter VII. ... by Companies Act, securities contracts (Regulation)Act, SEBI Act and the lates

Stamp List
o Inspiring Words (Accents) Coordinates with Inspiring Words. MCT-029 o Inspiring ... MCT-107 o Lots of Love. MCT-097 o Love Collage Background Stamp. MCT-098 o Many Greetings. MCT-033 o Mixed Holiday Sentiments. MCT-036 o Mom You Rock. MCT-003 ... o

Stamp Collections for Sale
$360. 1419. UNITED NATIONS, New York and Geneva, Issues to 1975, most all mint, Never hinged. housed in Scott. 1½ inch Specialty 2-post binder. Collection ...

EE6612-MICROPROCESSOR-AND-MICROCONTROLLER ...
LIST OF EXPERIMENTS: 1. Simple arithmetic operations: addition ... Programming Practices with Simulators/Emulators/open source. 7. Read a key, interface display. 8. ... EasyEngineering.net. Page 3 of 86. EE6612-MICROPROCESSOR-AND-MICROCONTROLLER-LABO

Rubber Stamp Process.pdf
Robert Nothoff, Master's in Urban and Regional Planning. Contributing Authors: Eric Altman, Carolina Sarmiento. RUBBER. STAMP RUBBER RUBBER STAMP ...

CS6412-MICROPROCESSOR-AND-MICROCONTROLLER ...
www.EasyEngineering.net. Page 3 of 101. CS6412-MICROPROCESSOR-AND-MICROCONTROLLER-LABORATORY- By EasyEngineering.net.pdf.

EE6612-MICROPROCESSOR-AND-MICROCONTROLLER ...
TOTAL: 45 PERIODS. Visit : www.EasyEngineering.net. www.EasyEngineering.net. Page 3 of 86. EE6612-MICROPROCESSOR-AND-MICROCONTROLLER-LABORATORY- By EasyEngineering.net.pdf. EE6612-MICROPROCESSOR-AND-MICROCONTROLLER-LABORATORY- By EasyEngineering.net.

PART I Module I: Module II
networks,sinusoidal steady state analysis,resonance,basic filter concept,ideal current ... spherical charge distribution,Ampere's and Biot-Savart's law,Inductance ...

pdf-89\hominids-neanderthal-parallax-book-1-by ... - Drive
pdf-89\hominids-neanderthal-parallax-book-1-by-robert-j-sawyer.pdf. pdf-89\hominids-neanderthal-parallax-book-1-by-robert-j-sawyer.pdf. Open. Extract.