New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here


by: Jada Daniel

STPowerPlangDesign MEM800

Jada Daniel
GPA 3.65


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in Mechanical Engineering

This 97 page Class Notes was uploaded by Jada Daniel on Wednesday September 23, 2015. The Class Notes belongs to MEM800 at Drexel University taught by Staff in Fall. Since its upload, it has received 46 views. For similar materials see /class/212418/mem800-drexel-university in Mechanical Engineering at Drexel University.

Similar to MEM800 at Drexel

Popular in Mechanical Engineering


Reviews for STPowerPlangDesign


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/23/15
Lecture 7 Lecture 7 HTML HTML What is it Hyper Text Markup Language Interpreted rather than compiled Browsers eg Netscape Explorer used to interpret HTML code Standalone application eg documentation Crossplatform ie portable just ASCII editor eg Notepad Evolving eg XML JavaScript VBScript CGI Databases Standard language features links some text formatting images Extension exist but may not be portable Disadvantages page breaks not meant to be printed static mathematics Example Hello World 1 Open Notepad and compose the following HTML code lthtmlgt ltheadgt lttit1egtMy rirst Webpagelttltlegt ltheadgt ltbody bgcoiorwhite textblackgt ltbodygt Hello Worldl ltbodygt lthtmlgt 2 Save As File Name myFirstWebPagehtml and Save As Type all files 3 NetscapeExplorer File Open Page and browse to directory where html file was saved Explore Bookmark Change title and bookmark again Different colors Different fonts lthtmlgt ltheadgt lttit1egtMy rirst Webpagelttltlegt ltheadgt ltbody bgcolorblack textwh1tegt ltbodygt Hello Worldl ltpgt lt1quot this is a comment and won39t be displayed in browser 77gt ltlEE ltpgt means paragraph break ltcentergt Hello World centered lt centergt ltpgt ltigtHello world italizedltigt ltpgt Lecture 7 ltbgtHello world boldltbgt ltpgt ltugtHello world underllnedltugt ltpgt ltlii can center bold underline etc gt ltcentergt ltbgt ltl Thls ls a centered bolded and ltallzed text ltlgt ltbgt ltcentergt ltpgt lt1quot can change font too Use cautlously since dlsplayed differently 77gt lt1quot amongst browsers 77gt ltfont facequotArlalquot slzelgt Slze l Arlal font ltfontgt ltpgt ltfont facequotArlalquot slzelOgt Slze 10 Arlal font ltfontgt ltbodygt lthtmlgt Headings lists and hyperlinks The language provides markups for generating headings This is appropriate for creating documentation eg Section subsection headings Example Headings lthtmlgt ltheadgt lttltlegtHeadlngs and Hyperllnkslttltlegt ltheadgt ltbodygt lt1quot Headings 77gt ltulgt ltlii ordered enumerated llst iigt ltllgt Introductlon ltllgt Procedure ltllgt Concluslon ltulgt ltHlgtIntroductlonltHlgt HTML ls a hypertext markup language popularlzed by the web ltH2gtMotlvatlonltH2gt The motlvatlon to use HTML ls that anyone on the net can Vlew lt ltH2gtHistoryltH2gt Began as mllltary experlment ln the 1960s ltHlgtProcedureltHlgt Generate HTML code ln ASCII ltbrgt Save lt as fllenamehtml ltbrgt Open ln a browser ltHlgtConcluslonltHlgt TML ls Very easy to learn and one can create webpages qulckly ltbodygt lthtmlgt Lecture 7 Explore Adding indocument and outdocument hyperlinks AddMake changes ltolgt ltlee ordered enumerated list gt ltligt Introduction ltligt Procedure ltligt lta hrefquottheConclusionquotgtConclusionltagt gt ltol lta namequottheConclusionquotgtltagt ltHlgtConclusionlt gt TML is Very easy to learn and one can create web pages quickly ltpgt Embedding an out of document hyperlink is encouraged too For example Drexel39s ltA HREE quothttpwwwdrexeleduquotgthomepage ltagt can be referenced ltbodygt lthtmlgt Adding Images GIF JPG are most common Can be added sized and aligned Example Including a image le lthtmlgt ltheadgt lttitlegtImage Fileslttitlegt ltheadgt ltbodygt An image file can be easily included in a web page For example lta hrefquothttpwwwpagesdrexeledupy022mem800WebPagehtmlquotgtDreXel39s logoltagt can be downloaded and included With the follOWing tag ltpgt ltimg srcquotDreX7Logoismallgifquotgt ltbodygt lthtmlgt Explore add following to align resize images ltimg srcquotDreX7Logoismall gifquotgt ltpgt It can aligned too ltimg srcquotDreX7Logoismallgifquot alignrightgt gt p ltcentergt Centered images too ltbrgt ltimg srcquotDreX7Logoismallgifquotgt lt centergt ltpgt Can be resized like thisltbrgt ltimg srcquotDreX7Logoismallgifquot Width320 height280gt ltbodygt lthtmlgt Lecture 7 Tables can be easily added as follows Example Tables lthtmlgt ltheadgt ltt1tlegtTablesltt1tlegt ltheadgt ltbodygt This 15 a 3 column table and has a capt10nltbrgt ltCENTERgt ltTABLE COLSPECquotL20 L20 L20quot BORDER5 CELLSPACING3gt ltCAPTION ALIGNtopgtTABLE 1 ISA BUS ADC PARTSltCAPTIONgt ltTRgtltTDgtPART DESCRIPTIONltTDgtltTDgtVENDORltTDgtltTDgtPARTltTDgtltTRgt ltTRgtltTDgtPC BUS PROTOTYPING CARDltTDgtltTDgtJAMECOltTDgtltTDgt21531ltTDgtltTRgt ltTRgtltTDgtMAXIM MAx158 ADC CHIPltTDgtltTDgtDIGIKEYltTDgtltTDgtMAX158BCPINDltTDgtltTRgt ltTABLEgt ltCENTERgt ltbodygt lthtmlgt HTML resources 0 httpwwwhtmgoodiescom 0 World Wide Web Consortium httpwwww3org o IRT web page httpwwwdrexeleduirtwebsupporthtml Next Steps 0 Upload HTML le to a web server eg Drexel s dunx1 0 Use WSFTP type program upload in ASCII to your publichtml folder Lecture 8 Lecture 8 Winsock Hardware Control V nsock Review 0 Winsock is Microsoft s ActiveX component for writing Internet applications 0 Lecture 5 ClientJServer Chat program application illustrated 0 Chat program ASCII characters can be transferred between client and server Conclusion Winsock can be combined with 8255d for hardware control over Internet Implementation Objective Control LEDs overthe Internet through a TCPIP clientherver program Server houses the 8255 PC card 8255d and Winsockbased server program 0 Client prompts userfor inputs eg which LEDto turn onoff 39 Simple 3255 LED 5 ve HE was Server Program Highlights Option EXpllclt 39Declare use of the DLL Private Declare Function Out8255 Lib quot8255dllquot ByVal PortAddress As Integer ByVal PortData As Integer As Integer Private Declare Function In8255 Lib quot8255dllquot ByVal PortAddress As Integer As Integer 39Declare variables seAddress As Integer 39 8255 Base Address Control Address Private Sub FormiLoadU 39 Set up addresses for 8255 O8 128 i 8255 Ports A B and c as output wall for Connection 00 Call tcpServerListen End Sub Lecture 8 l bytesTotal As Long The button Client clicked 39 The numeric value of string Private Sub tcpServeriDataArrivalByVa Dim messageFromClient As t i g 39 Dim numericValue As Integer Call tcpServerGetDatamessageFromClient 39 Get Client39s button click 39 Convert Client39s button click value to a numerica value numericValue ValmessageFromClient 39 Display which button client clicked in Server39s Status Window txtOutputText tXtOutputText amp quotClient click the quot amp messageFromClient amp quot buttonquot amp vbCrLf tXtOutputSelStart LentXtOutputText Light up the binary equivalent of client39s button click on LEDs Dummy Out8255PortA numericValue 39 Set acknowledgement message back to client Call tcpServerSendDataquotServer has lit up amp numericValue amp quot on the LEDsquot vbCrLf End Sub Client Program Highlights Private Sub cmdFiveiclickU 39 e ve to server Call tcpClientSendDataquot5quot txtOutputText tXtOutputText amp 7 quotClient clicked 5quot amp vbCrLf tXtOutputSelStart LentXtOutputText End Sub d four to server Call tcpClientSendDataquot4quot Private Sub cmdFouriclickU 39 Se C Lf tXtOutputSelStart LentXtOutputText End Su Private Sub cmeneiclickU end one to server Call tcpClientSendDataquotlquot txtOutputText tXtOutputText amp quotClient Clicked 1quot amp vbCrLf tXtOutputSelStart LentXtOutputText End Sub Private Sub cmdSeveniclickU 39 Send seven to server Call tcpClientSendDataquot7quot txtOutputText tXtOutputText amp 7 quotClient clicked 7quot amp vbC Lf tXtOutputSelStart LentXtOutputText End Sub Private Sub CmdSlXiclleU 39 d 51X to server Call tcpClientSendDataquot6quot txtOutputText tXtOutputText amp quotClient clicked 6quot amp vbCrLf tXtOutputSelStart LentXtOutputText End Sub Private Sub cdehreeiclickU 39 Se three to Call tcpClientSendDataquot3quot txtOutputText tXtOutputText amp quotClient clicked 3quot amp vbCrLf tXtOutputSelStart LentXtOutputText End Su Lecture 5 Lecture 5 ActiveX and Winsock ActiveX What s all the hype Distributed computing integrate personal machine to W It s a distributed computing technology 0 Controls 0 Components 0 Documents Reusable binary code component developed under any language capable of generating ActiveX binaries Modular and interchangeable ActiveX and acronyms OLE ActiveX DCOM COM Figure 1 ActiveX technologies Component Object Model COM Heart of reusable component development languagelocationcompiler independent Binarylevel specification describing how components communicate interoperability Make applications more dynamic customizable and flexible It s the foundation for ActiveX Distributed COM DCOM COM with a longer wire execute COM components remotely Collectively solve complex problems using remote machines Securit Enterprise level building block Object Linking and Embedding OLE Technology allowing applications to work together eg Excel and Word containers Services drag drop and automation one app controls another ActiveX Reusable components that can be plugged into VB VC etc Examples calendars spell checker image editor Winsock Natural evolution from OLE VB 50 and 60 can create ActiveX controls VBX VB extensions cannot be used in VB 50 and 60 Lecture 5 Example ActiveX rather than OLE automation using Word Objectwe Chckmg the W te command button WM Save Whatever 5 m the text box nto a Word DOC caHed myWord doc Step 1 Create the GU Step 2 Aulnmaled Wm Examvlr mam hmwnlm I Em Wms Project WordAutomatwon Form frmWordAutomatwo Form Name frm utomauon Capuon Automauon Word Examp e Textbox Name txtDwsp ay Command Name cmdvvnte mmand Name cdem M crosoft Word h Setect ProjectReferences m wnrdAutnr Autamatmn mm Re nssetsthet dwsp aved Lecture 5 SchH duvvn uuk fur and check uff MicrosoRWord 90 Object Library x chck OK Relevances wnldAI mna nvhp Eva ak eRefevences A Cane DMmsan mm mm Fvamewmk DMmsan VML Rendevev Ohyect 111qu DMmsan WaHet 015mm an D Mmsan WaHet JCB an Emma 1 DMmsan Wehdass 11mm v u DMmsan Wehdass 11mm v u Mmsan mam staHev oh 2 Lb a Uh ambuwmmuu D msmw 1 n We 11mm msmm 51mm 1 n We 11mm Sdfmap 1 u Wye mm D 11515va 1 n We mm m snsetun 1 u was Uhvavv Ar 4 Mmsan WW 9 u ohyect 11bqu Lacatmn c quvam F125M1m5aft orr1ceorr1ceMswoRDQ om swam Language 1 A A new D a Step 3 Crude Prugrammmg 512p 39nm frmAutDmatlun 39Demunstrates autumatlun usmg Word obc1ub Expllclt mm mWDrd As WurdApp11cat10n Prlvate Sub cmubxuichcko End End Sub Prlvate Sub cmdwrlte c11ck cmdwrlteEnahled 7 False c311 mWDrdDDcumentsAdd mWDrdSelectlunShadlngTexture wdTextureZZPtSPercent mwurdSelectlunFDnt lze 3n c311 mwurdSelectlunTypeTexttxtInputText call u a n b 1 quotc u u call mWDrdQu1t End Sub Prlvate Sub Formiln1t131129 59 mm b 7 New WurdApp11Cat10n End Sub Prlvate Sub ClassiTerm1n3t9 Set mWDrd Nuthlng End Sub Lecture 5 Explore Open myWorddoc it has whatever was typed in txtlnputtext Note the font size and shading Fon39nat Borders and ShadingShading value Change font size mWord SelectionFont Size Change shading mWord Selection ShadingTexture wdTexture4OPe rcent Example ActiveX DLL 0 VB allows one to create DLL s it isn t executable but is to be used by other programs Objective Word s builtin spellchecker can be recycled for our own standalone program Step 1 Start an ActiveX DLL project Wsoft 7 New I Existing Recenll New Pm ecl e o StandavdEXE nrmexrxr nmem ActiveX vanppitemn antral Wizard k gt a N6 rec rec l39 Dan l Shaw this dieing m the rune Save Class as classActiveXDll Save Project as projectActiveXDll Step 2 Code programming 39FILE classActlveXDll 39ActlveX DLL example Option Explicit Private mWordRef As WordAppllcatlon Private Sub Classilnltlallze Set mWordRef New WordAppllcatlon End Sub is spelled incorrectly 39Functlon returns False if S AS Boolean Public Function SpellCheckWordByVal s As String SpellCheckWord mWordRefCheckSpelllngs End Function Private Sub ClassiTermlnate Call mWordRefQult Set mWordRef Nothing End Sub 4 Lecture 5 Step 3 Give your DLL an appropriate description Wew Project Explorer Hall Cld act Fgfmat erul Em 1am Edwin Mnuaw heiD 8 0 91 Q E 51 3 3 121 migrant Shifh 39 92mm Shift LastPnsitimn midi ElveXDJJ xantple r p Ellycai wm uw at As WurdAppllDarun Watch windaw E E Sawier m g g r Pmpsvt N E Em Lam wrnapw pmpemages 5mm em assilnlclathi at New WordApplicaclun rapig s w pines tiveXDI39 k ActiveXDlicls Ll sa ye FrDjs ct Earn1v Piniact Liblisti mn Add 9 Erht u lied 1m Du awe id Change Project Name and add Project Description semiai Iiilake Campiel Eampmem Debugging ijsct Iype gtartup Object m one Prujzct ame W mien Heb elp Fiia Name nunrgx 1m m n Emjbcl Destriphcn MEMBER Active X SDEU Checker Damn r Unaltgndszxecut39mn k Bad PM I L is m XC rm Apartment Threaded iv w J V2 7 39 Thread perobieci Iquot Requiiegn nse Key FTiii39eadPgni x 3 threed5 239 F Retained In Maniqu cancel Help Lecture 5 Step 4 Name your class click on Class1 and change name to classActiveXDll a U Nuthvswlable Step 5 Compile First make sure that from ProjectReferences Microsoft Word 90 Object Library is checked off Save then FilesMake projectActiveXDlldll are m Mew grayed ram thuq gun Qgew Drawerquot New Raye mm m my mama Mndaw de p In oJan Praye tlv we 1 run A d Frayed Fl Sage Frayed a g Mam Drnyeanmvexnlln ma 5 iave assntveD 5 thS dassActwewadsas Save evema P m quotaaaaa ta quotaaaapraaaaan Save hanqzin pt 5M m D New uh ClassiInltlahze n quotordRei N WordApplicatlun Make Pynyed p t aaaaana ralaa a a apajjaa naaaaa 417 Sets a va ue thatSpen es whether Wu 5 i tsaexxcheakeyoema VLF v anxveaheinst nms ar a Rub a 5 Step 6 Create a program EXE le that uses projectActiveXDd GUI v Testing SpellChecker DLL HE Wm Check Spawning Lecture 5 Save Project as spellCheckerDemo Save Form as speIICheckDemo Form Name ii39mSpellCheckDemo Caption Testing SpellcheckerDLL Command Name cmdcheck Label Name lblTexilnpui Caption Word Text box Name ixilnpui Label Name lleisplay Bordersiyie 1 Fixed Single r I r 111111 A View Resources Evaiiahie References a Kodak Image am antvai a ancei EKadak Image 111 antvai Kad k me 2 Stan tvai D Kodak Image Yhumhnaii antvai 1 Emma Eiavaut 1 n We Lihvavv J W 11 y y e D M ntmi 1 e ii r1113 Prion am n Active Se 1 Obiect Library V new D Microsoft ActiveMavie Cantmi 1 1 DMicmsaft Activex Data ohms Muitirdimensianai 1 39 D Microsoft Activex Data ohms 2 u Lihvaw r DMicmsaft Activex Data ohms 2 1 Lihvaw m Masai ActiveX Data Ohiects Remydset 211 11 1 MEMEDD mm x SDeii Checker Demo Location CDDCauvsesmemEDUweekn5vbPvDqram5ativeXD Dmieci Language 5 andavd Also make sure that Microsoft Word 90 Object Library39 is also checked Step 8 Code Programming E ILE EmSpel lCheckDemo 39E orm module i exerclse Spellchecker DLL Optlon Expllclt Prlvate mchecker A5 clas sAct 1veXDll V Spell Checker Demo recall name of class Lecture 5 Checkicllck 0 mChecke r Spellcheckwo lblmsplay Captlon Prlvate Sub cmd If rdtxtInputText n 7 tInputText amp quot 15 spelled correctlyquot Else llelsplayCaptlon txtInputText amp f quot 15 spelled lncorrectlyquot End I End Sub Prlvate Sub Formilnltlallze Set mChecker New classActlveXDll End Sub recall name of class Prlvate Sub FormiTermlnateo Set mChecker 7 Nothlng End Sub After savmg even01mg run your program and test Yes 5 Spell Checker nu WW Vamp ay heck SpeHm ramplay a sDeHed meaueeny Lecture 5 Example Offtheshelf ActiveX Components ActiveX is a technology components can be created in VB vc and other compilers Why reinvent the whee 339d party vendors supply ActiveX components eg LabView L Inn y IAquot 1 r Sample Sources VB Zone httpIlpdhutwww550mgscomlvhzonecomrolsllistindexhtm Download 32 httpIlwwwdownload32comlw39ndowleevelopmentlActiveXdefaulthtm Ia XI 1 2 3 Winsiteh Ilwwwwin tecomlwe ev 4 5 Code Guru httpIlwwwvbxtrascomlcategorieslgaugedialmetercomponenhasg Total Shareware httplwwwtotalsharewarecomASPlist viewaspcatid10ampPage4 6 Yuris Puteinis LCD panel ActiveX httpIlwwwge0citiescomlsiliconVallgyLahl434ol Download axPanelzip contains ActiveX component and panelVbzip VB examples Step 1 With ActiveX 39 need in register it registration program eg RegAX Alternatively StartRun regsvr32 drivepath lename o unregister StartRun regsvr32 lu drive path lename Step 2 Make sure ProjectsRegister has axPanel 10 Type Library checked Make sure ProjectsComponents has axPanel 10 Type Library checked Enmvnnenls cannot Designeisl lnseiiahlejhiecisl i gelected Items Only 7 ideoSoflysFlexZContmls Location ciwwoowsisvsrmivsnzxaocx Eancel Anny ActiveX y u Lecture 5 Step 3 Cuns trum yuur 3w Step 4 Crude prugrammmg Prlvate Sub cmlesplay Cllcko myAxPanelText txtInputText End h That s m O entwmes ms39mbmed AmveX cumpunents came thh EXp anatmns uf nude prugrammmg use Lecture 5 Winsock What is Winsock Enables clientserver application programming using either TCP transmission control protocol or UDP user datagram protocol o It operates on the lowest level ofall Internet controls eg WebBrowser lntemet Transfer hypertext transfer protocol and le transfer protocol TCP 0 Similar to telephone conversation connection is needed before conversation 0 Use for transmitting large amounts ofdata and when reliability imperative 0 Like mail packets are created addressed and sent over network 0 Small data sent intermittently Best of all Winsock can be treated like any other VB component Example ClientServer application using Winsock Objective Create a chat program Step 1 Create the Client with Project and Form names tcpClientDemo and fn39nTcpClientDemo respectively Enable Winsock component using ProjectComponents Microsoft Winsock Control 60 annals I 0mm lnsmlahle hlecls Emwse F isletted Items only Micmsuft Winsocktontvol an um cwiNDowssverMMswiNscK x cm Apply Note the Winsock control will be at bottom oftoolbox EI E L ecture 5 Step 2 Setup Chem eux DI mp E em Step 3 Chem code programmmg A Snmple TC Chen 1 a r 9 mg 1912 Set up local or and quotan in connecclun ccpClencRemceHusc Inpucasstms the remote has 11 Addressquot 7 quot1p Addressquot quotlucalh quotw Th2quot quotlucalhuscquot If DpcllencRemuceHDsc ccpchenc Rsmscsuss End If ccpClencRemcePDrc suuu server pun csu ccpCJenCDnnecc connect w Rsmscsuss address and Sub Prlvace Sub Formikeslz On Error R sum Next csu md endJ mVELScalevlldch s cmdsenthdth m csu cx3ampndHDvELD u acsxsumch s cmd enthdcm csu cxr0utpur quLE cxr enm elghcy acsxsumch 7 acsxsnsngh s cxr enm elghd Prlvace Sub rsmgsmmscen csu ccpClenCluse Sub Lecture 5 private Sub cmdSendiclicko 39 d data to server Call tcpclientSendDataquotclient gtgtgt quot amp txtSendText xt amp quotclient gtgtgt quot amp txtsendText amp vbCrLf amp vbCrLf txtoutputSelStart Len txtOutputText txtsendText End Sub private Sub tcpCllenticloseO dSendpnabled palse Call tcpclientclose 39 server closed client should too txtOutputText txtOutputText amp quotServer closed connectionquot amp vbCrLf txtoutputSelStart Len txtOutputText End Sub private Sub tcpCllenticonnect i when connection occurs display a message cmdSendpnabled True txtOutputText quotConnected to 1p address amp 7 tcpCllentRemoteHostIP amp vbCrLf amp vbCrLf private Sub tcpCllentiDataArrlvalEyVal bytespotal As Long im message As String Call tcpclienteetData message i get data from server txtOutputText txtOutputText amp essage amp vbCrLf amp vbCrLf txtoutputSelStart Len txtOutputText End Sub private Sub tcpCllentiErrorUEyVal Number As Integer Description As String pyVal Scode As Long pyVal Source As String pyVal HelpE lle As String pyVal HelpContext As Long CancelDisplay As poolean 39 If the client falls to connect to server then this code executes Dim result As lnte er result MsgpoxSource amp quot quot amp Description amp vbCrLf amp quotDohl Can39t connect to serverlquot 7 0K nly quot cpl Errorquot 39 ource variable is the control winsock in this case causing the error 39 Description variable cites the error message 39 vbOKOnly is he control button 39 TCPIP prror is the Mngox caption End End Sub Step 4 Create the Client Program and Form name tcpServerDemo and fn39nServerDemp respectively Also make sure ProjectComponent M rosoftW sock Contra Step Client GUI ple IEP Salve E Lecture 5 Step 6 Client code programming 39 FILE tcpServer 39 DATE 011500 1230 TH39 P Oh 39 DESC A Simple TCP Server 39 REFS Deitel p 826 Fig 1910 Option Explicit Private Sub FormiLoadU cmdSendEnabled False 39 Set up local port and wait for connection tcpServerLocalPort 00 Call tcpServerListen End Sub Private Sub FormiResizeU n Error Resume Next Call cmdSendMoveScaleWidth cmdSendWidth 0 ScaleWidth cmdSendWidth txtSendHeight ScaleWidth ScaleHeight txtSendHeight End Sub Private Sub FormiTerminateU tcpServerClose End Sub Private Sub tcpServe riclose c mdSendEnabled False 39 cli nt closed server should too quotClient closed connectionquot amp vbCrLf amp vbCrLf Call tcpServerClose e txtOutputText txtOutputText amp txtOutputSelStart LentxtOutputText Call tcpServerListen 39 l sten for next connection End Sub Private Sub cmdSendiclickU 39 Sen follOWing text data to the client amp txtSendText 39s txtOutputText Window txtOutputText amp quotServer gtgtgtquot amp txtSendText amp 7 rLf amp vbCrLf Clear the txtSendText Windowquot txtSendText quotquot txtOutputSelStart LentxtOutputText End Su Private Sub tcpServer7ConnectionRequestByVal requestID As Long 39 Ensure that tcpServer is closed 39 before accepting a new connection If tcpServerState ltgt sckClosed Then Call tcpServerClose End If cmdSendEnabled True 39 accept connection txtOutputText 7 tcpServerRemoteHostIP amp quot is successfulquot amp vbCrLf amp 7 quotPort quot tcpServerRemotePort amp vbCrLf amp vbCrLf End Sub Lecture 5 puvate Sub tcp erveribataArrlvalEyval hytesTutal As Lang 9 e As EH Call tcp erveGetDatalmessage get aata from ehent txtOutputText txtOutputText a neaaage a vhcrLf a vhcrLf txtoutput el tart Lenltxtoutput l ext End Sub 111g Eyval aeaae As Lang Eyval puvate Sub tcp erveri rrurl yval number As Integer Descrlptlun As St on e a Cancelblsplay As Boole tung Eyval Helprue As stung Eyval Helpcuntext A5 L ng s n As 5 Dlm result As Integer result Msg uxl uurce a v v a Descrlptlun 7 thKOnly quotTCPIP Errorquot End End Sub Step 7 Run Server and note IP address StartRun winipcfg mm Eun gulahun E E Elhemd Adam Walme nn ii PPP Adapter v AdapleIAddvets 444553MUD 7 7 r IPMdv s Sunnenmk 255255 z n Derauknaeway museum Iquot regew BahiaMI RmAII Mavewa gtgt Step 8 Run Client and type in Server39s IP address Client and Server should be able to communicate we the vemme hast w Address UK mwmm Lecture 5 Send rexr Elem gtgtgt hay mm 7w 39 i Slmnle IEP Ellen HE a we 2 7m Messa es between cl nl and server can be sent and received A simple chat programw How does it work Server speer B553 rrH number rs ypmaHy dune m the FormiLuad prunedure tupServeranaanrt e 5000 2 s r r Jase Call tupServerListen and arr attempt m aeeepums reques t rsmruugh Vstuck s Accept methud Call tcpserverncceptrequestID chanteserver cunnectmn has been Estabhshed Lecture 5 4 5 Client 1 2 3 4 Messages arriving at server are processed in DataArrival procedure Strings are retrieved from and sent to client using tcpServer GetData message tcpServer SendData message When transmission is complete and server closes connection the Close procedure is executed Call tcpServer Close FormiLoad prompts user to type in the server s IP address localhost is a reserved it s the IP address of the user s computer tcpclient RemotePort 5000 Call tcpclient Connect means that client should attempt a connection to server on port 5000 If connection is successful then tcpClientConnect is executed and a short message is displayed If data arrives at client from server the event procedure tcpClientDataArriva1 is executed String is stored in message Call tcpclient GetData message Clicking cmdSend button calls cmdSendiclick and text in the txtSend box is submitted to server Call tcpclientSendData CLIEN39139 gtgtgt amp txtSend39139ext Conclusions Winsock control provides relatively straightforward Internet programming Winsock is the foundation of Internet capability in Microsoft s OS allowing browsers FTP chat and terminal applications Strings can be sent between client and server through a chat program Hence we can actuate peripherals or read sensors 8255 can be installed in server The 8255dl allows readwrite capability and hence clients can readwrite to 8255 via the Internet Can upload data to a web server and view realtime data acquisition with browsers E20002027X3 This version Jan 1998 0K Semiconductor previous Aug19 MSM82C55A 2RSIGSNJS CMOS PROGRAMMABLE PERIPHERAL INTERFACE GENERAL DESCRIPTION The MSM82C55A2 is a programmable universal lO interface device which operates as high speed and on low power consumption due to 3 silicon gate CMOS technology It is the best fit as an lO port in a systemwhich employs the 8bit parallel processing MSM80C85AH CPU This device has 24bit lO pins equivalent to three 8bit lO ports and all inputsoutputs are TTL interface compatible FEATURES 0 High speed and low power consumption due to 3 silicon gate CMOS technology 0 3 V to 6 V single power supply 0 Full static operation 0 Programmable 24bit lO ports 0 Bidirectional bus operation Port A 0 Bit setreset function Port C 0 TTL compatible 0 Compatible with 8255A5 0 40pin Plastic DIP DIP40P600254 Product name MSM82C55A2RS 0 44pin Plastic QF QFI44 P8650127 Product name MSM82C55AZVIS 0 44pin Plastic QFP QFP44 P9100802K Product name MSMSZCSSAZGSZK 126 OKI Semiconductor CIRCUIT CONFIGURATION GND MSM82C55A2RSGSNJS Group A Control a Group B Control Internal Bus Line as Low Order 4 Bits 8 Data D D BUS 0 7 Buffer W i Read WR Write RESET 005 E A0 A T A1 lt D PAg PA7 226 OKI Semiconductor MSM82C55A2RSGSNJS PIN CONFIGURATION TOP VIEW 40 pin Plastic DIP PAS I U E PA4 FAQ I E PA5 PA I E PAS PAD E E PA7 m E O E W E I E RESET GND I E Du A1 II E 01 A0 II E Dz P07 IE E De PCs II E DA P05 II E 05 P04 HE E De ch II E 07 44 pin Plastic QFP O PCs E E PBS P30 IE El PB5 P31 IE 2 P34 P32 lg E PBS 44 pin Plastic QFJ 326 OKI Semiconductor MSM82C55A2RSGSNJS ABSOLUTE MAXIMUM RATINGS R t39 Parameter Symbol quot 39 3 mg Unit MSM82c55A 2Rs MSM82c55A 2Gs MSM82c55A 2vJs Supply Voltage Vcc Ta 25 C 05 to 7 V Input Voltage VIN With reSpect 05 to Vcc 05 V Output Voltage VOUT to GND 05 to Vcc 05 V Storage Temperature Tsm 455 to 150 00 Power Dissipation PD Ta 25 C 10 07 10 W OPERATING RANGE Parameter I Symbol I Range I Unit Supply Voltage I Vcc I 3 to 6 I V Operating Temperature I Top I 40 to 85 I C RECOMMENDED OPERATING RANGE Parameter Symbol Min Typ Max Unit Supply Voltage Vcc 45 5 55 V Operating Temperature Top 40 25 85 C L Input Voltage VIL 03 08 V H Input Voltage VIH 22 Vcc 03 V DC CHARACTERISTICS P t s b I c d39t39 MSMSZCSSA39Z u 39t arame er ym 0 on I ions Min Typ Max m L Output Voltage VOL 0L 25 mA 04 V H Output Voltage VOH IOH 40 A 4392 V IOH25 mA 37 V Input Leak Current I 0 VIN Vcc VCC 45 V to 55 V 1 1 uA Output Leak Current ILo 0 Vour Vcc T8 40 C 10 35 C 10 10 uA C 0 pF cs 2 v 02 v I L Supply Current CC Iccs VH2Vcc02V 01 10 ILA Standby VIL g 02 V IO Wire Cycle Average Supply CC 82055A2 3 mA Current Ame 8 MHzCPU Timing 426 OKI Semiconductor MSM82C55A2RSGSNJS AC CHARACTERISTICS vcc45vm 55V Ta 40 to 35 Parameter Symbol Mniirschg Unit Remarks Setup Time of Address to the Falling Edge of D tAR 20 ns Hold Time of Address to the Rising Edge ofW tRA 0 ns W Pulse Width tRR 100 ns Delay Time from the Falling Edge otho the Output of tRD 120 5 Defined Data Delay Time from the Rising Edge otho the Floating of tDF 10 75 5 Data Bus Time frolthe ng Edge ofWorWto the Next Falling W 200 5 Edge of RD or WR Setup Time of Address before the Falling Edge ofW tAW 0 ns Hold Time of Address afterthe Rising Edge ofW tWA 20 ns W Pulse Width tWW 150 ns Setup Time of Bus Data before the Rising Edge ofW tDW 50 ns Hold Time of Bus Data after the Rising Edge ofW tWD 30 ns Delay Time from the rising Edge otho the Output of tWB 200 5 Defined Data Setup Time of Port Data before the Falling Edge ofW tIR 20 ns Hold Time of Port Data afterthe Rising Edge ofW tHR 10 ns W Pulse Width tAK 100 ns Load Pulse Width tST 100 ns 150 pF Setup Time of Port Data before the rising Edge of W tps 20 ns Hold Time of Port Bus Data after the rising Edge of tpH 50 ns Delay Time from the Falling Edge ofmto the Output of MD 150 5 Defined Data Delay Time from the Rising Edge ofmto the Floating of tKD 20 250 5 Port Port A In Mode 2 Dilay Time from the Rising Edge otho the Falling Edge of tWOB 150 ns OBF 3 TIme from the Falling Edge of ACKto the RIsIng Edge of Wm 150 ns I eliay Time from the Falling Edge of STB to the Rising Edge of tSIB 150 ns I eliay Time from the Rising Edge otho the Falling Edge of tRIB 150 5 Delay Time from the the Falling Edge otho the Falling Edge tRIT 200 S of INTR Delay Time from the Rising Edge of to the Rising Edge of ts 150 ns INTR Delay Time from the Rising Edge ofmto the Rising Edge of WT 150 ns INTR Reliany Time from the Falling Edge otho the Falling Edge of WT 250 ns Note Timing measured at VL 08 V and VH 22 V for both inputs and outputs 526 OKI Semiconductor MSM82C55A2RSGSNJS TIMING DIAGRAM Basic Input Operation Mode 0 W Port Input ALAo D7D0 7 7 7 7 7 7 7 7 7 Basic Output Operation Mode 0 W D7 Do E A1 A0 Port Output Strobe Input Operation Mode 1 IBF INTR W Port Input 7quot 626 OKI Semiconductor MSM82C55A2RSGSNJS Strobe Output Operation Mode 1 Port Output Bidirectional Bus Operation Mode 2 726 OKI Semiconductor OUTPUT CHARACTERISTICS REFERENCE VALUE 1 Output quotHquot Voltage VOH vs Output Current IOH Output H Voltage VOH V Ta 40 to 85 C Vcc 50 V 04 2 3445 Output Current IoH mA 2 Output quotLquot Voltage VOL vs Output Current IOL Output L Voltage VOL V Vcc 50 V Ta 40 to 85 C Output Current 0L mA MSM82C55A2RSGSNJS Note The direction of flowing into the device is taken as positive for the output current 826 OKI Semiconductor PIN DESCRIPTION MSM82C55A2RSGSNJS Pin No Item InputOutput Function These are threestate 8bit bidiectionaliuses used to write and D7 D0 Bidirectional input and read data upon receipt of the WR and RD signals from CPU and also Data BUS Output used when control words and bit setreset data are transferred from CPU to MSM82C55A2 This signal is used to reset the control register and all internal registers when it is in high level At this time ports are all made into RESET R9891 inPUi inPUt the input mode high impedance status all port latches are cleared to 0 and all ports groups are set to mode 0 When the is in low level data transmission is enabled with CPU E Chip Select Input When it is in high level the data bus is made into the high impedance Input status where no write nor read operation is performed Internal registers hold their previous status however i WhenWis in low level data is transferred from MSM82C55A2 to RD Read Input Input 7 When W is in low level data or control words are transferred from WR W It t t r e p p CPU to MSM82C55A2 By combination of A0 and A1 either one is selected from among A0 A1 Port seieCi inpm Input port A port B port C and control register These pins are usually Address connected to low order 2 bits of the address bus These are universal 8bit IO ports The direction of inputs outputs PA7 PAO Port A Inpm and can be determined by writing a control word Especially port A can ompm be used as a bidirectional port when it is set to mode 2 Input and These are universal 8bit IO ports The direction of inputsoutputs P37 39 PB Port B Output ports can be determined by writing a control word These are universal 8bit IO ports The direction of inputsoutputs Input and can be determined by writing a control word as 2 ports with 4 bits PC7 PC0 Port C Output each When port A or port B is used in mode 1 or mode 2 port A only they become control pins Especially when port C is used as an output port each bit can setreset independently VCC 5V power supply GND GND 926 OKI Semiconductor MSM82C55A2RSGSNJS BASIC FUNCTIONAL DESCRIPTION Group A and Group B When setting a mode to a port having 24 bits set it by dividing it into two groups of 12 bits each Group A Port A 8 bits and high order 4 bits of port C PC7PC4 Group B Port B 8 bits and low order 4 bits of port C PC3PC0 Mode 0 1 2 There are 3 types of modes to be set by grouping as follows Mode 0 Basic input operationoutput operation Available for both groups A and B Mode 1 Strobe input operationoutput operation Available for both groups A and B Mode 2 Bidirectional bus operation Available for group A only When used in model or mode 2 however port C has bits to be defined as ports for control signal for operation ports port A for group A and port B for group B of their respective groups Port A B C The internal structure of 3 ports is as follows Port A One 8bit data output latchbuffer and one 8bit data input latch Port B One 8bit data inputoutput latchbuffer and one 8bit data input buffer Port C One 8bitdata outputlatchbuffer and one 8bit data input buffer no latch for input Single bit setreset function for port C When port C is defined as an output port it is possible to set to turn to high level or reset to turn to low level any one of 8 bits individually without affecting other bits 1026 OKI Semiconductor MSM82C55A2RSGSNJS OPERATIONAL DESCRIPTION Control Logic Operations by addresses and control signals eg read and write etc are as shown in the table Port A a Data Bus Data Bus a Port A Output Control Data Bus a Control Others Setting of Control Word The control register is composed of 7bit latch circuit and 1bit flag as shown below Group A Control Bits Group B Control Bits e l07l06l05l04l03l02l01lDOl Definition of input 0 Output output of low order l nput 4 bits of port C Definition of input 0 Output output of 8 bits of 1 Input port B gt Mode definition of 0 Mode 0 group B it Mode 1 gt Definition of input output of high order i 1 33 4 bits of port C gt Definition of input 0 Output output of8 bits of ii Input port A 4 4 quot ofgroupA Control word Identification flag Be sure to set 1 for the control word to define a mode and inputoutput lt When set to 0 it becomes gt the control word for bit set reset 1126 OKI Semiconductor MSM82C55A2RSGSNJS Precaution for Mode Selection The output registers for ports A and C are cleared to 1 each time data is written in the command register and the mode is changed but the port E state is undefined Bit SetReset Function When port C is defined as output port it is possible to set set output to 1 or reset set output to 0 any one of 8 bits without affecting other bits as shown be ow D7 D6 D5 D4 D3 D2 D1D0 Definition of setreset 0 Reset foradesired bit l 1 et Definition of bit wanted to be set or reset gt Dont s Care Control word Identification flag Be sure to set to 0 for bit setreset When set to 1 it becomes the control word to define a mode and inputoutput Interrupt Control Function When the MSM82C55A2 is used in mode 1 or mode 2 the interrupt signal for the CPU is provided The interrupt request signal is output from port C When the internal flipflop lNTE is set beforehand at this time the desired interrupt request signal is output When it is reset beforehand however the interrupt request signal is not output The setreset of the internal flipflop is made by the bit setreset operation for port C Virtually Bit set 2 lNTE is set Interrupt allowed Bit reset lNTE is reset Interrupt inhibited Operational Description by Mode L Mode 0 Basic inputoutput operation Mode 0 makes the MSM82C55A2 operate as a basic input port or output port No control signals such as interrupt request etc are required in this mode All 24 bits can be used as two8bit ports and two 4bit ports Sixteen combinations are then possible for inputs outputs The inputs are not latched but the outputs are 1226 OKI Semiconductor MSM82C55A2RSGSNJS Control Word Group A Group B Type D 06 05 D4 D3 D2 D1 D0 PMA HighOTEifrlttiBits P rtB L w 1 ms 1 1 0 0 0 0 0 0 0 Output Output Output Output 2 1 0 0 0 0 0 0 1 Output Output Output Input 3 1 0 0 0 0 0 1 0 Output Output Input Output 4 1 0 0 0 0 0 1 1 Output Output Input Input 5 1 0 0 0 1 0 0 0 Output Input Output Output 6 1 0 0 0 1 0 0 1 Output Input Output Input 7 1 0 0 0 1 0 1 0 Output Input Input Ouput 8 1 0 0 0 1 0 1 1 Output Input Input Input 9 1 0 0 1 0 0 0 0 Input Output Output Output 10 1 0 0 1 0 0 0 1 Input Output Output Input 11 1 0 0 1 0 0 1 0 Input Output Input Output 12 1 0 0 1 0 0 1 1 Input Output Input Input 13 1 0 0 1 1 0 0 0 Input Input Output Output 14 1 0 0 1 1 0 0 1 Input Input Output Input 15 1 0 0 1 1 0 1 0 Input Input Input Output 16 1 0 0 1 1 0 1 1 Input Input Input Input Notes When used in mode 0 for both groups A and B 2 Mode 1 Strobe inputoutput operation In mode 1 the strobe interrupt and other control signals are used when inputoutput operations are made from a specified port This mode is available for both groups A and B In group A at this time port A is used as the data line and port C as the control signal Following is a description of the input operation in mode 1 Strobe input When this signal is low level the data output from terminal to port is fetched into the internal latch of the port This can be made independent from the CPU and the data is not output to the data bus until the RD signal arrives from the CPU IBF Input buffer full flag output This is the response signal for the m This signal when turned to high level indicates that data is fetched into the input latch This signal turns to high level at the falling edge of STB and to low level at the rising edge of W INTR Interrupt request output This is the interrupt request signal for the CPU of the data fetched into the input latch It is indicated by high level only when the internal lNTE flipflop is set This signal turns to high level at the rising edge of them BF 1 at this time and low level at the falling edge of the W when the INTE is set INTE A of group A is set when the bit for PC4 is set while INTE B of group Bis setwhen the bit for PCZ is set Following is a description of the output operation of mode 1 1326 OKI Semiconductor MSM82C55A2RSGSNJS W Output buffer full flag output This signal when turned to low level indicates that data is written to the specified port upon receipt of the W signal from the CPU This signal turns to low level at the rising edge of them and high level at the falling edge of the ACK ACK Acknowledge input This signal when turned to low level indicates that the terminal has received data INTR Interrupt request output This is the signal used to interrupt the CPU when a terminal receives data from the CPU via the MSM82C55A5 It indicates the occurrence of the interrupt in high level only when the internal lNTE flipflop is set This signal turns to high level at the rising edge of the ACK OBF 1 at this time and low level at the falling edge of when the TNTE B is set lNTE A of group A is set when the bit for PC6 is set while lNTE B of group Bis setwhen the bit for PC2 is set Mode 1 Input Group A 8 Group B 8 7777 7 PA7 7quot P87 r lINTEAl pAO lINTEBl p30 P04 P A P02 Fmg P05 AIBFA P01 aIBFB RD 4 W 4 P03 AINTRA P00 a INTRB Note Although belonging to group B P03 operates as the control signal of group Afunctionally Mode 1 Output Group A 8 Group B 8 rquotquoti PA7 w rm i PB7 w iINTEAi PAO iINTEBi P30 7 P07 amt L7 P01 9mg PCs 8W1 P02 HWB WR 4 WR 439 P03 4 INTRA P00 4 INTRB 1426 OKI Semiconductor Port C Function Allocation in Mode 1 MSM82C55A2RSGSNJS Combination of InputOutput Group A Input Group A Input Group A Output Group A Output Port 0 Group B Input Group B Output Group B Input Group B Output P00 INTRB INTRB INTRB INTRB P01 IBFB W3 IBFB W3 P02 m3 m3 m3 m3 P03 INTRA INTRA INTRA INTRA P04 m1 m1 IO IO P05 IBFA IBFA IO IO p06 IO IO A CKA WA P07 IO IO WA WA Note 10 is a bit not used as the control signal but it is available as a port of mode 0 Examples of the relation between the control words and pins when used in mode 1 are shown below a When group A is mode 1 output and group B is mode 1 input D7 6 Us D4 D3 2 D1 ControlWord 1 0 1 0 10 1 1 X Selection of IO Lr As a of P00 PCs bits of P04 and p05 become a control pin when not defined in this case this bit is as a control pin DO I Care 1 Input 0 Output PA7 PAg 347 W P07 6 OBFA PCs i m PCSINTRA G AMdiOt t roup o e u pu P04 P05 75 0 Group B Mode 1 Input PB7 P30 7 7 P02 P STBB W 4 P01 a IBFB F Co aINTRB 1526 OKI Semiconductor MSM82C55A2RSGSNJS b When group A is mode 1 input and group B is mode 1 output D7 D6 D5 D4 D3 D2 D1 D0 iiioiiiiimiiioixi i p Selection of lO of PCs and P07 when not defined as a control pin 1 Input 0 Output PA7 FAQ 5 W 4 PC4 7 A P05 AIBFA POSTINTRA G A M d 1 t rou o e n u PCG P07 84 0 Grouii B Model Otijtput PB7 PBO gt PC1 amg m a P02 H W3 P00 HINTRB 3 Mode 2 Strobe bidirectional bus O operation In mode 2 it is possible to transfer data in 2 directions through a single 8bit port This operation is akin to a combination between input and output operations Port C waits for the control signal in this case too Mode 2 is available only for group A however Next a description is made on mode 2 W Output buffer full flag output This signal when turned to low level indicates that data has been written to the internal output latch upon receipt of the WR signal from the CPU At this time port A is still in the high impedance status and the data is not yet output to the outside This signal turns to low level at the rising edge of the WR and high level at the falling edge of the ACK W Acknowledge input When a low level signal is input to this pin the high impedance status of port A is cleared the buffer is enabled and the data written to the internal output latch is output to port A When the input returns to high level port A is made into the high impedance status Strobe input When this signal turns to low level the data output to the port from the pin is fetched into the internal input latch The data is output to the databus upon receipt of the RD signal from the CPU but it remains in the high impedance status until then IBF Input buffer full flag output This signal when turned to high level indicates that data from the pin has been fetched into the input latch This signal turns to high level at the falling edge of them and low level at the rising edge of the W 1626 OKI Semiconductor MSM82C55A2RSGSNJS INTR Interrupt request output This signal is used to interrupt the CPU and its operation in the same as in mode 1 There are two lNTE flipflops internally available for input and output to select either interrupt of input or output operation The lNTEl is used to control the interrupt request for output operation and it can be reset by the bit set for PC6 lNTEZ is used to control the interrupt request for the input operation and it can be set by the bit set for PC4 Mode 2 HO Operation mg mg Port C Function Allocation in Mode 2 Port C Function amp P01 Confirmed to the Group B Mode P02 P03 INTRA P04 A P05 IBFA P06 WA P07 WA Following is an example of the relation between the control word and the pin when used in mode 2 When input in mode 2 for group A and in mode 1 for group B 1726 OKI Semiconductor MSM82C55A2RSGSNJS As all of 8 bits of port C become control pins in this case D3 and D0 bits are treated as Don t Care No lO specification is required for mode 2 since it is a bidirectional operation This bit is therefore treated as Don t Care When group A is set to mode 2 this bit is treated as Don t Care 390 0 w 4 INTRA PA7 PAO agt 390 C7 am Ce lt7 WA P04 lt7 STBA Group A Mode 2 P05 4BFA Group B Model lnput J 39U 8 W4 PB7 PBO lt P02 lt7 m3 W 4 P01 4 IBFB PCO 4 INTRB 1826 OKI Semiconductor MSM82C55A2RSGSNJS 4 When Group A is Different in Mode from Group B Group A and group B can be used by setting them in different modes each other at the same time When either group is set to mode 1 or mode 2 it is possible to set the one not defined as a control pin in port C to both input and output as port which operates in mode 0 at the 3rd and 0th bits of the control word Mode combinations that define no control bit at port C G A G B Port C 39 quotP 39 P pc7 pc6 pc5 P04 P03 P02 P01 P00 1 Mode 0 IO IO IBFA ll INTRA IO IO IO 2 M0 0 Mode 0 WA WA IO IO INTRA IO IO IO Output 3 Mode 0 quot13935 IO IO IO IO IO g IBFB INTRB 4 Mode 0 MW IO IO m 10 IO m3 m3 lNTRB Output 5 M0 1 Mm IO IO IBFA ll INTRA g IBFB INTRB Input Input 6 MN MW IO IO IBFA ll INTRA W3 g INTRB Input Output Mode 1 MOde 1 7 7 7 oar ACK IO IO INTR STB IBF INTR 7 Output Input A A A B B B Mode 1 Mode 1 7 7 7 7 8 oar ACK IO IO INTR ACK BF INTR Output Output A A A B B B 9 Mode 2 Mode 0 mA WA IBFA A INTRA IO IO IO Controlled at the 3rd bit D3 of Controlled at the 0th bit D0 of the Control Word the Control Word When the 10 bit is set to input in this case it is possible to access data by the normal port C read operation When set to output PCTPC4 bits can be accessed by the bit setreset function only Meanwhile 3 bits from PCZ to PCO can be accessed by normal write operation The bit setreset function can be used for all of PC3PC0 bits Note that the status of port C varies according to the combination of modes like this 1926 OKI Semiconductor MSM82C55A2RSGSNJS 5quot Port C Status Read When port C is used for the control signal that is in either mode 1 or mode 2 each control signal and bus status signal can be read out by reading the content of port C The status read out is as follows G A G B Status Read on the Data Bus muquot muquot D7 06 05 D4 D3 D2 D1 D0 1 quotTESS Mode 0 10 10 IBFA INTEA INTRA 10 10 10 2 MW Mode 0 WA INTEA 10 10 INTRA 10 10 10 Output 3 Mode 0 ES 10 10 10 10 10 INTEB 1ng INTRB 4 Mode 0 MW 10 10 10 10 10 INTEB W3 11mg Output 5 Mme 1 MW 10 10 IBFA INTEA INTRA INTEB 1ng INTRB Input Input 6 MN MW 10 10 IBFA INTEA INTRA INTEB W3 INTRB Input Output 7 MN MW W INTE 10 10 INTR INTE IBF INTR Output Input A A A B B B Mode 1 Mode 1 e OBF INTE 10 10 INTR INTE BF INTR Output Output A A A B B B 9 Mode 2 Mode 0 WA NTE1 IBFA INTEg INTRA 10 10 10 10 Mode 2 quotTESS WA NTE1 IBFA INTEz INTRA INTEB 1ng INTRB 11 Mode 2 quot3 59 WA NTE1 IBFA INTEz INTRA INTEB W3 INTRB u pu 6 Reset of MSM82C55A2 Be sure to keep the RESET signal at power ON in the high level at least for 50 us Subsequently it becomes the input mode at a high level pulse above 500 ns Note Comparison of MSM82655A5 and MSM82655A2 MSM82C55A5 After a write command is executed to the command register the internal latch is cleared in PORTA PORTC For instance 00H is output at the beginning of a write command when the output port is assigned However if PORTB is not cleared at this time PORTB is unstable In other words PORTB only outputs ineffective data unstable value according to the device during the period from after a write command is executed till the first data is written to PORTB MSM82C55A2 After a write command is executed to the command register the internal latch is cleared in All Ports PORTA PORTB PORTC 00H is output at the beginning of a write command when the output port is assigned 2026 OKI Semiconductor MSM82C55A2RSGSNJS NOTICE ON REPLACING LOWSPEED DEVICES WITH HIGHSPEED DEVICES The conventional low speed devices are replaced by highspeed devices as shown below When you want to replace your low speed devices with highspeed devices read the replacement notice given on the next pages Highspeed device New Lowspeed device Old Remarks M80085AH M80085AM80085A2 8bit MPU M80086A10 M80086AM80086A2 16bit MPU M80088A10 M80088AM80088A2 8bit MPU M82084A2 M82084AM82084A5 Clock generator M810555 M81055 RAMlO timer M82037B5 M82037AM82037A5 DMA controller M82051A2 M82051A USART M820532 M820535 Timer M82055A2 M82055A5 PPI 2126 OKI Semiconductor MSM82C55A2RSGSNJS Differences between MSM82C55A5 and MSM82C55A2 1 Manufacturing Process These devices use a 3 u SiGate CMOS process technolog The MSMSZCSSAZ is about 7 smaller in chip size than the MSMSZCSSAS as the MSM82C55A 2 changed its output characteristics 2 Function Item l MSM82055A5 i MSM82055A2 Internal latch during writing into Only ports A and C are cleared the command register Port B is not cleared A poms are Cleared The above function has been improved to remove bugs and other logics are not different between the two devices 3 Electrical Characteristics 31 DC Characteristics Parameter Symbol MSM82C55A5 MSM82C55A2 H H 045v 040v L OU pU VO39mge VOL IOL 25 mA IOL 25 mA H H 24 v 37 v H 0mm VON V0 IOH 400 uA IOH 25 mA A 0 t C t I 5 mA maximum 8 mA maximum Verage pm 9 quot9 CC IO Cycle 1 us IO Cycle 375 ns As shown above the DC characteristics of the MSMSZCSSAZ satisfies the DC characteristics ofthe MSMSZCSSAS 32 AC Characteristics Parameter Symbol MSM82C55A5 MSM82C55A2 Address Hold Time form Rising tRA 20 ns minimum 0 ns minimum WPulse Width iRR 300 ns minimum 100 ns minimum Eggpneagaa gput Delay Time 1RD 200 ns maximum 120 ns maximum Data Floating Delay Time Fromm Rising th 100 ns maximum 75 ns maximum RDWR Recovery Time th 850 ns minimum 200 ns minimum 2226 OKI Semiconductor MSM82C55A2RSGSNJS Parameter Symbol MSM82055A5 MSM82055A2 Address Hold Time form Rising tWA 30 ns minimum 20 ns minimum W Pulse Width tww 300 ns minimum 150 ns minimum Data Setup Time form Rising tDw 1000 ns minimum 50 ns minimum Data Hold Time form Rising MD 40 ns minimum 30 ns minimum De ned Dal Oulpul Time tWB 350 ns maximum 200 ns maximum From WR RIsIng Port Data Hold Time torW Rising tHR 20 ns minimum 10 ns minimum W Pulse Width tAK 300 ns minimum 100 ns minimum W Pulse Width tST 300 ns minimum 100 ns minimum Port Data Hold Time form Falling tPH 180 ns minimum 50 ns minimum W Failing to Defined Data Output tAD 300 ns maximum 150 ns maximum W Failing to W Falling Delay Time tWOB 650 ns maximum 150 ns maximum W Falling tom Rising Delay Time tAOB 350 ns maximum 150 ns maximum W Failing to IBF Rising Delay Time tSIB 300 ns maximum 150 ns maximum DRising to IBF Falling Delay Time tRIB 300 ns maximum 150 ns maximum DFaing to INTR Falling Delay Time tRIT 400 ns maximum 200 ns maximum W Rising to INTR Rising Delay Time tSIT 300 ns maximum 150 ns maximum W Rising to INTR Rising Delay Time tAIT 350 ns maximum 150 ns maximum W Failing to INTR Falling Delay Time tWIT 850 ns minimum 250 ns maximum As shown above the MSMSZCSSAZ satisfies the characteristics of the MSMSZCSSAS 2326 OKI Semiconductor MSM82C55A2RSGSNJS PACKAGE DIMENSIONS Unit mm DIP40P600254 5mg 03 WWWWWWWWWQQ N lt3 0 O E lNDEX MARK D i i g 27 i524 m g l l SEATWG HHDDHHHDHHHDDDHHHDHL PLANEilllllll UUUUU ll 7 0 m 5 5 025435 22 E e m o39 LEBTYP 7 04618155 Package material Epoxy resin Lead frame material 42 alloy Pin treatment Solder plating Solder platethickness 5 rim or more Package weight g 610 TYP Notes for Mounting the Surface Mount Type Package The SOP QFP TSOP SO QFI PLCC SHP and BGA are surface mount type packages which are very susceptible to heat in reflow mounting and humidity absorbed in storage Therefore before you perform reflow mounting contact Oki s responsible sales person for the product name package name pin number package code and desired mounting conditions reflow method temperature and times 2426 OKI Semiconductor MSM82C55A2RSGSNJS Unit mm QFJ44 P8650127 4352 02 255 TYP 7 iliVilililililililiii M i 6 UlSEQ 008 SW 531 O 3 E E E E E E E E lNDEX MARK E Mirroriinisn E O innnnnnnnnni e i Package material Epoxy resin Lead frame material Cu alloy Pin treatment Solder plating Solder plate thickness 5 rim or more Package weight g 200 TYP Notes for Mounting the Surface Mount Type Package The SOP QFP TSOP SO QF PLCC SHP and BGA are surface mount type packages which are very susceptible to heat in reflow mounting and humidity absorbed in storage Therefore before you perform reflow mounting contact Oki s responsible sales person for the product name package name pin number package code and desired mounting conditions reflow method temperature and times 2526 OKI Semiconductor MSM82C55A2RSGSNJS Unit mm VONWO LZSTYP 017 005 39 12TYP 125 015 Notes for Mounting the Surface Mount Type Package The SOP QFP TSOP SO QF PLCC SHP and BGA are surface mount type packages which are very susceptible to heat in reflow mounting and humidity absorbed in storage Therefore before you perform reflow mounting contact Oki s responsible sales person for the product name package name pin number package code and desired mounting conditions reflow method temperature and times 2626 Lecture 1 Lecture 1 Graphical User Interfaces History BASIC Beginner s Allpurpose Symbolic Instruction Code mid1960 s Kemeny and Kurtz Dartmouth Textbased languages and Structured Programming Graphical User Interfaces Xerox Apple and Microsoft mid1980 s Graphicalbased languages late 80s and early 90s Visual Basic 0 First introduced in 1991 by Microsoft 0 Integrated Development Environment IDE allows highlevel programming 0 Access to lowlevel Application Programming Interface API 0 Recyclable code with ActiveX technologies Distributed Computing controls documents and components due to COM Common Object Model Arguably similar to Java ObjectOriented Programming V nsock clientserver Advantages short learning curve rapid deployment frontend development large programming base databases ActiveXCOM integration with other Microsoft products VBA VBScript Windows CE for embeddedportables Disadvantages slow large executables runtime interpreted language no immediately available portmapped IO capability Alternatives Microsoft VC lowlevel API and highlevel MFC fast longer learning curve Java program oncerun anywhere paradigm promising CC programming base embedded applications clientserver JavaScript Xwindows Sunbased widgets TCLTK portable interpreted language rapid frontend development Delphi and Borland C Lecture 1 Visual Basic Fundamentals 0 Visual programming step use VB s visual tools for developing GUI and its components mlecll msnll alHa Id I J2 m Mew Emisct ngmat thug gun Qgevv o llzs val ulgs SEEM General k moi moans Window Help SQ innl u l Pmmn quotnun n Form I Level 2 I Level 1 forquot components component property box v5 component toolbox El frmOptmn Option m choconnois Nam Returns the name used n ode to identW an ablect Code programming step de ne events for each component eg Exit utton Integrated Development Environment VB tool box common components like buttons labels images textboxes Property box to de ne each component eg color variable name size C de programming with builtin text editor Executing and debug Lecture 1 Hello World Example Objective Use 3 command buttons and textbox Displays Hello Worldquot message clears and exits program see below rm Hello ngm 9 Hello Plnglam Hello World 39 Qisplay L Clquot 1 StartProgramsMicroso Visual StudioMicroso Visual Basic 60 2 Choose Standard Executable EXE 3 Save Project As Choose a directory and save les for Form heIIoWorIdfrm and Project heIIoWorIdprj 4 Add components de ne names and properties 5 Save Project and Save heIIoWorIdfrm 6 Co e programming step 7 Execute and debug Make Executable FileMake Executable EXE Discover 0 txtHeIIoWorId properties Al39g ment eg Ie justi ed center on eg font Arial bold size 14 point 0 Form properties 0 Background colors change blue to red Code Programming Private Sub cmdDispIayCick frmHelloWorldBackColor RGBD 255 D txtHeIIoWorIdText quotHello Worldquot End Sub o Hotkeys 0 Change caption for cdexit from Exit to Eampxit ALTX will exit program Lecture 1 Naming Conventions Typical Presentation of a VB Program o Objects Object Property Setting Form Name frmHeIIoWorId BackCoIor Blue Caption Hello World Program Command Button Name cdeXit Caption EampXit Command Button Name cdeIear Caption Clear Command Button Name cmdDisplay Caption Display Hello World Text Box Name txtHeIIoWorId Alignment 2 Center FontName System FontSize 10 Multiline True Iiecture 1 0 Code Option Explicit Private Sub cdeleariclick txtHelloWorldText quotquot 39 clear up display box End Sub Private Sub cmdDisplayiclick frmHelloWorldBackColor RGBO 255 O Turn form green txtHelloWorldText quotHello Worldquot End Sub Private Sub cdexiticlick End End Sub Lecture 1 Component Option Control optVariableName Code Programming lfthenelseif statements Objective Display Hello Worldquot message in different fonts with userde ned ption aim a mug wt 7 run up 3E Icnmpnnenls armada i m 6 Times Roman 390 Anal o Conner Tlmes Roman Option Control Properties 0 Conventional name pre x is opt eg optFontAriaI 0 Caption font size type and text color can be assigned 39om Properties box Only one option can be chosen lfThenElselfEnd If Statement Conditional branching can be achieved using ifthen and iftheneseif statements If optFontAr1a1Value True Then txtHelloWorldFont Arlal ElseIf optFontCourlerValue True Then txtHelloWorldFont e Courler Else txtHelloWorldFont e Tunes Roman End If Lecture 1 Stepper Motors Shaft rotates a fixed amount for every voltage step called resolution Shaft acceleration is ideally instantaneous Shaft velocity proportional to step frequency Typically used when shaft must rotate to a xed angleamount Examples hard drives robot arms pantilt units Phase 1 Ground or Voltage Phase 2 g or Voltage A Wilt Phase 3 Stepper Rated Voltage Supply GND i phase 4 Phase 1 Phase 2 Phase 3 Phase 4 Operation 0 Requires that voltage pulses be applied to each phase in sequence 0 Direction is reversed by reversing sequence 0 Requires knowing which lead corresponds to which phase Ohmmeter used to identify phases Implementation 0 Na39I39ve approach use a 4 digital lO lines and pulse in sequence 0 Typical use logic sequencer chip eg Allegro 5804 that takes a single square wave input line 0 UR pronounced LoverR uses pulsewidthmodulation PWM also called a chopper Higher voltage and hence higher current without burning motor coils Lecture 4 Lecture 4 DLLs and Custom Hardware Programming Dynamically Link Libraries DLL Generating EXE file involves 1 Compile source which generates objectlibraries files OBJ LIB and 2 Linking object files which generates EXE Dynamic compiled files linked during runtime DLL Many Windows compilers can generate DLLs VC has ihp and outp functions backward compatible General Procedure 1 Create DLL backend code in VC for accessing custom hardware eg 8255 2 Create VB frontend GUI 3 Stitch VB frontend with VC backend Creating the DLL 1 Create a folder for your files eg Cport 2 Compose the definition def and C source cpp files You can use Notepad 8255DEF file listing LIBRARY 8255 DESCRIPTION DLL FOR 8255 CARD EXPORTS Out8255 l In8255 2 Lecture 4 8255CPP file listing FILE 8255cpp include ltstdiohgt include ltconiohgt contains Visual C s inp and out functions FUNC Out8255 DESC uses Microsoft s Visual C outp function to output a PortData to PortAddress short stdcall Out8255 int PortAddress int PortData short Dummy Need Dummy since outp officially returns int short is a 16 bit integer in Win32 C whereas int is 32 bit integer Win32 C use short to force returning 16 bit integer DUmmY Shortoutp PortAddress PortData returnDummy end of Out8255 FUNC In8255 uses Microsoft s Visual C inp function to read PortAddress U F U 0 short stdcall In8255 int PortAddress short PortData short is a 16 bit integer in Win32 C whereas int is 32 bit integer in Win32 C use short to force returning 16 bit integer back to VB PortData shortinp PortAddress return PortData end of In8255 3 Start VC a Select FILENEW b Select Projects and choose Win32 DynamicLink Library Make sure the Location is Cport the directory you created in Step 1 Type 8255 in the Project Name field and click OK See Figure CPP02 Lecture 4 mm Files Pmiack wamspam Ullveancum nls Fmiect name 3255 Lusahu rt IPum3255 r Dzealanew wavk ace Add 390 cHHenl walkspace lquot ependency nl E lalfarm Win32 Heady Figure CPPUZ 4 Add your CPP le Hanna Click on the classes tab Select the 8255 class by le clicking it once this turns it blue Next right click and choose Add Files to Project See Figure 4 An Insert Files to Project dialog box will pop up Make sure the Files of Type is set to C les Chose the 8255cpp le and hit OK See Figure CPP05 lrir ll El Edit Al warm iul u mdnw Help 7 V limiter Mimi WM L 39 lt Hirluh l l kasvace 8255 l pvaiecllslfl Eula minimum mm El an selech W may unluau Pmlu m iamm J7 Dackmgiew Hldu QFigpsltlss 4 mm D lnxalll umtlnu mam mm lhs Walsh Figure CPP04 M lle gal Mew 1m Emiec gm laals39Mndaw gap 4 w Rename a gqs new i Hal25Wcxxllihllhvcl 39 francel les Will he imevled mm laldsv tilled Bzasmes m Dialect 8255 11 A rm m n eady Figur e CPPOS Lecture 4 5 A88 yuur DEFfHE smeartu Step 4 n 288 8255 masses unce turns mus mgm 288 and smartAdd FHES m iject Set me FHES 8r Type 8 Dermmm DEF cm an 8255 def and mow Save Everymmg by 8an F LEV SAVE ALL 6 8mm yuur DLLme nuw amt m c pum82558enug H 8 as i j le iha sl le aw mew8 888888 kasvace BZEE vvmecll SAaleehug gt Dehuggev R emme Ea hecnan Ere2mg mwa emcrwe gn39ngmanan M 3988s M M Figure cwnx 7 Cupy yuur 8255 DLLfHE m c Wmduws dummy congmulanons you finished your DLL backend code Lecture 4 Lab Exercise 1 Count from o to 255 In bmary ugm up 8 LEDS 3255 mum Poll A Poll a Full E ngmal le me BaseAddvess VB Cnde Prngrzmming Optlon Expllcn Inec1ere use of the DLL prwete necIere nmctlon tezss Lab IIezssanI EyVal portAddress As Integer By e1 portnete As Integer As Integer prwete necIere nmctlon Inesz Lab IIezssanI EyVal portAddress As Inte r As Integer 96 Inec1ere errebIes mm seseAddress As Integer I e255 Ease Address mm Dummy As Integer I Dummy varlable used mtn DLL mm portA As 5 s mm For m O1 e255 ControI Address mm Number As Integer number to count from I to 255 mm ster As Integer mm Response As Integer mm portseIected As Integer prwete sub FormiLoadO I program As Ioeded mtn these values mtDutpuchn w ext IIznter Ease AddressII o Countlng actlon not started 0 I Number to start w True I start tn Default port 5 A Number I optportAVe1ue e sub End Lecture 4 Private Sub cdeoClick If Start 0 Then r clicked GO button first time If txt8255AddressTeXt quotquot T n Base address was not defined Msg quotEnter a Base Address eg 608quot Define message Style vbOK vixclamation Define buttons Response MsgBoxMsg Style Exit Sub End If Start l Go button enabled start counting cdeoCaption quotPausequot Assign values for all addresses BaseAddress ValtXt8255AddressText PortA BaseAddress PortB BaseAddress l PortC BaseAddress 2 Cntrl BaseAddress 3 determine which port to output to default is A If optPortAValue True Then PortSelected PortA Print PortSelected End If If optPortBValue True Then PortSelected tB Print PortSelected End If If optPortCValue True Then PortSelected PortC Print PortSelected End If configure all ports for output Dummy Out8255Cntrl 128 initialize all Ports to O Dummy Out8255PortA O Dummy Out8255PortB O Dummy Out8255PortC O Els Start 0 user clicked GO button again cdeoCaption quotGoquot End If End Sub Private Sub cdendClick Beep txtOutputWindowTeXt quotStoppedquot Dummy Out8255PortA Dummy Out8255PortB mmy Out8255PortC quit program d 000 En End Sub Lecture 4 anzt sub mbnmsusmsm If Start 1 m Number Number 1 Dummy mt zsstmrtselected uumben txtoutputlmndw Text Number u strmumber If number s 255 Then seep txtoutputlmndw Text e unmsbeau Dummy mt zsstmrtselected u Start u Number u Ich Cayman e cw EX sub ma Else EX sub ma sub va prnummmnu up a Expllc Declaxe use a me my anace Declaxe mnsmn DuLEZSS ms quotazssd11quot unzst Pachddxess As IncEgex Eyv 1 Paxmaca As Inr qex As IncEge p 1 ate De 1 mnsmn Inazss ms quotazssd11quot unzst Paxmddxess g2 As Inr qex As Inns 9 slate vanab azss Ea e Addxess m ad 255 Earnan Addxess declma Value sad s pan Paxcvalue As IncEgex Lecture 4 Dim PortValue As Integer 39 decimal value read at port Dim Start As Integer 39 Start flag Dim Msg As String Dim Style As Integer Dim Response As Integer Dim PortSelected As Integer Private Sub cdend7ClickU Beep 39txtOutputWindowText quotStoppedquot 39 quit program End End Sub Private Sub cdeoiclickU If Start O 39 user clicked GO button first time If txt8255AddressText quotquot Then 39 Base address was not defined Msg quotEnter a Base Addressl eg 608quot 39 Define message Style vbOK vixclamation 39 Define buttons Response MsgBoxMsg Style Exit Sub End If Start l 39 Go button enabled start counting cdeoCaption quotPausequot 39 Assign values for all addresses BaseAddress Valtxt8255AddressText PortA BaseAddress PortB BaseAddress PortC BaseAddress r BaseAddress 39 determine which port to output to 39 default is Port A If optPortAValue True Then PortSelected PortA End If If optPortBValue True Then PortSelected PortB End If If optPortCValue True Then PortSelected PortC End If 0 5 H LA 39 configure all ports for input Dummy Out8255Cntrl 155 39 initialize all Ports to O Else Start O 39 user clicked GO button again cdeoCaption quotGolquot End If End Sub Lecture 4 Private Sub FormiLoad 39 Program is loaded with these values txtOutputWindowText quotEnter Base Addressquot Start 0 39Counting action not started optPortAValue True 39 Default port is A End Sub Private Sub tmrTimeriTimer Then PortValue ln8255PortSelected txtOutputWindowText quotValue quot StrPortValue End If End Sub Lab Exercise Associate each LED with a DIP position eg DIP switch position 0 would correspond to LED 0 Design VB GUI that reads the DIP switch positions and lights up the corresponding LEDs The GUI would display the corresponding decimal number Lecture 4 DADADC w samphng urne nut ermeaL ADC ean be mterfaced m 8255 emp A W dE range uftransducers ean be anked up m an ADC A Wd range uf penphera s ean be anked up m a DAC Typical DAC e DAcmaz R eqwesa cunemrmrvuhageamphheveg LF353 Canbeeenngmeemmmpmaymmpmamumm Typical ADC chip Ancnm a charme ErbMADC DMeverma uvsmg erended mpms M emmme MUX uadmgummg em TypmaHhevmws ev LMaA R equwes usmg bmwectmna pun ameesuVEZSS E Made 2 Lecture 3 VB Part 3 Hbars thVaHameName and VSbVaHab eName g Lecture 3 Component Scro Code Programmin Objective MHes per hour HorrZonta 500 bar 0 Name habSpeed 0 Max 100 Mm 0 o SmaHChange o Va ue Code Prlvace Sub hehSpeeeicheneen gamma z smhshsmmuer e r mphquot End Sub Magnum Serrhshsmmuer r mphquot pmeee Sub hshs excepeeeTexe and Sub o amp and are rmerchangeabre Ht Chck and drag mouse over scror c ange SmaHChange proper d Verucar 500 bar and experrmem wrm drrrerem varues Expenme Use r Lecture 3 Component Tuners tmrMWmer Code Programming omecuve Twmer dwamaya mcrements m seconds the ue Plnglam HE message to go here U1 Labe 0 Name 1b1D1Sp1ay 0 Font MS Sans Sent how we 12 o Capuon messageto go here Tm 0 Name mmmer o Enab ed Fame 0 nterva 1000m hsecond5 Code puveee Sub cdenahleDlsahleicllckl 1 gKeepTrack 1 Then K k pTrack 1 cdenahleDlsahleCapt10n VsnlsahlEquot End If En ub puveee Sub emnmezgmeu 1 Then 1 f have sound card then mu beep counter 1 layCapt10n Strlcuunter quot counter 1b1msp 521quot End If End Sub Lecture 3 Component Menus mnuMyMenultem Code Programming a Pmlecn r lnnEnlnls Form BEE u u i Calm Plnglnnl BE Colors nglam EEI Eulals 0K 9 mgr We hmtmt Name 7 mmmw m mwmw mva r em I7 Enabled 17 we I39Mndnwust GUI Project and Form name ToolsMenu Editor Caption Colors Name mnuColors Code alse 39 disable White item in menu alse 39 initially window small so disable nuwhiteEnabled mnuSmallEnabled End Sub Private Sub Form LoadO m F F Private Sub mnuBlueiclick frmColors BackColor QBColorl 39 set form color to blue als 39 disa e Blue item in menu mnuRed Enabled True 39 enable other color items in menu mnuwhiteEnabled True End Sub Private Sub mnuLargeiclick frmColors WindowState 2 39 set form size to large mnuLarge Enabled False 39 disable large from menu mnuSmall Enabled True 39 enable small from menu End Sub Lecture 3 QBCoIor Function Discover 0 V ndowState try with 1 0 Experiment with different colors 0 Experiment with RGBamountOfRed amountOfGreen amountOfBIue Lecture 3 Numeric Keypads o Simpler user input device than keyboard 0 Widely available and many applications T7 la E lT T x1 x is Keys are switches contacts in matrix form 0 74922 is typical keypad decoder chip Multiplex 4bits for 16 possibilities June1999 National Semiconductor ADC0844IADC0848 8Bit pP Compatible AID Converters with Multiplexer Options General Description Features The AD00844 and AD00848 are CMOS 8bit successive ap l proximation AD converters wi h versatile analog input multi l plexers The 4channel or 8channel multiplexers can be software configured for singleended differential or pseudodifferential modes of operation Easy interface to all microprocessors Operates ratiometrically or with 5 VDC voltage reference No zero or fullscale adjust required 4channel or 8channel multiplexer with address logic Internal clock 0V to 5V input range with single 5V power supply 03quot standard width 20pin or 24pin DIP 28 Pin Molded Chip Carrier Package The differential mode provides low frequency input common mode rejec ion and allows offsetting the analog range of the converter In addition the AIDS reference can be adjusted enabling the conversion of reduced analog ranges with 8bit resolution The AIDS are designed to operate from the control bus of a wide variety of microprocessors TRlSTATE output latches Key Specifications that directly drive the data bus permit the AIDS to be config I ReSOIUtiO 8 Bits ured as memory locations or O devices to the microproces 39 Total Unadjusted Error 112 LSB and i 1 L33 sor wi h no interface logic necessary I Single Supply 5 VDC l Low Power 15 mW l Conversion Time 40 ps Block and Connection Diagrams AGND10 vcc24 DGND12 VREF11 Q23 m1 o Wm CONTROL LOGIC WW a lllllTll TRlSTATE OUTPUT LATCHES BBQ 20 DB713 69f gtMllzamu CH12CH89lt r ADDRESS LATCH ADCO848 shown in DIP Package CH5CH8 not included on the ADCO844 DSOO50161 TRlSTATE is a registered trademark of National Semiconductor Corp 1999 National Semiconductor Corporation DSOO5016 www nationalcom suondo Jexeldnlnw LmM SJeueAuoo av elqnedwoo drl 1E398 eveooawweooov Block and Connection Molded Chip Carrier Package Diagrams Continued DuallnLine Package DuallnLine Package gin I V 20 VCC U 2322222 RD1 24Vcc I I I I I I I C39s2 g39l CH12 zs E 25 24 23 22 21 20 19 CH13 18 INTR CH23 22W INB 25 13 DBB CH2 4 17 DBOMAO CH3 4 21W VB 27 17 DB7 CH3 5 ADCOB44 16 DB1MA1 CH4 5 20 DBOMAO cs 23 16 DGND CH4 5 15 DBZMA2 CH5 6 ADCO848 19 DB1MA1 NC1 ADCO848 15 NC AGND 7 14 DB3MA3 CH67 18DBZMA2 VE 2 14 VREF VREF 8 13 DB4 CH7 8 17 DBSMA3 RD 3 13 AGND MSB DB7 9 12 DBS CH8 9 16 DB4MA4 CH1 4 12 CHB DGND 1O 11 DB6 AGND1O 15DBS 5 6 7 8 9 1O 11 I I I I I I I 080050162 VREF II 14 DB6 2 Top View DSOO501629 DSOO50163O TOP V39ew Top View See Ordering Information Ordering Information Temperature Total Unadjusted Error MUX Package Range i12 LSB i1 LSB Channels Outline ADC0844CCN 4 N20A 0 C to 70 C Molded Dip ADC0848BCN 8 N24C ADC0848CCN Molded Dip ADC0844BCJ 4 J20A o o ADC0844CCJ Cerdip 40 C to 85 C ADC0848BCV 8 V28A ADC0848CCV Molded Chip Carrier www nationalcom 2 Absolute Maximum Ratings Notes 1 2 If MilitaryAerospace speci ed devices are require please contact the National Semiconductor Sales Ofric Distributors for availability and specifications d el Supply Voltage Vcc 65V Voltage 03V to 15V 03v to vcc03v 5 mA Logic Control Inputs At Other Inputs and Outputs Input Current at Any Pin Note 3 Package Input Current Note 3 20 mA Storage Temperature 65 C to 150 C Package Dissipation at TA25 C 875 mW ESD Susceptibility Note 4 800V Electrical Characteristics Lead Temperature Soldering 10 seconds DualInLine Package Plastic 260 C DualInLine Package Ceramic 300 C Molded Chip Carrier Package Vapor Phase 60 seconds 215 C Infrared 15 seconds 220 C Operating Conditions Notes 1 2 Supply Voltage Vcc 45 VDC to 60 VDC p Ran e m erature TMWSTASTMAX ADC0844CCN ADC0848BCN 0 CSTAS70 C ADC0848CCN ADC0844BCJ ADC0844CCJ 40 CSTA585 C ADC0848BCV ADC0848CCV The following speci cations apply for VCC 5 VDC unless otherwise speci edBoldface limits apply from TMIN to TMAX all L 25 C other limits TA gggg ggj ADCOBABBCN ADCOBABCCN ADCOBABBCV ADCOBABCCV Parame er 5 quotdi i quot5 Typ Tested Design Typ Tested Design Unit Note 5 Limit Limit Note 5 Limit Limit Note 6 Note 7 Note 6 Note 7 CONVERTER AND MULTIPI Maximum Total VRE5 00 VDC Unadiusted Error Note 8 ADC0644BCM ADC0646E3CM BCV 112 212 LSB ADC0644CCM ADC0646CCM CCV 11 1 L88 ADCO844CCJ 1 L88 Minimum RefereriCe 2 4 1 2 4 1 2 1 1 m input Resistance Maximum RefereriCe 24 59 24 54 59 m input Resistance Maximum CommonrMode Note 9 vcc005 Vcc0 05 vcc005 v input Voltage Minimum CommonrMode Note 9 END005 CMD10 05 END 005 v input Voltage DC CommonrMod E Dirrerentiai Mode 1116 21 1116 1 21 L88 PoWer Supply Sensitivity vcc5v15 1116 213 1116 11e 213 LSB 011 cnannei Leaxage Note 10 Current 0n Channel v 1 10 1 1 M 011 cnannei0v 0n cnannei0v 1 01 1 M 011 cnannei5v DIGITAL AND no WW Logicai 1 input vcc5 25v 2 0 2 0 2 0 v Voltage Min MW Logicai 0 input vocal 75v 0 a 0 8 0 a v Voltage Max 1W Logicai 1 input VN5 0v 0 005 1 0 005 1 M Current Max 1W Logicai 0 input VN0V 10 005 1 10 005 1 M Current Max MOW Logicai 1 vocal 75v Output Voltage Min IOUT7360 M 24 2 8 24 v iOUTs10 M 45 4 6 45 v WWW national corn Electrical Characteristics Continued The following speci cations apply for VCC 5 VDC unless otherwise speci edBoldface llmits apply from TMIN to TMAX aI other limits TA T1 25 C 2353333353 Aneoai li f tmeen I I ADCOBABBCV ADCOBABCCV Limit Parameter 5 quotd39t390r395 Typ Tested Design Typ Tested Design Units Note 5 Limit Limit Note 5 Limit Limit Note 6 Note 7 Note 6 Note 7 DIGITAL AND VOW Loglca yoga 75y 04 o 34 04 y Output Voltage Max iOUT16 mA low TRiaSTATE Output vowoy a0 01 3 a0 01 a0 3 3 uA Current Max vowsy o 01 3 o 01 o 3 3 uA iSOURCE Output Source veggoy 44 65 44 a7 5 65 mA Current Mll l ism Output Sirlk veggycc 16 30 16 9 o 30 mA Current Min loo Supply Current Max E 1 veg 1 25 1 2 3 25 mA Open AC Electrical Characteristics The following speci cations apply for VCC 5VDC t q 10 ns unless otherwise speci ed Buldface limits apply frum TMIN to TMAX all other limits TA T1 25 C Tested Design Parameter Li i Limit Units Note 5 Note 6 Note 7 to Maximum Conversion Time See Graph 30 40 60 ps tvw Minimum m Pulse V dth Note 11 50 150 ns tAcc Maximum Access Time Delay 39om Falling Edge of CL 100 pF 145 225 ns E to Output Data Valid Note 11 tw tDH TRISTATE Control Maximum Delay 39om Rising CL 10 pF RL 10k 125 200 ns Edge of to HiZ State Note 11 tWi tRh Maximum Delay 39om Falling Edge ofm or to Note 11 200 400 ns Reset ofm tDs Minimum Data SetUp Time Note 11 50 100 ns tDH Minimum Data Hold Time Note 11 0 50 ns CW Capacitance of Logic Inputs 5 pF COW Capacitance of Logic Outputs 5 pF Note 1 the deyiee beyDrld its speeiried uperating eunditiuns Note 2 All yultages are measured Witn respect D the gruund pins Note 3 When the input yultage yip at any pin exceeds the puwer supply rails yiN lt y ur yiN gt y the absDiute yalue ur the eurrent atthat pin shuuld be limited tus mA urless a l iiuiiiuei ui the pu ei uppi u uiiuaii iiiia l ruur Human budy mudel 1DEI pF disenarged tnruugn a 1 5 m resistur Typieals are at 2539C and represent must ilkeiy parametrlt nurm Note 4 Note 5 Note 6 Tested limits are guaranteed tD NatlDrlai s AODL Ayerage Outguing Duality Leyel Note 7 Design limits are guaranteed by nut munu tested These limits are nut used tD ealeulate uutguing duality leyels Note a Tutal unadjusted errur ineludes urrset fullascale llrlearlty and multlplexer errur r Note 9 Fur W l r d analug input iiiaii v00 supply le el 14 l D cunduct p and eause errurs rur analug inputs near fullascale The spee allqu an my rurward blas ur eitner diude d d the uppi g tne uutput eude Will be eurreet TD aenieye an a l g asu yDc uyertemperature u u Note 10 Off chaririel leakage current is measured after the channel selectiuri Note 11 The temperature uerrieierit is El 3l39c WWW l latlol lai com 4 Typical Performance Characteristics Logic Input ThreShOId Output Current vs Voltage vs Supply Voltage Temperature 1398 o E 55 chAgH c Vcc5Vuc E 1 7 6 39 a 2quot lsmx Vac 5V gt v 3 1 5 E 15 g E ISOUHCE Voc 0V Lu 3 z 15 3 1o 391 a Isounce Voc 2 2 395 5 14 5 D g Ismx Voc 04V 13 0 450 475 500 525 550 75 50 25 O 25 5O 75 100 125 Vcc sumv VOLTAGE vac TEMPERATURE C DSOO501631 DSOO501632 Linearity Error vs VREF 10 Vcc 5V TA 25 C 9 on ZERO AND FULLSCALE ADJUSTED LINEARITY ERROR LSBs CONVERSION TIME us O 1 2 3 4 5 Vner V DSOO501634 Conversion Time vs Temperature VREF Voltage 50 I l Vcc 5V 4O 3O 20 OFFSET ERROR LSBs 1O CONVERSION TIME us 0 75 50 25 0 25 5O 75 100 125 TEMPERATURE C DSOO501636 50 4O 3O 20 10 45 14 12 c 001 Power Supply Current vs Temperature Vcc 5V SUPPLY CURRENT mA 0 7550 25 O 25 50 TEMPERATURE C Conversion Time vs VSUPPLY TA 25 C 475 5 525 SUPPLY VOLTAGE V DSOO501635 55 Unadjusted Offset Error vs VINVIN 0 V05 2 mV TA25 C 10 5 VREF V 01 DSOO501637 75 100 125 DSOO501633 wwwnationacom TRlSTATE Test Circuits and Waveforms DATA OUTPUT DSOO50164 tr 20 ns DATA OUTPUT DSOO50166 tr 20 5 Leakage Current Test Circuit 5V IOFF DATA OUTPUTS DATA OUTPUTS t1H CL 10 pF 9 t 90 50 10 t1H 90 GN D DSOO50165 VCC GND VCC V0L DSOO50167 L K J CHANNEL VOLTAGE SELECT CH1 OFF ADCOB48 CH2 ONOFF CH3 UNOFF CH4 ONOFF CH5 0N0FF CH6 0N0FF CH7 0N0FF CH8 0N0FF NOT INCLUDED ON ADCOB44 DSOO50168 www nationalcom Timing Diagrams Programming New Channel Configuration and Starting a Conversion 3 m 8 7f gtI tw39 if 39gt tRI EITR NOTE 1 tIH ton 030437 TRISTATE if MAWM MAO MA4 030 037 tACC gt DSOO50169 Note 12 Read strobe must occur at least 600 ns after the assertion of interrupt to guarantee reset of INTR Note 13 MA stands for MUX address Using the Previously Selected Channel Configuration and Starting a Conversion tm gt tc l W 1 tAcc tIH tOH 030037lt 030037 E 030037 i 1 RESULT OF READING THE RESULT THE PREVIOUS OF THE LAST CONVERSION CONVERSION DSOO501610 7 wwwnationacom AD00848 Functional Block Diagram LL39QLOQOOSCI I p JL su 009 l L lOHS 3N0 H3lSB3H 13HS ll 310VN3 ind100 l HOLV39I HVS Sl dl O 39lVllEJIG lVW H S3H31V391 mama m3lVlS39lHl H33 133133 N919 3V0 8300330 0NV H300V39I 30A H01V1 SS3HOGV XDW 8300330 XHIN 0N9V 8H3 LHU 9H3 9H0 VH3 9H3 8H3 LHU www nationalcom Functional Description The ADC0844 and ADC0848 contain a 4channel and 8channel analog input multiplexer MUX respectively Each MUX can be con gured into one ofthree modes of operation differential pseudodifferential and single ended These modes are discuss in the Applications Information Sec tion The speci c mode is selected by loading the MUX ad dress latch with the proper addre 2 Inputs to the MUX address latch MAOMA4 are common wi h data bus lines DBODB4 and are enabled when them line is high A conversion is initiated via the andm Iirles lfthe data 39om a previous conversiciis not read the M line will be low The falling edge of WR will reset the INTR Iirle high and ready theAD for a conversion cycle The rising edge of m with W high strobes he data on the MAO DBOMA4DB4 inputs into the MUX address latch to select a MUX con gura ion is retained and the data of the previous conversion is the output on lines DBO DB7A er the conver sion cycle tC S 40 us which is set by he internal clock fre quency the digital data is transferred to the output latch and the INTR is asserted low Taking S and W low resets INTR output high and outputs the conversion result on the data lines DBODB7 Applications Information 10 MULTIPLEXER CONFIGURATION The design ofthese converters utilizes a sampleddata com parator structure which allows a differential analog input to be converted by a successive approximation routine The actual voltage converted is always he difference be input terminal anda quotinput terminal verted Indicates which line the converter expects to be the most positive lfthe assigned quot Input is lesst an the quot in put he converter responds with an all zeros output code ended or pseudodifferential Figure 1 shows the three L A L Inllll npngAA1L w of the ADC0848 can also be con gured in any of the three modes In the differential mode heADC0844 channel inputs are grouped in pairs CH1 with CH2 and CH3 with CH4 The polarity assignment of each channel in the pair is inter changeable The singleended mode has CH1 CH4 as signed as the posi ive input with the negative input being the analog ground AGND f the device Finally in the pseudodifferential mode CH1 CH3 are positive inputs ref erenced to CH4 which is now a pseudoground This A commonmode range of he converter The analog signal conditioning required in transducerbased data acquisition systems is signi cantly simpli ed with this type of input ex ibility One converter package can now handle ground refer enced inputs and true differential inputs as well as signals with some arbitrary reference voltage The analog input voltages for each channel can range from 50 mV below ground to 50 mV above VCC typically 5V with out degrading conversion accuracy TABLE 1 ADC0844 MUX ADDRESSING MUX Address E m 6 Channel MUX MA3 MA2 MA1 MAo CH1 CH2 CH3 CH4 IAGND Mode x L L L L H x L L H L 1 H Differential x L H L L H x L H H L H L H L L L H L H L H L 1 H SingleEnded L H H L L H L H H H L H H H L L L H Pseudo H H L H L 1 H Differential H H H L L H x x x x L 1 L Previous Channel Con guration Xdun tlare www national com Applications Information Continued 4 SingleEnded F r CH1 CH2 CH3 CH4 r AGND 7 F J DSOO501612 ADC0844 3 PseudoDifferential i CH1 J CH2 CH3 ADCOB44 CH4 j DSOO501614 2 Differential T R CH1 CH2 ADCOB44 CH3 CH4 H J DSOO501613 Combined r CH1 CH2 CH3 FAGND 39 h ADC0844 l l DSOO501615 FIGURE 1 Analog Input Multiplexer Options 20 REFERENCE CONSIDERATIONS The voltage applied to the reference input of these convert ers defines the voltage span of the analog input the differ ence between VNMAX and VNMN over which the 256 possible output codes apply The devices can be used in ei ther ratiometric applications or in systems requiring absolute accuracy The reference pin must be connected to a voltage source capable of driving the minimum reference input resis tance of 11 kg This pin is the top of a resistor divider string used for the successive approximation conversion In a ratiometric system Figure 23 the analog input voltage is proportional to the voltage used for the AD reference This voltage is typically the system power supply so the VREF pin can be tied to VCC This technique relaxes the stability re quirements of the system reference as the analog input and AD reference move together maintaining the same output code for a given input condition For absolute accuracy Figure 2b where the analog input varies between very specific voltage limits the reference pin can be biased with a time and temperature stable voltage source The LM385 and LM336 reference diodes are good low current devices to use with these converters The maximum value of the reference is limited to the VCC supply voltage The minimum value however can be quite small see Typical Performance Characteristics to allow di rect conversions of transducer outputs providing less than a 5V output span Par icular care must be taken with regard to noise pickup circuit layout and system error voltage sources when operating with a reduced span due to the increased sensitivity of the converter 1 LSB equals VREF256 30 THE ANALOG INPUTS 31 Analog Differential Voltage Inputs and CommonMode Rejection The differential input of these converters actually reduces the effects of commonmode input noise a signal common to both selected and inputs for a conversion 60 Hz is most typical The time interval between sampling the in put and then the inputs is 12 of a clock period The change in the commonmode voltage during this short time interval can cause conversion errors For a sinusoidal commonmode signal this error is to VERRORMAX Vpeak 277 fCM gtlt 05 X E DSOO5016 38 where fCIVI is the frequency of the commonmode signal Vpeak is its peak voltage value and t0 is he conversion time For a 60 Hz commonmode signal to generate a 14 LSB error z5 mV with the converter running at 40 uS its peak value would have to be 543V This large a commonmode signal is much greater than that generally found in a well designed data acquisition system www nationalcom 1O Applications Information Continued TABLE 2 ADC0848 MUX Addressing MUX Address m 6 Channel g 5 CH1 CH2 CH3 CH4 CH5 CH6 CH7 CH8 AGND Mode Differential SingleEnded Pseudo Differential gtltIIIIIIII I I I I I l l XXXXXXXXE XIIIIIIIIIIIIIIIl l l l l l l l E gtltllli i i i lllli i i i lllli i i i N gtltli i IIi i IIi i IIi i IIi i IIi i gtltilili lilililili li li li li i i i i i i i i i i i i i i i i i i i i i i i i d l IIIIIIIIIIIIIIIIIIIIIII Prev ous Channel Con guration 32 Input Current Due to the sampling nature ofthe analog inputs short dura tion spikes of current enter the quot input and exit the quot input should not be used if the source resistance is greater than 1 k9 33 Input Source Resistance The limitation of the input source resistance due to the DC leakage currents of the input multiplexer is important A worstcase leakage current o 1 1 pA over temperature will create a 1 mV input error with a 1 k9 source resistance Arl op amp RC active low pass lter can provide both imped ance buffering and noise ltering should a high impedance signal source be require 40 OPTIONAL ADJUSTMENTS 41 Zero Error The zero ofthe AID does not require adjustment lfthe mini mum analog input voltage value VWMW is not ground a zero offset can be done The converter can be made to out put 0000 0000 digital code for this minimum input voltage by biasing any VjN input at this IWMW value This is use ll for either differential or pseudodifferential modes of input channel con guration he zero error ofthe AID converter relates to the location of the rst riser of he transfer lnction and can be measured by grounding the V input and applying a small magnitude posi tive voltage to the V input Zero error is the difference be tween actual DC input voltage which is necessary to just cause an output digital code transition 39om 0000 0000 to 0000 0001 and the ideal V2 LSB value V2 LSB98 mV for VREF5000 VDC 42 FullScale The fullscale adjustment can be made by applying a differ ential input voltage which is 1 V2 LSB down 39om the desired analog JIIscale voltage range and then adjusting the mag nitude of the VREF input for a digital output code changing from 1111 1110 to 1111 1111 43 Adjusting for an Arbitrary Analog Input Voltage Range lfthe analog zero voltage of the AID is shifted away from ground for example to accommodate an analog input signal which does not go to ground this new zero reference should be properly adjusted rst A vN voltage which equals this desired zero reference plus V2 LSB where the WWW national com 5V VCC CH1 CH2 CH3 CH4 CH5 CH6 CH7 CH8 J A A AAA AGND a Ratiometric put which is given by VREF ADCUB48 DSOO501 616 Applications Information Continued LSB is calculated for the desired analog span 1 LSB ana log span256 is applied to selected input and he zero I 77 reference voltage at the corresponding input should then be adjusted to just obtain the OOHEX to O1HEX code transition 27K X1 0Vgt 125V X2 0Vgt 125V 125V X3 OVa 125V X4 0Vgt 125V X5 0Vgt 125V LM 385 X6 0V gt 125V X7 0Vgt 125V 125V DSOO501617 b Absolute with a Reduced Span FIGURE 2 Referencing Examples VMAx VMIN VIN fS adjVMAx 15 are ground referenced 256 l The fullscale adjustment should be made with the proper VIN voltage applied by forcing a voltage to he VIN in where VMAXthe high end of the analog input range and VMINthe low end the offset zero of the analog range Both The VREF or VCC voltage is then adjusted to provide a code change from FEHEX to FFHEX This completes the adjust ment procedure For an example see the ZeroShift and Span Adjust circuit below ZeroShift and Span Adjust ZVSVINS5V Vcc 5 VDc VNl Vcc VIN 10uF T 10quot 55139s 12k 1quot VOLTAGE Anc0344 SPA lquot39 quot quotI f VINH VREF I I 39 if I SETS ZERO mass25 I cone VOLTAGE 2V v 330 I L J 1k t quotTquot J39 39 27k 2Vnc 7 7 ZERO ADJ DSOO501618 www nationalcom 12 Applications Information Continued Differential Voltage Input 9Bit AID VREF n VREF quotH Ancos44 n 39 7 DSOO501 61 9 Span Adjust OVSVINS3V Vcc 5 VDC VINH VCC vm ADCOB48 IOMF 2k 1k F VIN H VREF LM33625 T m SET FOR 3v DSOO5016 20 Protecting the Input Vcc 5 VDC HN Vcc quotji 1 1 ADCOB44 1 NH DSOO501621 Diodes are 1N914 13 wwwnationacom Applications Information Continued High Accuracy Comparators 5v VCC 1gt CH1 VTH1 0 CH2 2 gt CH3 SYSTEM TEST lt VTH2 0 CH4 PO39NTS 3 gt CH5 ADCOB48 VTH3 0 CH6 4 CH7 VTH4 0 CH8 L AGND VREF D D800501622 CD 2 U I 9 DOaI 18 if VNgtVN DOaI Os if VNltVN Operating with Automotive Ratiometric Transducers Vcc 5 VDc 20k Vxnn XDH VN VCC 1011F 1k zeno VINH ADJ b 3k Anc0844 10k 12 LM358A VREF gt E 1uF I 24k D800501623 VN O15 V00 15 Of VCCSVXDRS85 Of VCC www nationalcom 14 Applications Information Continued A Stand Alone Circuit 5v 5V 2024 311 Q1 20 NSL5027 8 PL Vcc VREF OUT vcc 12k 23 913 3 DIS 2 8 PL N CH1 DB7 D1 01 34 CH2 mm 4 5 M 45 035 02 02 w gt CH3 1215 7 5 55 035 D3 03 CH4 M 5 ms 1316 a 9 MA4DB4 D4 4 WgtH l CH5 DUT MM74c374 M 14 13 12 8 MABDB3 4 D5 05 gt CH7 N 9 15 18 14 15 gt CH8 MAZDBZ e 06 05 gt o 107 M AGND 16m 17 16 MA1DB1 a D7 07 Nf 12 10 17 20 18 19 N DGND MAODBU 03 as c n no mm W 16 A 2 19 1 18 MM74C14 MM74c14 11 23 22 1 21 K 11 9 7 5 3 200 pF 05 04 03 02 01 15 r0 DISZ lN5 N4 1quot A 4o o MM80cgs 5 MM MM74C14 IN3 90 4 L MA1 DISi N2 oH 2 MAO N1 Note DUT pin numbers in parentheses are for ADCO844 others are for ADCO848 Start a Conversion without Updating the Channel Configuration 212 c s W 3 W W W ADCDB48 E W will update the channel configuration and start a conversion E W will read the conversion data and start a new conversion without updating the channel configuration D800501626 Waiting for the end of this conversion is not necessary A E W can immediately follow the W D800501625 wwwnationacom Applications Information Continued ADC0844 N88039 Interface 5v 20 Vcc 8 DBOMAO VREF DB1MA1 CHI CH2 DBZMAZ DB3MA3 ADCOB44 IN38039 CH3 5 CH4 DGND 10 AGND 7 D800501627 SAMPLE PROGRAM FOR ADC0844 INS8039 INTERFACE CONVERTING TWO RATIOMETRIC DIFFERENTIAL SIGNALS ORG OH 0000 04 10 JMP BEGIN START PROGRAM AT ADDR 10 ORG 10H MAIN PROGRAM 0010 BQ FF BEGIN MOV R10FFH LOAD R1 WITH A UNUSED ADDR LOCATION 0012 B8 20 MOV R020H AD DATA ADDRESS 0014 89 FF ORL P10FFH SET PORT 1 OUTPUTS HIGH 0016 23 00 MOV A00H LOAD THE ACC WITH AD MUX DATA CH1 AND CH2 DIFFERENTIAL 0018 14 50 CALL CONV CALL THE CONVERSION SUBROUTINE 001A 23 02 MOV A02H LOAD THE ACC WITH AD MUX DATA CH3 AND CH4 DIFFERENTIAL 001C 18 INC R0 INCREMENT THE AD DATA ADDRESS 001D 14 50 CALL CONV CALL THE CONVERSION SUBROUTINE CONTINUE MAIN PROGRAM CONVERSION SUBROUTINE ENTRYACC AD MUX DATA EXIT ACC CONVERTED DATA ORG 50H 0050 99 FE CONV ANL P1 0FEH CHIP SELECT THE AD 0052 91 MOVX R1A LOAD AD MUX amp START CONVERSION 0053 09 LOOP IN AP1 INPUT W STATE www nationalcom 16 Applications Information Continued SAMPLE PROGRAM FOR ADC0844 INS8039 INTERFACE CONVERTING TWO RATIOMETRIC DIFFERENTIAL SIGNALS Continued 0054 0056 0057 0059 005A 32 53 81 89 01 A0 83 JB1 MOVX ORL MOV RET LOOP IF INTR 1 GOTO LOOP AR1 IF INTR 0 INPUT AD DATA P1amp01H CLEAR THE AD CHIP SELECT ROA STORE THE AD DATA RETURN TO MAIN PROGRAM IIO Interface to NSC800 Vcc VREF 5v 5v 5v ADCUB48 MADDBO MA1DB1 CH39L MA2DBZ CH2 MA3DB3 CH3 MA4DB4 035 CH4 DBG CH5 DB7 CH6 CHT CH8 AGND DGND V DM8131 T1 T2 B2 T3 B3 T4 B4 T5 B5 T6 BB STB OUT B1 stile D800501628 SAMPLE PROGRAM FOR ADC0848 NSC800 INTERFACE 0008 NCONV EQU 16 000F DEL EQU 15 DELAY 50 psec CONVERSION 001 F CS EQU 1FH THE BOARD ADDRESS 3C00 ADDTA EQU 003CH START OF RAM FOR AD DATA 000039 08 09 0A 0B MUXDTA DB 08H09H0AH0BH MUX DATA 000439 0C 0D 0E 0F DB 0CH0DH0EH0FH 000839 0E 1F START LD CCS 000A39 06 16 LD BNCONV 000C39 21 000039 LD HLMUXDTA 000F39 11 003C LD DEADDTA 001239 ED A3 STCONV OUTI LOAD AD S MUX DATA AND START A CONVERSION 001439 EB EX DEHL HLRAM ADDRESS FOR THE AD DATA 001539 3E 0F LD ADEL 001739 3D WAIT DEC A WAIT 50 psec FOR THE 001839 C2 001339 JP NZWAIT CONVERSION TO FINISH 001B39 ED A2 INI STORE THE AD S DATA CONVERTED ALL INPUTS 001D39 EB EX DEHL 001E39 C2 000E39 JP NZSTCONV IF NOT GOTO STCONV END Note 14 This routine sequentially programs the MUX data latch in the signalended mode For CH1CH8 a conversion is started then a 50 us wait for the AD to complete a conversion and the data is stored at address ADDTA for CH1 ADDTA 1 for CH2 etc 17 wwwnationalcom Physical Dimensions 0025 0535 HAD A inches millimeters unless otherwise noted 0985 r 25019 MAX MWWWWWWWWH V l 0220 0310 5588 7874 x 0005 0020 0127 0503 ElillillillilljJLllljJLill ll A TV 0037i0005 0940i0127 0005 00550005 0180 02900320 0127 1397i0127 4 572 0020 0050 MAX 7355 0128 GLASS SEALANT MIN 0505 1524 A ll 4 0200 5050 V If I I I JVT MAX A M V 950550 55 94 1150 A 0003 0012 3310 039125039200 l 0310 0410 0050 0018i0003 7074 1041 1524 045750075 MAX BOTH ENDS w 2540i0254 J20AREV M Ceramic DuallnLine Package J NS Package Number J20A V 1013 1040 2337 x 0752 0032 50005 MAXDPWH9 IIT ll1 7IWIITEFIWIH3 IITZIW m RAD PIN No1 IDENT quot250 i0005 5504 mm PIN No1 IDENT I9 L 03928quot 0 o W mmmmmmmmmw n 0090 03000320 gt 5276 09m 2 dim 28 I 0050 M 0040 gt OPTIONZ 0130 0005 0055 1524 1015 I 404XA 339302 0127 T51 TYP TYP i f l l l W 5145 5250 i 3583 5080 t l 95 i 5 00090015 90 50004 1 I 0229 0301 i 0020 TYP mill 10 1 l 0125 0140 0508 quot05010005 254050254 quot018 39 3 4 1175 3556 M39 0040 152450127 0457 50075 0325 0015 1016 0255 4381 N20A REV G Molded DuallnLine Package N NS Package Number N20A www nationalcom 18 Physical Dimensions inches millimeters unless otherwise noted Continued A 1243 1270 0092 3157 3225 2337 MAX 2 PLS sgI 19 4 WI I721 W 2 01 W W 7 W W ll l H 0032 OPTION 2 PIN N0 1 0813 0260i0005 I lDENT I HAD 05040127 7 39lLllLL3llil5lirL7J8lilllQlL11l 0mm 2 0052 EJECTOR PINS 0300 0320 1575 opT39ONAL 762 8128 RAD M40 1015 0130350005 P 33020127 l 3939 ll J l l 0145 0200 0 I l PM 3683 5080 0009 0015 A f 02290381 w V 3965 1 0125 0145 0018i0003 3175 3555 0040 L325 0l015 MIN 00750015 If I 0457iolo76gtll MIN r 2 1905 i0381 TYP 900 40 W a 255 0100i0010 39 254i0254 TYP N24CREV F Molded DuallnLine Package N NS Package Number N24C wwwnationalcom ADC0844IADCO848 8Bit pP Compatible AID Converters with Multiplexer Options Physical Dimensions inches millimeters unless otherwise noted Continued 0006 0450 OOOO 015 1143000 PIN 1 IDENT 4 1 26 mm gnnm 132322 5 D25 E I E I E I E I E I 11E I I D19 uuuuu39 M518 0050 127 TYP gtI H TYP gtI 0300 762 0045 O 45 X114 0165O18O 419 457 0 049050005 1245i013 LIFE SUPPORT POLICY O TYP 114 P TYP i O43O10 I 1 l T 041050020 TYP 1041051 4 39 TYP lt gt 450 X 0045 00170004 TY SEATING PLANE 0020 051 0105i0015 267i038 MIN TYP TYP ll QI0004 010 V28A REV K Molded Chip Carrier Package V NS Package Number V28A NATIONAL S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF THE PRESIDENT AND GENERAL COUNSEL OF NATIONAL SEMICONDUCTOR CORPORATION As used herein 1 Life support devices or systems are devices or systems which a are intended for surgical implant into the body or b support or sustain life and whose failure to perform when properly used in accordance with instructions for use provided in the labeling can be reasonably expected to result in a significant injury to the user 2 A critical component is any component of a life support device or system whose failure to perform can be reasonably expected to cause the failure of the life support device or system or to affect its safety or effectiveness National Semiconductor o7 Corporation Europe Americas Fax Tel 18002729959 Email Fax 18007377018 Deutsch Tel Email supportnsccom English Tel Francais Tel wwwnationalcom Italiano Tel National Semiconductor 49 0 1 80530 85 86 europesupportnsccom 49 0 1 80530 85 85 49 0 1 80532 78 32 49 0 1 80532 93 58 49 0 1 80534 16 80 National Semiconductor Japan Ltd Tel 81356397560 Fax 81356397507 National Semiconductor Asia Pacific Customer Response Group Tel 652544466 Fax 652504466 Email seasupportnsccom National does not assume any responsibility for use of any circuitry described no circuit patent licenses are implied and National reserves the right at any time without notice to change said circuitry and specifications Lecture 2 Lecture 2 VB Part 2 Component Labets thartabteName 1 I 1 Objective Strnpte catcutator the Mul Iy Plnglam HE Resuh Label Control Properties Conventtonat name prettx ts tbt eg tbtResutt Captton tont StZe type and text cotorcan be asstgned trorn Propemes box Typtcat uses captton components We text boxes Procedures and Str Prlvate Sub cmdcalculateicllcko Multlply 2 2 m1 Sub Pubhc Sub Mu1t1p1yx As Integer y As Integer mm z z e x e y txtResuhText Seuz m1 Sub Mutttpty s procedure ts added as tottows t Doubte cttcx on the form code W Show up 2 TootsrAdd Procedure thh Name Mutttptx Type Sub Scope Pubttc 3 d code as gtven above Dim ts used to dectare a vartabte e g Dtm 2 Can type cast vartabtes thh Dim 2 as Integer smsorneNurnber ts converted to strtng Can be asstgned to text etd Lecture 2 Component Pop up message boxes Code Programming MsgBox messageString DialogType titIeString Objective GUI s should provide users a way to navigate a program A pop up message box does this which command buttons like YES NO OK EXIT etc quot139 39 Thu MminnPrwnr Dialag Damn my in Humanism Exit GUI Properties 0 One form use frm prefix 0 Two command buttons use cmd prefix 0 Message box does not have its own component Message Box Programming Private Sub cmdMessageiclick Dim Message As Strin Dim DialogType As Integer Dim Title As String 39What message box should contain Message quotHeyl This is a sample messagequot 39want dialog box to have an OK button and 39an exclamation icon DialogType VbExclamation VbOKOnly 39Title of dialog box Title quotDialog Demoquot 39display the dialog box MsgBox Message DialogType Title End Sub Lecture 2 Button Constants Icon Constants Exercise 0 Add a YESNO pop up message box for the Exit command button The message should say Are you sure you want to quit The title bar can be anything you want 0 Ifthe user clicks YES then end the program if NO then do nothing Note the following Response MsgBoxMessage DialogType Title evaluate user response If Response vbYes Then Beep End End If Lecture 2 Component Text boxes tor rnbut Code Programming txtTextBox Text and str50meNumber Ealculaml HIE ObTectwe User enters numbers m Tnbut text box Tne mummy command button then generates products Code Programmmg Prlvate Sub pom Loado result 1 T txtInputText Shim End Sub Prlvate Sub cmdMultlplyichckO result result w txtInputText thlnputText T clear nput textbox thkesultText result nd Sub E ControT extensrons e 9 Text are trers wrtn perunent mformauon UTtrmateTy Shomd onecxtor numencaT mput Not ntumve for user Lecture 2 Component Input Dialog Box Code Progr mming lnputBox Dialog messagequot Title bar captionquot and lblSomeLabelCaption Message line Manon lina Em r Numier EX Exit Message Enlei liisl integer GUI Two command buttons and one label Code Prlvate Sub cdenterNumber7C11Ck0 econdNumber As Integer mm flrstNumber s flrstNumber InputBoxquotMessage Enter first 1ntegerquot quotTltle bar First Numberquot secondNumber InputBoxquotMessage Enter second 1ntegerquot quotTltle bar Second Numberquot If flrstNumber secondNumber Then ssageCapt10n flrstNumber amp quot 1 e v39 amp secondNumber quot amp secondNumber secondNumber Then on flrstNumber amp quot ls greater than flrstNumber amp quot ls less than quot amp secondNumber lblMe Elself flrstNum er gt 1blMessageCapt1 Else lblMessageCapt10n End If End Sub ote 0 Labels have a Caption eld lnputBox has two strings and can return data 0 amp is used to connect numbers in strings Lecture 2 Relays o Electromagnetic switch Packaged like SPST SPDT DPST DPDT Advantages widely available wide dynamic range multiple options Disadvantages limited cycles and response time SPDT Relay 5 VDC A LOAD VOLTAGE SUPPLY SWlTCH COlL COlL D 3 74L33741Q Dc LOAD o Relay s switch is activated when coil is energized Buffer should be used in computer interfacing applications Integrated circuit chips sink more current than source


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Allison Fischer University of Alabama

"I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over $600 per month. I LOVE StudySoup!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.