0
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心
发布
  • 发文章

  • 发资料

  • 发帖

  • 提问

  • 发视频

创作活动
29121

29121

  • 厂商:

    PARALLAXINC.

  • 封装:

    Module

  • 描述:

    MODULE APP: LCD TERMINAL 2X8

  • 数据手册
  • 价格&库存
29121 数据手册
599 Menlo Drive, Suite 100 Rocklin, California 95765, USA Office: (916) 624-8333 Fax: (916) 624-8003 General: info@parallax.com Technical: support@parallax.com Web Site: www.parallax.com Educational: www.stampsinclass.com LCD Terminal AppMod (#29121) 2 Line x 8 Character LCD Module with User Buttons Introduction The LCD Terminal AppMod provides a simple and convenient method of adding a standard character LCD and 4 user-input buttons to BASIC Stamp projects. Its 20-pin male header plugs into the 2x10 AppMod Header socket on the Parallax Board of Education (#28150, #28850) or Super Carrier Board (#27130). Features      2 x 8 LCD module, HD44780-compatible Parallel LCD uses 7 I/O pins Contrast control pot 4 buttons for user input +5 VDC, supplied through AppMod Vdd Appmod Header Pinout (Board of Education and Super Carrier Board) LCD Terminal AppMod Pinout Copyright © Parallax, Inc. LCD Terminal AppMod (#29121) v1.2 8/1/2008 Page 1 of 9 Board Installation The LCD Terminal AppMod’s 20-pin male header plugs directly into the 2x10 socket. Before installation, be sure to check the board silkscreen labels for proper orientation. The photos below show the proper orientation on a Super Carrier Board (left) and a Board of Education (right). Use caution: reversing the connection could result in applying power to the LCD’s ground pins and could damage your unit. Schematic Vdd 2 x 8 LCD 1 k 14 P7 13 P6 12 P5 11 P4 4 P3 5 P2 6 P1 D7 D6 D5 D4 RS R/W RW E Vdd Vss 10 k 1 2 Vo 3 10 k Vdd Copyright © Parallax, Inc. LCD Terminal AppMod (#29121) v1.2 8/1/2008 Page 2 of 9 Circuit Notes The resistor values are important for the proper operation of the circuit. You may be wondering if the LCD will be adversely affected if a button is pressed while the BASIC Stamp is writing to it. The answer is no. When no buttons are pressed, the signals from the BASIC Stamp microcontroller are felt "across" the 10K resistors, hence there is no concern. When a button is pressed, a high level will be exerted on the bus. If the state of that buss line is supposed to be low, the BASIC Stamp overcomes the button press and a small amount of current will flow through the 1K resistor and the low exerted by the BASIC Stamp pin will be seen by the LCD. BASIC Stamp 2 Application The following BASIC Stamp program demonstrates many of the capabilities of the LCD and how the user is able to read and debounce the module's user buttons. This program is somewhat unique in that it is compatible with every BASIC Stamp 2 module; no changes are required. If you attempt to run the program on something other than a standard BS2, the compiler will ask if you want to run on the installed Stamp (BS2e, BS2sx, BS2p, or BS2pe). If you do, the program will run without problems. In order to allow this program to take advantage of the built-in LCD features of the BS2p family, conditional compilation directives are used. Conditional compilation directives are evaluated before the program is compiled and downloaded to the BASIC Stamp, so only those portions that pertain to the installed BASIC Stamp will be downloaded; not the entire listing. The program is quite straightforward, and uses a simple software trick to scroll a string through the small window (eight characters) of the LCD. Entry and exit of the string is facilitated by padding the string with spaces on either end. ' ========================================================================= ' ' File....... LCD_AppMod_Demo.BS2 ' Purpose.... Demonstrates the LCD Terminal AppMod ' Author..... Parallax, Inc. (Copyright 2003-04, All Rights Reserved) ' E-mail..... support@parallax.com ' Started.... ' Updated.... 13 JAN 2004 ' ' {$STAMP BS2} ' {$PBASIC 2.5} ' ' ========================================================================= ' ' ' ' ' ' -----[ Program Description ]--------------------------------------------This program demonstrates the use of the Parallax LCD Terminal AppMod with any BS2-series microcontroller. This program uses conditional compilation techniques which make it completely BS2-agnostic. Custom character generation and animation is demonstrated. ' -----[ I/O Definitions ]------------------------------------------------- Copyright © Parallax, Inc. LCD Terminal AppMod (#29121) v1.2 8/1/2008 Page 3 of 9 E RW RS LcdDirs LcdBusOut LcdBusIn PIN PIN PIN VAR VAR VAR 1 2 3 DIRB OUTB INB ' ' ' ' LCD Enable (1 = enabled) Read/Write\ Reg Select (1 = char) dirs for I/O redirection ' -----[ Constants ]------------------------------------------------------#DEFINE _LcdReady = ($STAMP = BS2P) OR ($STAMP = BS2PE) LcdCls LcdHome LcdCrsrL LcdCrsrR LcdDispL LcdDispR CON CON CON CON CON CON $01 $02 $10 $14 $18 $1C ' ' ' ' ' ' clear the LCD move cursor home move cursor left move cursor right shift chars left shift chars right LcdDDRam LcdCGRam LcdLine1 LcdLine2 CON CON CON CON $80 $40 $80 $C0 ' ' ' ' Display Data RAM control Character Generator RAM DDRAM address of line 1 DDRAM address of line 2 LcdScrollTm CON 250 ' LCD scroll timing (ms) ' -----[ Variables ]------------------------------------------------------addr crsrPos char idx scan VAR VAR VAR VAR VAR Word Byte Byte Byte Byte ' ' ' ' ' buttons btnA btnB btnC btnD VAR VAR VAR VAR VAR Nib buttons.BIT0 buttons.BIT1 buttons.BIT2 buttons.BIT3 btnDemo VAR Byte address pointer cursor position character sent to LCD loop counter loop counter ' left-most button ' right-most ' loop counter ' -----[ EEPROM Data ]----------------------------------------------------CC0 CC1 DATA DATA Copyright © Parallax, Inc. $0E, $1F, $1C, $18, $1C, $1F, $0E, $00 $0E, $1F, $1F, $18, $1F, $1F, $0E, $00 LCD Terminal AppMod (#29121) ' char 0 ' char 1 v1.2 8/1/2008 Page 4 of 9 CC2 Smiley DATA DATA $0E, $1F, $1F, $1F, $1F, $1F, $0E, $00 $00, $0A, $0A, $00, $11, $0E, $06, $00 Msg1 Msg2 Msg3 Msg4 DATA DATA DATA DATA "PARALLAX", 0 " BASIC STAMP "Type =", 0 "Buttons:", 0 StampId0 StampId1 StampId2 StampId3 StampId4 DATA DATA DATA DATA DATA " BS2", " BS2e", "BS2sx", " BS2p", "BS2pe", ", 3, " ' char 2 ' smiley ", 0 0 0 0 0 0 ' -----[ Initialization ]-------------------------------------------------Initialize: NAP 5 DIRL = %11111110 ' let LCD self-initialize ' setup pins for LCD LCD_Init: #IF _LcdReady #THEN LCDCMD E, %00110000 : PAUSE LCDCMD E, %00110000 : PAUSE LCDCMD E, %00110000 : PAUSE LCDCMD E, %00100000 : PAUSE LCDCMD E, %00101000 : PAUSE LCDCMD E, %00001100 : PAUSE LCDCMD E, %00000110 #ELSE LcdBusOut = %0011 PULSOUT E, 3 : PAUSE 5 PULSOUT E, 3 : PAUSE 0 PULSOUT E, 3 : PAUSE 0 LcdBusOut = %0010 PULSOUT E, 3 char = %00101000 GOSUB LCD_Command char = %00001100 GOSUB LCD_Command char = %00000110 GOSUB LCD_Command #ENDIF Download_Chars: char = LcdCGRam GOSUB LCD_Command FOR idx = CC0 TO (Smiley + 7) Copyright © Parallax, Inc. 5 0 0 0 0 0 ' 8-bit mode ' ' ' ' 4-bit mode 2-line mode no crsr, no blink inc crsr, no disp shift ' 8-bit mode ' 4-bit mode ' 2-line mode ' on, no crsr, no blink ' inc crsr, no disp shift ' ' ' ' download custom chars point to CG RAM prepare to write CG data build 4 custom chars LCD Terminal AppMod (#29121) v1.2 8/1/2008 Page 5 of 9 READ idx, char GOSUB LCD_Write_Char NEXT ' get byte from EEPROM ' put into LCD CG RAM ' -----[ Program Code ]---------------------------------------------------Main: char = LcdCls GOSUB LCD_Command PAUSE 500 ' clear the LCD Write_Parallax: addr = Msg1 GOSUB LCD_Put_String ' point to message ' write it Scroll_Message: crsrPos = LcdLine2 addr = Msg2 GOSUB LCD_Scroll_String ' scroll on line 2 ' point to msg ' scroll it Pac_Man: FOR idx = 0 TO 7 FOR scan = 0 TO 4 char = LcdLine1 + idx GOSUB LCD_Command LOOKUP scan, [0, 1, 2, 1, " "], char GOSUB LCD_Write_Char PAUSE 75 NEXT NEXT Show_Stamp_Type: char = LcdCls GOSUB LCD_Command PAUSE 100 addr = Msg3 GOSUB LCD_Put_String char = LcdLine2 + 3 GOSUB LCD_Command #SELECT $STAMP #CASE BS2 addr = StampId0 #CASE BS2E addr = StampId1 #CASE BS2SX addr = StampId2 #CASE BS2P Copyright © Parallax, Inc. ' ' ' ' Pac-Man animation cover 8 characters 5 characters in animation position cursor ' select "frame" ' write animation character ' delay between chars ' clear the LCD ' display "Type =" ' move cursor to 2nd line ' check type at compile LCD Terminal AppMod (#29121) v1.2 8/1/2008 Page 6 of 9 addr = StampId3 #CASE BS2PE addr = StampId4 #ENDSELECT GOSUB LCD_Put_String PAUSE 2000 ' display type on LCD Show_Buttons: char = LcdCls GOSUB LCD_Command PAUSE 100 addr = Msg4 GOSUB LCD_Put_String ' clear the LCD ' write "Buttons:" FOR btnDemo = 1 TO 100 GOSUB LCD_Get_Buttons char = LcdLine2 + 2 GOSUB LCD_Command FOR idx = 0 TO 3 IF buttons.LOWBIT(idx) THEN char = "A" + idx ELSE char = "-" ENDIF GOSUB LCD_Write_Char NEXT NEXT GOTO Main END ' read/debounce buttons ' show on 2nd line ' display buttons ' button letter if pressed ' otherwise dash ' run demo again ' -----[ Subroutines ]----------------------------------------------------' Writes stored (in DATA statement) zero-terminated string to LCD ' -- position LCD cursor ' -- point to 0-terminated string (first location in 'addr') LCD_Put_String: DO READ addr, char IF (char = 0) THEN EXIT GOSUB LCD_Write_Char addr = addr + 1 LOOP RETURN ' Scroll a message across LCD line Copyright © Parallax, Inc. LCD Terminal AppMod (#29121) v1.2 8/1/2008 Page 7 of 9 ' -- set starting position in 'crsrPos' ' -- point to 0-terminated string (first location in 'addr') ' -- strings should be padded with eight spaces on each end LCD_Scroll_String: DO char = crsrPos GOSUB LCD_Command FOR idx = 0 TO 7 READ (addr + idx), char IF (char = 0) THEN EXIT GOSUB LCD_Write_Char NEXT IF (char = 0) THEN EXIT addr = addr + 1 PAUSE LcdScrollTm LOOP RETURN ' move to start of window ' write chars in window ' stop if end of string ' scroll ' Send command to LCD ' -- put command byte in 'char' LCD_Command: #IF _LcdReady #THEN LCDCMD E, char RETURN #ELSE LOW RS GOTO LCD_Write_Char #ENDIF ' write command to LCD ' Write character to current cursor position ' -- but byte to write in 'char' LCD_Write_Char: #IF _LcdReady #THEN LCDOUT E, 0, [char] #ELSE LcdBusOut = char.HIGHNIB PULSOUT E, 3 LcdBusOut = char.LOWNIB PULSOUT E, 3 HIGH RS #ENDIF RETURN Copyright © Parallax, Inc. ' write character to LCD ' output high nibble ' strobe the Enable line ' output low nibble ' return to character mode LCD Terminal AppMod (#29121) v1.2 8/1/2008 Page 8 of 9 ' Reads byte from LCD ' -- put byte address in 'addr' ' -- returns byte read in 'char' LCD_Read_Char: #IF _LcdReady #THEN LCDIN E, addr, [char] #ELSE char = addr GOSUB LCD_Command HIGH RS HIGH RW LcdDirs = %0000 HIGH E char.HIGHNIB = LcdBusIn LOW E HIGH E char.LOWNIB = LcdBusIn LOW E LcdDirs = %1111 LOW RW #ENDIF RETURN ' read character from LCD ' move cursor ' data command ' read ' make LCD bus inputs ' get high nibble ' get low nibble ' return data lines to outputs ' Read and debounce the LCD AppMod buttons LCD_Get_Buttons: LcdDirs = %0000 buttons = %1111 FOR scan = 1 TO 10 buttons = buttons & LcdBusIn PAUSE 5 NEXT LcdDirs = %1111 RETURN ' make LCD bus inputs ' assume all pressed ' make sure button held ' debounce 10 x 5 ms ' return bus to outputs Additional Resources The following resources are available from www.parallax.com  BASIC Stamp Manual or BASIC Stamp Editor Help file: syntax and reference for the LCDCMD, LCDIN, and LCDOUT commands for the BS2p-family of microcontroller modules.  StampWorks Projects 11 – 14; more parallel LCD programming topics  Nuts & Volts Stamp Applications #31: Demystifying Character-based LCDs  BASIC Stamp 1 program version (limited features due to code space restrictions)  Javelin Stamp program version, complete with LcdTerminal class file  Hitachi HD44780 Datasheet Copyright © Parallax, Inc. LCD Terminal AppMod (#29121) v1.2 8/1/2008 Page 9 of 9
29121 价格&库存

很抱歉,暂时无法提供与“29121”相匹配的价格&库存,您可以联系我们找货

免费人工找货