Welcome to WeetHet!


Managed Web Hosting by Liquid Web

Your IP address:
54.156.67.164
     
 
Print this page
- use Landscape
Search the
WeetHet Pages
WeetHet is being updated! - Current articles will slowly move to www.tweaking4all.com
For excellent webhosting that is reliable and affordable, we highly recommend: LiquidWeb

On this page ...

This page is based on the Parallax (OEM) Basic Stamp II microcontroller.

We plan to control a Mitsubishi M50530 based LCD display's.

Tip: for Hitachi 44780 based LCD displays see the Optrex DMC2034 article.

I'll try to explain how to connect such an LCD display to the (OEM) Basic Stamp II,, based on a used LCD display from an Ericsson phone (here we use the Optrex DMC-50652N or the Seiko/IIS C456002A) basically any Mitsubishi 50530 based LCD should work.

Pictures of the LCD in action can be seen here.

The displys I used, are an OPTREX DMC50652N (= Seiko/IIS C456002A) which has 3 x 40 (3 lines, 40 characters) chars.

Note: I wouldn't have done this article without the help of Peter Pitzeier. He was the first one to get it running with a BasicStamp 1.

Do not forget to read the disclaimer!

Note: The example code can be downloaded HERE.

Parallax: Basic Stamp II

Overview

  1. How to connect the LCD display to my OEM Basic Stamp 2
  2. Powersupply adjustments
  3. Handy BasicStamp2 instructions; example 1, Text
  4. Handy BasicStamp2 instructions; example 2, Running bar
  5. Original BasicStamp1 code

How to connect the LCD to the Basic Stamp II

Here we show you how to make the proper connections.

Optrex DMC-50652N  backside view. Here you'll find the 12 connections

Make these connections:

LCD Display pin LCD Functionality OEM Basic Stamp 2 pin
1
DB7 (databit 7) P7
2
DB6 (databit 6) P6
3
DB5 (databit 5) P5
4
DB4 (databit 4) P4
5
EX (Execute) P3
6
R/W (Read/Write) P2
7
I/OC1 (IO Control 1) P1
8
I/OC2 (IO Control 2) P0
9
VLCD (LCD power) +3 ... +12V (see schematics)
10
VSS (GND) Vss (= Ground)
11
Vdd (logic power) Vdd (= +5V)
12
not used -

LCD Powersupply

For pin 9 of the LCD we will need to create a little powersupply adjustment.
On average (milega may vary) pin 9 needs approximately +11 Volt on pin 9 to seen anything.

Below you will find an easy to build schematic. This can also be used for powering your BasicStamp by connecting Vss (ground) and VDD (+5V) to the appropriate pins of the BasicStamp.

Required parts:

1
7805 voltage regulator
1
Variable resistor of app. 10 KOhm
1
Adjusted powersupply app. 8 to 15 Volts

Schematics:

 

Powersupply for the  Optrex 50652N LCD displays

 

 

Note: pin out is based on info I got from Peter Pitzeier - Many thanks Peter!

Sending Data 4 bit wise

OK, so now we hooked to LCD up to our Basic Stamp 2. How do we control a parallel controlled LCD panel by using only 6 wires?

