45184 Parallax Inc, 45184 Datasheet
45184
Related parts for 45184
45184 Summary of contents
Page 1
... LED Normally-open pushbutton switch 32.678 kHz crystal Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 599 Menlo Drive, Suite 100 Rocklin, California 95765, USA Office: (916) 624-8333 Fax: (916) 624-8003 General: info@parallaxinc.com Technical: stamptech@parallaxinc ...
Page 2
... Off CON 0 ' -----[ Variables ]------------------------------------------------------------ ' cmd VAR Byte Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' connect LCD to OutL ' No command in LCDOUT ' clear the LCD ' move cursor to home position ' move cursor left ' move cursor right ' shift displayed chars left ' shift displayed chars right ...
Page 3
... Block_Cursor: cmd = DispCtrl display = On blinking = On LCDCMD LCDpin,cmd PAUSE 2000 blinking = Off Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' display on/off bit ' cursor on/off bit ' blinking on/off bit ' character sent to LCD ' loop counter ' let the LCD settle ' 8-bit mode ...
Page 4
... NEXT PAUSE 1000 FOR idx = LCDCMD LCDpin,DispLf PAUSE 100 NEXT PAUSE 1000 GOTO Main END ' -----[ Subroutines ]---------------------------------------------------------- ' Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' flash display by ' toggling display bit ' shift display to right ' shift display back ' do it all over Page 4 ...
Page 5
... Line1 CON $80 Line2 CON $C0 ' -----[ Variables ]------------------------------------------------------------ ' Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 When using the standard 5x7 font, the LCD ' connect LCD to OutL ' No command in LCDOUT ' clear the LCD ' move cursor to home position ' move cursor left ' move cursor right ...
Page 6
... LCDOUT LCDpin,cmd,[char] PAUSE 100 NEXT NEXT PAUSE 3000 GOTO Main END Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' commnand sent to LCD ' character sent to LCD ' new character for animation ' address in EE and display ' character number ' revealed message ' let the LCD settle ...
Page 7
... Subroutines ]---------------------------------------------------------- ' Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 Page 7 ...
Page 8
... CON $C0 CLines CON 8 Space CON 10 Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 This program creates three custom characters that ' connect LCD to OutL ' No command in LCDOUT ' clear the LCD ' move cursor to home position ' move cursor left ' move cursor right ' shift displayed chars left ...
Page 9
... DIG cNum IF (cNum < (addr > 0) THEN DigitOK addr = Space DigitOK: addr = addr * CLines GOSUB Update_CC NEXT Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' character sent to LCD ' EE starting address of map ' character number ' loop counter ' let the LCD settle ' 8-bit mode ...
Page 10
... LCDCMD LCDpin,(CGRam + (cNum * CLines)) FOR idx = 0 TO (CLines - 1) READ (addr + idx),char LCDOUT LCDpin,NoCmd,[char] NEXT RETURN Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' update custom character ' point to character map ' get data for character line ' write to LCD CGRAM Page 10 ...
Page 11
... CON $10 CrsrRt CON $14 DispLf CON $18 Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 This makes the math for calculating ' connect LCD to OutL ' No command in LCDOUT ' clear the LCD ' move cursor to home position ' move cursor left ' move cursor right ' shift displayed chars left ...
Page 12
... MapStart CON Char0i ' -----[ Initialization ]------------------------------------------------------- ' Initialize: Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' shift displayed chars right ' Display Data RAM control ' Custom character RAM ' DDRAM address of line 1 ' DDRAM address of line 2 ' lines per character ' animated odometer character ...
Page 13
... RETURN RJ_Print: digits = width LOOKDOWN temp,<[0,10,100,1000,65535],digits LCDOUT LCDpin,pos,[REP " "\(width-digits),DEC temp] RETURN Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' let the LCD settle ' 8-bit mode ' 4-bit mode ' 2-line mode ' no crsr, no blink ' inc crsr, no disp shift ' put " ...
Page 14
... Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 Page 14 ...
Page 15
... Refer to the Hitachi HD44780 documentation for details on LCD control. ' -----[ Revision History ]----------------------------------------------------- ' Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 A simple conversion routine can be used to replace The pin will read 1 when the The LCD This pin is connected to ...
Page 16
... LCDCMD LCDpin,%00110000 : PAUSE 0 LCDCMD LCDpin,%00100000 : PAUSE 0 LCDCMD LCDpin,%00100100 : PAUSE 0 LCDCMD LCDpin,%00001100 : PAUSE 0 LCDCMD LCDpin,%00000110 Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' LCD is connected to OutL ' Ask button input pin ' No command in LCDOUT ' clear the LCD ...
Page 17
... IF (clock > 0) THEN Shuffle_Done LOOKUP pntr,["-+|*"],char LCDOUT LCDpin,DDRam + 15,[char] pntr = pntr + Shuffle_Done: RETURN Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' clear the LCD ' print prompt ' shuffle until button pressed ' give time to read answer ' do it all over ...
Page 18
... I2CIN and I2COUT commands support this with an address parameter (this byte ' comes after the Slave Address byte). ' byte with a value that reflects the desired state of the I/O pins, where Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 If that bit is high (button is With the PCF8574, replace the address ...
Page 19
... Nib ' -----[ EEPROM Data ]---------------------------------------------------------- ' ' -----[ Initialization ]------------------------------------------------------- ' Initialize: DEBUG CLS Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 This is easily accomplished This input is connected The input will read 1 when The tilde (~) in front of the variable ' SDA on 8; SCL Device type ' address = %000 -> %111 ...
Page 20
... IF (btn) THEN Main cntr = cntr + DEBUG Home, 10, 10, 10, BIN2 cntr I2COUT I2Cpin, Wr8574, MixDDR, [~cntr] PAUSE 200 GOTO Main ' -----[ Subroutines ]---------------------------------------------------------- ' Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' wait for press ' update counter ' display on screen ' send new value Page 20 ...
Page 21
... To run this program on the BS2p Demo Board, connect the LCD and install ' Jumper X3 Refer to the Hitachi HD44780 documentation for details on LCD control. ' -----[ Revision History ]----------------------------------------------------- ' ' -----[ I/O Definitions ]------------------------------------------------------ ' Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 When the program starts, you If Yes, you'll enter the hours, Page 21 ...
Page 22
... Byte idx VAR Byte response VAR Byte ' -----[ EEPROM Data ]---------------------------------------------------------- ' Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' LCD is connected to OutL ' SDA on 8; SCL serial receive (from DEBUG) ' device type ' address = %000 -> %001 ' write to PCF8583 ' read from PCF8583 ' just print ...
Page 23
... DEBUG CR, "Day (0.. Sunday]): " SERIN RxD,Baud96,[DEC1 day] IF (day < 7) THEN Set_The_Clock day = 0 Set_The_Clock: month = 9 date = 18 year = 1 GOSUB Put_Clock Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 SUNDAY",0 MONDAY",0 TUESDAY",0 FRIDAY",0 ' open DEBUG window ' let LCD settle ' 8-bit mode ' 4-bit mode ...
Page 24
... RETURN Print_Day: LOOKUP day,[Su,Mo,Tu,We,Th,Fr,Sa],eeAddr Print_Loop: READ eeAddr,char IF (char = 0) THEN Print_Done Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' send data to register ' get data from register ' set with rawTime ' convert regs to BCD ' pack weekday in ' write time & day ...
Page 25
... LCDOUT LCDpin,NoCmd,[char] eeAddr = eeAddr + 1 GOTO Print_Loop: Print_Done: RETURN Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' print the character ' point to next ' go get it Page 25 ...
Page 26
... Note that the first byte transmitted in a read cycle contains the conversion Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 Channes 2 and 3 are tied to Vss. In this demo, the analog output ...
Page 27
... DEBUG "Channel ", DEC1 chan, " In... ", DEC aIn(chan), " mVolts = aIn(chan) */ MVPB DEBUG "(", DEC mVolts DIG 3, ".", DEC3 mVolts, " volts)", CR Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' SDA on 8; SCL device type ' address = %000 -> ...
Page 28
... NEXT PAUSE 500 aOut = aOut + 1 GOTO Set_D2A END ' -----[ Subroutines ]---------------------------------------------------------- ' Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' delay between updates ' increment analog output ' go again Page 28 ...
Page 29
... Jumper X6 Refer to the Hitachi HD44780 documentation for details on LCD control. ' -----[ I/O Definitions ]------------------------------------------------------ ' LCDpin CON 0 I2Cpin CON 8 Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 The status of the Connect the LCD LCD is connected to OutL ' SDA on 8; SCL on 9 Page 29 ...
Page 30
... LCDCMD LCDpin,%00110000 : PAUSE 0 LCDCMD LCDpin,%00100000 : PAUSE 0 LCDCMD LCDpin,%00101000 : PAUSE 0 LCDCMD LCDpin,%00001100 : PAUSE 0 LCDCMD LCDpin,%00000110 Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' device type ' address = %000 -> %111 ' write to 24LC32 ' read from 24LC32 ' highest EE address ...
Page 31
... RJ_Print: digits = width LOOKDOWN temp,<[0,10,100,1000,65535],digits LCDOUT LCDpin,pos,[REP " "\(width-digits),DEC temp] RETURN Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' write to CGRAM (character 2) ' build custom char ' get byte from EEPROM ' put into LCD CG RAM BS2P <-> I",2,"C"] Out=" ...
Page 32
... VAR Word strPtr VAR Word char VAR Byte Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 Data is displayed in DEBUG window ' 1-wire device pin ' Front-End Reset ' Back-End Reset ' read ID, serial num, CRC ' search ' no device present ' names are stored in slot 1 ...
Page 33
... This subroutine is used to display the part number of a 1-Wire device. ' The text data and pointers to it are stored in the different ' program slot. Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' let DEBUG window open ' look for device ' send Read ROM command ' read serial number & ...
Page 34
... FCode14 DATA "DS1971/DS2430",0 FCode23 DATA "DS1973/DS2433",0 ' iButtons Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' calulate string pointer addr ' point to names EEPROM ' get the string location ' read character from string ' at end Yes) ' no, print the char ' point to next char ...
Page 35
... DATA @$21*2+PntrBase,Word DS1921 DATA @$05*2+PntrBase,Word DS2405 DATA @$0B*2+PntrBase,Word DS2505 DATA @$0F*2+PntrBase,Word DS2506 DATA @$12*2+PntrBase,Word DS2406 DATA @$20*2+PntrBase,Word DS2450 DATA @$22*2+PntrBase,Word DS1822 DATA @$27*2+PntrBase,Word DS2417 DATA @$28*2+PntrBase,Word DS18B20 DATA @$2C*2+PntrBase,Word DS2890 Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 Page 35 ...
Page 36
... CON %0010 OW_BitMode CON %0100 OW_HighSpd CON %1000 Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 Data is displayed on a 2x16 LCD. ' connect LCD to OutL ' 1-wire device pin ' No command in LCDOUT ' clear the LCD ' move cursor to home position ' move cursor left ...
Page 37
... LCDCMD LCDpin,ClrLCD GOSUB Display_Device_Type ' serial number LCDCMD LCDpin,Line2 FOR idx = LCDOUT LCDpin,NoCmd,[HEX2 romData(idx)] NEXT Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' read ID, serial num, CRC ' search ' no device present ' names are stored in slot 1 ' loop counter ' ROM data from device ...
Page 38
... EEPROM. ' discription is stored at the location determined by this formula pointer = device_id * 2 + $600 ' Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ",HEX2 romData(7)] ' reset and start search ' calulate string pointer addr ' point to names EEPROM ' get the string location ...
Page 39
... DS2430 DATA "DS2430",0 DS2433 DATA "DS2433",0 DS2450 DATA "DS2450",0 DS2505 DATA "DS2505",0 DS2506 DATA "DS2506",0 DS2890 DATA "DS2890",0 ' string pointers Pointers DATA @$01*2+PntrBase,Word FCode01 DATA @$04*2+PntrBase,Word FCode04 Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 The high Page 39 ...
Page 40
... DATA @$21*2+PntrBase,Word DS1921 DATA @$05*2+PntrBase,Word DS2405 DATA @$0B*2+PntrBase,Word DS2505 DATA @$0F*2+PntrBase,Word DS2506 DATA @$12*2+PntrBase,Word DS2406 DATA @$20*2+PntrBase,Word DS2450 DATA @$22*2+PntrBase,Word DS1822 DATA @$27*2+PntrBase,Word DS2417 DATA @$28*2+PntrBase,Word DS18B20 DATA @$2C*2+PntrBase,Word DS2890 Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 Page 40 ...
Page 41
... This program demonstrates using the DS1822 in its simplest form for direct ' temperature measurement. ' the device serial number Program output is via DEBUG. ' -----[ Revision History ]----------------------------------------------------- ' ' -----[ I/O Definitions ]------------------------------------------------------ ' OWpin CON 15 ' -----[ Constants ]------------------------------------------------------------ ' Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 With only one sensor, we can use SkipROM and ignore Page 41 ...
Page 42
... DEBUG "-- Insert device and re-start." END Get_ROM OWOUT OWpin,OW_FERst,[ReadROM] OWIN OWpin,OW_BERst,[STR romData\8] IF (romData(0) = DS1822) THEN Show_Data Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' Front-End Reset ' Back-End Reset ' read ID, serial num, CRC ' look for specific device ' skip rom (one device) ' search ...
Page 43
... IF tSign = 0 THEN NoNegF tempF = tempF | $FF00 NoNegF: tempF = tempF + 32 RETURN Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' reset and start search ' send conversion command ' give it some time ' go get the temperature ' save sign bit ' round to whole degrees ' extend sign bits for negs ' multiply by 1 ...
Page 44
... Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 Page 44 ...
Page 45
... Updated... 26 SEP 2001 ' {$STAMP BS2p} ' -----[ Program Description ]-------------------------------------------------- ' ' This program demonstrates individual device addressing with the Dallas ' 1-Wire bus. Before running the program, the individual device addresses ' must be determined and stored in the EEPROM. ' Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 Page 45 ...
Page 46
... VAR Nib eeAddr VAR Byte romData VAR Byte(8) Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' 1 = Fahrenheit ' connect LCD to OutL ' No command in LCDOUT ' clear the LCD ' move cursor to home position ' move cursor left ' move cursor right ' shift displayed chars left ...
Page 47
... Show_Sensors: LOOKUP sensor,[T_ID0,T_ID1],eeAddr GOSUB Get_Temp LOOKUP sensor,[T_Label0,T_Label1],eeAddr LCDCMD LCDpin, Line1 GOSUB Print_Label width = 4 Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' raw temperature ' 1 = negative temperature ' Celsius ' Fahrenheit ' character for LCD ' right justified number ' sign for rj number ...
Page 48
... ABS(rjNum) digits = width LOOKDOWN rjNum,<[0,10,100,1000,65535],digits LCDOUT LCDpin,pos,[REP " "\(width-digits-1),13 * rjSign + " ",DEC rjNum] RETURN Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 Print_Temp ' load ROM pattern ' save sign bit ' round to whole degrees ' extend sign bits for negs ' multiply by 1 ...
Page 49
... Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 Page 49 ...
Page 50
... Refer to PP_DS1822-2.BSP for an example of dealing with multiple 1-Wire ' devices on the same pin. ' -----[ Revision History ]----------------------------------------------------- ' Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 In this demo, the LED Its current status is available only after Status (0 = on) of the Use at least 1K Page 50 ...
Page 51
... DEBUG "DS2405 Digital Switch Demo (LED = flags.Bit7)" Show_Flags PAUSE 1000 GOSUB Shake_Flags DEBUG Home, CR, CR, "Flags... ", BIN8 flags (ledFlag) THEN LED_On Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' 1-Wire bus ' pull cathode to ground ' Front-End Reset ' Back-End Reset ' read ID, serial num, CRC ...
Page 52
... NEXT RETURN Toggle_LED: OWOUT OWpin, OW_FERst, [MatchROM, STR romData\8] OWIN OWpin, OW_BitMode + OW_BERst, [status] GOTO Show_Flags Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' if off, shake flags ' otherwise, turn off ' if on, shake flags ' otherwise, turn on ' let all bits change ...
Page 53
... ROM code for the connected ' device Refer to PP_DS1822-2.BSP for an example of dealing with multiple 1-Wire ' devices on the same pin. ' -----[ Revision History ]----------------------------------------------------- ' ' -----[ I/O Definitions ]------------------------------------------------------ ' OWpin CON 15 RCpin CON 14 Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 This program assumes only ' 1-Wire bus ' RCTIME pin Page 53 ...
Page 54
... OWOUT OWpin, OW_FERst, [MatchROM, STR romData\8, WrCtrl, %00001100] OWIN OWpin, OW_BERst, [temp] IF (temp = $FF) THEN Set_Ctrl PAUSE 1000 Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 ' Front-End Reset ' Back-End Reset ' read ID, serial num, CRC ' look for specific device ...
Page 55
... GOTO Main END ' -----[ Subroutines ]---------------------------------------------------------- ' Pot_Error: DEBUG CLS DEBUG "Error -- could not set pot" END Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001 " read new level back ' check for correct receipt ' release new value ' dicharge RC cap ' read pot " ...