The answer is actually pretty simple (thanks to Jon's work): the LCD panel can be controlled using 8-bits or 4-bits. 4-bit mode is working identical to 8-bit mode mode, however we transmit the upper 4 bits and the lower 4 bits in sequence instead of 8 bits parallel.

See the Optrex DMC2034 article for more details.

Handy instructions, Example 1

Sending instructions is basically the same as sending characters, we only need to use different values for the control pins (E, IOC1, IOC2). To save you a lot of work, I create som subroutines that do this job for you.

An overview of the GOSUB routines:

Routine Call Toepassing
LCD_Init GOSUB LCD_Init Initialize the display.
LCD_WriteInstr

TheData = %xxxxxxxx
GOSUB LCD_WriteInstr

Write control instrcution. An instruction is 8 bit, binaire code.
Define TheData as VAR byte.
LCD_WriteChar TheChar = "A"
GOSUB LCD_WriteChar
Send character to display.
DefineTheChar as VAR byte.
LCD_SetFunction GOSUB LCD_SetFunction Set communicaton and font settings.
LCD_ClearHome GOSUB LCD_ClearHome Clear display and set cursor in home position.
LCD_SetDisplay GOSUB LCD_SetDisplay Cursor mode (blink, underline, etc).
LCD_Entry GOSUB LCD_Entry Define cursor direction
LCD_CursorXY TheCursorX = X
TheCursorY = Y
GOSUB LCD_CursorXY
Move cursor to line X (0, 1 or 2) and column Y (0 ... 39).
Define TheCursorX and TheCursorY as VAR byte.
LCD_CursorHome GOSUB LCD_CursorHome Like LCD_ClearHome, without clearing the screen.

Note: For some of these functions, you will need to pre-define variables (see table).

Some of these routines are used in this example (example 2 uses them all), which show static text;

'{$STAMP BS2}
'{$PBASIC 2.0}
' OPTREX DMC50625N LCD display controle routines
' (C) 2003 Hans Luyten
' Many thanks to Peter Pitzeier             
' Variables
TheData VAR byte	' Variable for LCD data/char
TheChar VAR byte	' Variable for sending characters to LCD
' Data
DATA "Welcome to Hansies OPTREX DMC50625N test"
DATA "The LCD is connected to a BasicStamp II!"
DATA "-= Enjoy the BS2 code for LCD control =-"
Main:	GOSUB LCD_Init
        GOSUB_ClearHome
        FOR b2 = 0 TO 119
           READ b2, TheChar
           GOSUB LCD_WriteChar
        NEXT
        END
LCD_Init:	    ' Initialize LCD display
                GOSUB LCD_SetFunction
                GOSUB LCD_ClearHome
                GOSUB LCD_SetDisplay
                GOSUB LCD_SetEntry
                RETURN
LCD_WriteInstr: ' Write LCD instruction (TheCode) and LCD Data (TheData)
                Dirs = %11111111
                OutB = TheData.HIGHNIB
                OutA = %0000
                pulsout 3, 1
                OutB = TheData.LOWNIB
                pulsout 3, 1
                RETURN
LCD_WriteChar:	' Write character to LCD display
                Dirs = %11111111
                OutB = TheChar.HIGHNIB
                OutA = %0001
                pulsout 3, 1
                OutB = TheChar.LOWNIB
                pulsout 3, 1
                RETURN
LCD_SetFunction:' SF: Nibble mode, 5x7 font, 4x40 chars
                TheData = %11011011
                GOSUB LCD_WriteInstr
                RETURN
LCD_ClearHome:	' CH: Clear screen, cursor home
                TheData = %00000001
                GOSUB LCD_WriteInstr
                RETURN
LCD_SetDisplay:	' SD: Display, Cursor, Underline, Blink: ON
                TheData = %00111111
                GOSUB LCD_WriteInstr
                RETURN
LCD_SetEntry:	' SE: Cursor direction
                TheData = %01011000
                GOSUB LCD_WriteInstr
                RETURN

Handy instructions, Example 2

This example uses all the defined GOSUB routines. It shows text and a gauge bar that runs up and down;

'{$STAMP BS2}
'{$PBASIC 2.0}
' OPTREX DMC50625N LCD display controle routines
' (C) 2003 Hans Luyten
' Many thanks to Peter Pitzeier 
' Variables
TheData VAR byte	' Variable for LCD data/char
TheChar VAR byte	' Variable for sending characters to LCD
TheCursorX VAR byte	' Move cursor X (column) position
TheCursorY VAR byte	' Move cursor Y (line) position
' Data
DATA "Welcome to Hansies OPTREX DMC50625N test"
DATA "The LCD is connected to a BasicStamp II!"
DATA "BAR/GAUGE: ",$88,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97
DATA $97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$89
Main:  GOSUB LCD_Init
       GOSUB_ClearHome
       FOR b2 = 0 TO 119
         READ b2, TheChar
         GOSUB LCD_WriteChar
       NEXT
Gauge: FOR b2 = 11 to 39
         TheCursorX = b2
         TheCursorY = 2
         GOSUB LCD_CursorXY
         TheChar = $9B
         GOSUB LCD_WriteChar
       NEXT
       TheCursorX = 39
       TheCursorY = 2
       GOSUB LCD_CursorXY
       TheChar = $89
       GOSUB LCD_WriteChar
       FOR b2 = 38 to 12
         TheCursorX = b2
         TheCursorY = 2
         GOSUB LCD_CursorXY
         TheChar = $97
         GOSUB LCD_WriteChar
       NEXT
       TheCursorX = 11
       TheCursorY = 2
       GOSUB LCD_CursorXY
       TheChar = $88
       GOSUB LCD_WriteChar
       GOTO Gauge
END
LCD_Init:	   ' Initialize LCD display
                GOSUB LCD_SetFunction
                GOSUB LCD_ClearHome
                GOSUB LCD_SetDisplay
                GOSUB LCD_SetEntry
                RETURN
LCD_WriteInstr: ' Write LCD instruction (TheCode) and LCD Data (TheData)
                Dirs = %11111111
                OutB = TheData.HIGHNIB
                OutA = %0000
                pulsout 3, 1
                OutB = TheData.LOWNIB
                pulsout 3, 1
                RETURN
LCD_WriteChar:	' Write character to LCD display
                Dirs = %11111111
                OutB = TheChar.HIGHNIB
                OutA = %0001
                pulsout 3, 1
                OutB = TheChar.LOWNIB
                pulsout 3, 1
                RETURN
LCD_SetFunction:' SF: Nibble mode, 5x7 font, 4x40 chars
                TheData = %11011011
                GOSUB LCD_WriteInstr
                RETURN
LCD_ClearHome:	' CH: Clear screen, cursor home
                TheData = %00000001
                GOSUB LCD_WriteInstr
                RETURN
LCD_SetDisplay: ' SD: Display, Cursor, Underline, Blink: ON
                TheData = %00111111
                GOSUB LCD_WriteInstr
                RETURN
LCD_SetEntry:   ' SE: Cursor direction
                TheData = %01011000
                GOSUB LCD_WriteInstr
                RETURN
LCD_CursorHome: 'MH: Move cursor to home position
                TheData = %00000011
                GOSUB LCD_WriteInstr
                RETURN
LCD_CursorXY:   ' MA: Move cursor to X,Y 
                ' (Y=line: 0 to 1, X=Column: 0 to 39)
                GOSUB LCD_CursorHome
                FOR b1 = 1 TO (TheCursorY*40)+TheCursorX
                  TheData = %00011000
                  GOSUB LCD_WriteInstr
                NEXT
                RETURN

The original BasicStamp1 code

This page would not have been compleet without the original BasicStamp 1 code by Peter Pitzeier;

'{$STAMP BS1}
'Copyright Peter Pitzeier!

eeprom 00, ("           OPTREX DMC-50625N            ")
eeprom 40, (" MITSUBISHI M50530 DOT MATRIX LIQUID ")
eeprom 80, (" CRYSTAL DISPLAY CONTROLLER-DRIVER ")

start:

' SF instruction (Set Function)
' I/O = 4 bit mode
' FONT = 8
' 4 line display DT0=0, DT1=1
' 4 line * 40 words RA0=1, RA1=1
dirs = %11111111
pins = %11010000
pulsout 3, 1
pins = %10110000
pulsout 3, 1


' CH instruction (Clear Home)
dirs = %11111111
pins = %00000000
pulsout 3, 1
pins = %00010000
pulsout 3, 1

pause 1

' SD instruction (Set Display)
' DSP on
' CSR on
' UND on
' CSR blink
' CHR blink
dirs = %11111111
pins = %00110000
pulsout 3, 1
pins = %11110000
pulsout 3, 1

' SE instruction (Set Entry)
' CSR D/I increment
' CSR CONDITION W
dirs = %11111111
pins = %01010000
pulsout 3, 1
pins = %10000000
pulsout 3, 1


REM dirs=%00001111:low 0:low 1:high 2:pulsout 3,1:b2=pins:pulsout 3,1: b3=pins:low 2:debug %b2,%b3

main:

' CH instruction (Clear Home)
dirs = %11111111
pins = %00000000
pulsout 3, 1
pins = %00010000
pulsout 3, 1

FOR b2 = 0 TO 119
READ b2, b4
b3=b4 & %11110000
b3=b3 | %00000001
dirs = %11111111
pins = b3
pulsout 3, 1

b3=b4 & %00001111
b3 = b3 + b3
b3 = b3 + b3
b3 = b3 + b3
b3 = b3 + b3

b3=b3 | 1
pins = b3
pulsout 3, 1


NEXT b2

END


GOTO main

 

 


 

 


Klik hier om te wisselen naar nederlandstalige pagina's You are currently on the English pages.
Help & AboutWelcome ... !!GuestbookWeetHet HelpGlossary ...Searching the InternetSearching WeetHetAvailable downloadsNews & UpdatesStatisticsDisclaimer!AdvertisingJoin us !!!AwardsAbout WeetHet ...Hansie goes USAWhere is Hansie?First monthsMy new homeGoing outPuck goes USAMy new carSnapshots PuckRandom snapshotsFinally: Spring!Nice warm summerFirst Family visit!CD's and DVD'sMusicAudio-DVD to MP3Music CD to MP3Music CD to WAVCopy Music CDYour own Music CDMusic from the InternetChanging MP3 VolumeNero Burning RomBurn BIN/CUE filesConvert BIN to ISOComputer CDRomBurn ISO filesPhoto VCDPhoto SVCDNero vs Nero ExpressNRG to ISOBurn SVCDSVCD with menuBurn VCDVCD with menuDVD VideoWhat are RegionCodes?What is MacroVision?Video formatsDIKO: 3 AVIs - 1 DVDHow does a CD work?How to burn a CDCreating a DVDConvert BIN to ISONRG to ISOCreating a disk catalogComputer InfoHow does a CD work?Netiquette: E-MailWhat is DivX?What is MP3?What is RAID?What is USB?What are PAR files?Wireless LAN introPC to TV cablesStart XP fasterBoot from USB driveFireWire connect 2 PC'sPhoto SizingGraphics / PhotosPhotoshopPhoto SizingFast car3D buttonsDraw lightningPhotos on CDPictureToTVVideoCD with NeroSVCD with NeroMagix Pictures on CDDVD PictureShowPhoto SizingPhoto SizingGSM / PDAsCompaq iPAQReplace batterySerial craddle to USBGarmin eTrex cableGarmin eTrex plugRound Garmin plugPalmPilotConnect Ericsson GSMGarmin eTrex GPSMobile phonesEricsson RingtonesMusicBoxRingtonesMasterA edit SIMSMSC numbersConnector pinoutsHardware & HacksOverclocking CPU'sGenericAMD CPU codesAMD Slot-AAMD Socket-AProgr. SmartcardsMillenniumAlcatel HackLCD display to PCNetwork cablesBoot from USB drivePC to TV cablesPromise Ultra -> RAIDSoundblaster MIDIResistor colorcodeFireWire NetworkInternetNetwork genericEnabling DHCPWin95/98/ME ClientWin2000/XP ClientMac OS 7/8 ClientMac OS X ClientWell known IP-portsDNS addressesNetwork cablesWireless LAN IntroFireWire NetworkDialup connectionTCP/IP optimized for Win9xPublic IP Address?ADSL / MxStreamADSL in generalHow ADSL worksDNS addressesMXStreamInstallingPSTN EthernetISDN EthernetRouter for MXStreamSMC 7404 WBRA/BeTech ModemRoutereTech RouterSitecom 4S routerVigor 2200E routerSolving problemsAlcatel HackHack the modemPassword CalculatorPurpose of the LEDsSolving problemsFirmware upgradeDNS addressesWell known IP-portsMapping PortsAutoPortMappingConnection sharingPossibilitiesWinRoute (software)Network Win95/98/MENetwork Win2000/XPNetwork Mac OS 7/8Network Mac OS XWell known IP-portsWireless LAN IntroNetwork cablesRoutersSMC 7404 WBRA/BeTech ModemRoutereTech RouterSitecom 4S routerVigor 2200E routerInternet by SatelliteHow does it work?Brief intro ...Overview variantsStandardBySky methodTwo-Way InternetInstalling cardsWhich satellite-card?PC requirementsHarmonic CyberstreamPentam. Pent@VisionHauppauge DVBs NexusTechnotrend PCLineEOL problemsNew driversMounting a dish (Astra)Dish size?EON ChecklistTransponders EOLRamdisk for FazztYour own webpageNavigation solutionsInsight and solutionsApyCom apPopupMenuD.Binard PopupMenuPopupMenu generatorPopupMenu flatTips and TricksE-Mail linkE-Mail FORMBookmark this pageIcon for my webpage'Page back' link?Jumping within a pageEscape from framesUse frametitleControlling framesAuto redirectFixing 100% problemChange link colorText in the statusbarFixed backgroundText over imagesBrowser safe colorsUsing the .htaccess fileSpecial charactersWhere to downloadIRC using mIRCInstalling mIRCDownload Movies etcFAQMovies from InternetMovie QualityWhat are PAR files?LeechGuyLeechGuy editoreMuleWinMXE-MailNetiquetteQuote of the dayMiscellaniousHack Arescom NetDSLWireless LAN IntroFireWire NetworkWell known IP-portsWhat is my IP Address?Search (WeetHet)Searching (Internet)WeetHet DownloadsA few great websitesDNS addressesMicroControllersBasic Stamp IIStarting with the BS2Assembling the kitFullsize scematicsConnection to your PCBS2 to 44780 LCD44780 LCD SnapshotsBS2 to M50530 LCDM50530 SnapshotsHomebrew BS2Smartcards/SIMProgrammer Softw.CardMasterInfinityUSBMasterBurnerMilleniumCard TypesEdit GSM SIMResistor colorcodeMusic / AudioMusic from InternetIntroductionLeechGuyLeechGuy editorWinMXeMuleUsing mIRCBurn BIN/CUE filesConvert BIN to ISOAudio-DVD to MP3How does a CD work?Copy music CDYour own music CDWhat is MP3?Music CD to MP3MP3 CD for Yamakawa?Changing MP3 VolumeMusic CD to WAVSB MIDI interfaceAC3 to WAV/MP3ProgrammingBorland DelphiHansies Delphi ToolsAYeah!CatalogQuote of the dayPopupMenu generatorOverview ASCII chars.Satellite (TV & GPS)Satellite TelevionSatellite TV on the PCTV reception on your PCPC requirementsNew driversPentam. Pent@VisionHauppauge DVBs NexusTechnoTrend PCLinePVA file to MPEG2DirecTV TiVoRemote ControlDirecTiVo to OS6.21: Intro & Images2: TiVo disk in PC3: Install OS 6.24: OS6.2 first start5: SuperPatch & More6: Recordings to PCTyTools - Movies to PCOld: DirecTiVo to OS4Old: Sleeper HackSmartcardsProgrammer Softw.CardMasterInfinityUSBMasterBurnerMilleniumCard TypesWhat is DiSEqC?Mounting a dish (Astra)Dish sizeSRT8000 firmwareGPS NavigationGarmin eTrexDiagnostic modeSerial connectionConnect to iPAQ 36/38xxConnect to PalmPilotThe eTrex connectorThe round connectorHow GPS worksGeoCaching explained ...Internet by SatelliteHow does it work?Brief intro ...Overview variantsStandardBySky methodTwo-Way InternetInstalling cardsWhich satellite-card?PC requirementsHarmonic CyberstreamPentam. Pent@VisionHauppauge DVBs NexusTechnotrend PCLineEOL problemsNew driversMounting a dish (Astra)Dish size?EON ChecklistTransponders EOLRamdisk for FazztVideoVideo guide - start hereIntroductionGSpot: AVI InfoDIKO: 3 AVIs - 1 DVDDownload QualityVideo in generalWhat is DivX?Video formatsRecording TypesWhich AVI codecs?Intro K(S)VCD/KDVDDVD+RW IssuesAbout bitratesVideoServer pluginWhat are RegionCodes?What is MacroVision?RippingAudio-DVD to MP3Photo SizingAVI to MPEGGSpot: AVI InfoDIKO: 3 AVIs - 1 DVDAVI to DVD/(S)VCDWithout SubsD.I.K.O.MainConcept (S)VCDNero Vision Express 2TMPGEnc (S)VCDTMPGEnc K(S)VCDTMPGEnc with AC3With SubTitlesD.I.K.O.MainConcept (S)VCDNero Vision Express 2TMPGEnc (S)VCDTMPGEnc K(S)VCDTMPGEnc with AC3Burning CD NeroBurn VCDVCD with menuBurn SVCDSVCD with menuBurn BIN/CUE filesDVD PlayersCompatibilityAdd DVD playerDVD+RW IssuesIntro K(S)VCD/KDVDVideo ToolsBitrate CalulatorDVD RippingGSpot: AVI InfoFlaskMPEG and CCEVideoServer pluginDVD to DivXIntroductionCalculating bitratesRippingDVDx and SmartRipperDVDx settingsFlaskMPEG method 1FlaskMPEG method 2FlaskMPEG method 3DVD to (S)VCDIntroductionCalculating bitratesRippingDVDx and SmartRipperDVDx settingsFlaskMPEG 0.6 and CCEDVDx and Video ServerDivX to (S)VCDDVD to DVDDVD2OneDVDShrinkDVD+RW IssuesTMPGEnc & CoDIKO: 3 AVIs - 1 DVDMovie Cut & PasteGSpot: AVI InfoMergingMPEG1 and MPEG2Using TMPGEncWomble MPEG2VCRAVI with VirtualDubCuttingNewWith TMPGEncWomble MPEG2VCREasy Video SplitterAVI en DIVXAVI with VirtualDubEasy Video SplitterMovies from InternetIntroductionLeechGuyLeechGuy editoreMuleWinMXUsing mIRCWhat are PAR files?Burn BIN/CUE filesConvert BIN to ISOPictures on CDPictureToTVVideoCD with NeroSVCD with NeroMagix Pictures on CDDVD PictureShowRipping SubtitlesVobsub: fast and easy!SubRip (OCR)Sync subtitlesDisplaying subtitlesDisplaying with VobSubSync subtitlesCreate a MicroDVDPC connected to TVPC to TV cablesATI softwarenVidia softwareTiVo - Harddisk VCRTiVo Series 1What is a TiVo?Opening a TiVoSerial accessDebug Mode accessLinux Bash shellSet the clockDisable dialupDirecTV TiVoRemote ControlDirecTiVo to OS6.21: Intro & Images2: TiVo disk in PC3: Install OS 6.24: OS6.2 first start5: SuperPatch & More6: Recordings to PCTyTools - Movies to PCOld: DirecTiVo to OS4Old: Sleeper HackYamakawa 713/715IntroductionFAQThe Remote ControlSecret codesSet regioncodeSet regionfreeDisable MacroVisionFactory-settingsWhich DVDRom driveFirmware versionChange firmwareDownload firmwareChange backgroundCreate MP3 CDM.U.F.Y. MP3 CD'sHelpForumSearch (WeetHet)Search (Internet)News & UpdatesGlossary ...DownloadsLinksStatisticsAdvertisingJoin us !!!Guestbook

Liquid Web Fully Managed Web Hosting