Tobacco38mmm.com

38mmm.com  时间:2021-04-08  阅读:()
Version3.
XStandardEditioniCONTENTS:LICENSEAGREEMENT:2WHATISWINWEDGE3WHATCANYOUDOWITHWINWEDGE3BEFOREYOUBEGIN4SystemRequirements4DevicesCompatiblewithWinWedge4What'sNewInVersion3.
X5WhyIsItCalledWinWedge5WHO'SUSINGWINWEDGE6GETTINGSTARTED7InstallingandRunningWinWedge7HowToObtainTechnicalSupport7QUICKSTARTGUIDETOUSINGWINWEDGE8ATYPICALWINWEDGECONFIGURATIONEXAMPLE9THEMAINMENU12THEFILEMENU13WinWedgeConfigurationFiles13ActivatingWinWedgeAutomaticallyWithaSpecificConfigurationFile14THEMODEMENU15SendKeystrokesMode15DDEServerMode17SendingKeystrokesvs.
DynamicDataExchange18THEPORTMENU19THEPORTSETTINGSWINDOW20THEPORTANALYZEMENUOPTION21THEDEFINEMENU23InputDataRecordStructure23Pre-InputCharacterTranslations23Pre-TransferCharacterTranslationTable23SerialOutputStrings24HotKeysandHotKeyActions24Preferences.
24DEFININGTHEINPUTDATARECORDSTRUCTURE25TheStartOfRecordEvent25TheEndOfRecordEvent26Singlefielddatarecords28Multipledelimiteddatafields29SpecialConsiderationsRegardingDelimiterCharacters30Multiplefixedlengthdatafields30SPECIFYINGFILTERSANDFIELDLENGTHS31SelectingFilters32SpecifyingFieldLengths32SpecifyingPre/PostambleKeystrokes(SendKeystrokesMode)33iiTRANSLATIONTABLES34Pre-InputCharacterTranslationTable34Pre-TransferCharacterTranslationTable36DEFININGSERIALOUTPUTSTRINGS.
38DEFININGHOTKEYSANDHOTKEYACTIONS40SelectingHotKeyActions40SelectingHotKeyKeystrokes41THEPREFERENCESWINDOW.
42THEACTIVATEMENU44ACTIVATINGWINWEDGEINTESTMODEORNORMALMODE44THEWINWEDGEWINDOW45TheEditMenu46TheQuitMenu47ACTIVATINGWINWEDGEINVIRTUALINSTRUMENTMODE48ACCESSINGON-LINEHELP49KEYSTROKEMACRORULES50DATEANDTIMESTAMPSINMACROS51FORMATTINGDATA/TIMEEXPRESSIONS52UNDERSTANDINGDYNAMICDATAEXCHANGE56EstablishingDDELinksUsingTheWindowsClipboard57DDEandWinWedge58WINWEDGEDDECOMMANDS59USINGTHELINKTESTUTILITYTOTESTDDECOMMANDS61TECHNOTES62UnderstandingHowDDEWorksHelpsAvoidCommonProgrammingMistakes62DDEEXAMPLES63ImportantNotes63DDEExamplesforExcel(VisualBasicforApplications)64DDEExamplesforMicrosoftAccess79DDEExamplesforMicrosoftWordforWindows81DDEExamplesforVisualFoxProforWindows82DDEExamplesforMicrosoftVisualBasicforWindows85DIAGNOSINGSERIALCOMMUNICATIONSPROBLEMS86TROUBLESHOOTING87RUNNINGWINWEDGEONMULTIPLESERIALPORTSSIMULTANEOUSLY89USINGMORETHANTWOSERIALADAPTERSATATIME89UNDERSTANDINGTHEDATAFROMYOURSERIALDEVICE90MOREWINWEDGECONFIGURATIONEXAMPLES94COOLWEDGETRICKS.
99INTRODUCTIONTOSERIALCOMMUNICATIONS104INDEX1102LicenseAgreement:1.
GRANTOFLICENSETALTechnologies,Inc.
grantsyoutherighttouseonecopyoftheenclosedsoftwareprogram(theSOFTWARE)onasingleterminalconnectedtoasinglecomputer(i.
e.
,withasingleCPU).
YoumaynotnetworktheSOFTWAREorotherwiseuseitonmorethanonecomputerorterminalatthesametime.
2.
COPYRIGHTTheSOFTWAREisownedbyTALTechnologies,Inc.
andisprotectedbyUnitedStatescopyrightlawsandtreaties.
Therefore,youmusttreattheSOFTWARElikeanyothercopyrightedmaterial(e.
g.
,abookormusicalrecording)exceptthatyoumayeither(a)makeonecopyoftheSOFTWAREsolelyforbackuporarchivalpurposes,or(b)transfertheSOFTWAREtoasingleharddiskprovidedyoukeeptheoriginalsolelyforbackuporarchivalpurposes.
YoumaynotcopytheusersmanualaccompanyingtheSOFTWARE.
3.
OTHERRESTRICTIONSYoumaynotrentorleasetheSOFTWARE,butyoumaytransfertheSOFTWAREandaccompanyingwrittenmaterialsonapermanentbasisprovidedyouretainnocopiesandtherecipientagreestothetermsofthisAgreement.
Youmaynotreverseengineer,de-compile,ordisassembletheSOFTWARE.
IfSOFTWAREisanupdate,anytransfermustincludetheupdateandallpriorversions.
4.
DISCLAIMERNoWarrantyofanykindontheSOFTWAREisexpressedorimplied.
InnoeventshallTALTechnologiesoritssuppliersbeliableforanydamageswhatsoever(including,withoutlimitation,damagesforlossofbusinessprofit,businessinterruption,lossofbusinessinformationorotherpecuniaryloss)arisingoutoftheuseoforinabilitytousethisproduct.
Ifyouhavequestionsconcerningthisagreement,orwishtocontactTALTechnologies,pleasecallorwrite:TALTechnologies,Inc.
2101BrandywineStreet,Ste.
102Philadelphia,PA19130USATel:(215)-496-0222Fax:(215)-496-0322email:sales@taltech.
comSkype:taltech1WebSite:http://www.
taltech.
com3WhatisWinWedgeWinWedgeisanextremelypowerfulutilitythatisdesignedtoaddserialcommunicationscapabilitiestoanyWindowsapplication.
TheprimaryfunctionofWinWedgeistoprovideawaytoconnectanyRS232,RS422orRS485device(andsomeUSBdevices)toaPCandbeabletoreadorwritedatatoorfromthedevicedirectlyfromwithinanyWindowsapplicationwithouttheneedforanycustomserialcommunicationssoftwaredevelopment.
TypicalkindsofserialinstrumentsbeingusedwithWinWedgeincludebarcodeandmagneticstripereaders,electronicbalances,measuringtoolsincludingcalipersandgages,temperaturesensors,telephonecallloggingsystems,pHandcolormeters,PLCs,coordinatemeasuringmachines,opticalcomparators,digitalvoltmeters,GPSreceiversandawidevarietyofotherlaboratoryorindustrialinstrumentsthatcommunicateoverastandardserialinterface.
WinWedgecantransferserialdatatoanyWindowsapplicationeitherbysendingthedataaskeystrokesorbyprovidingdataasaDDE(dynamicdataexchange)server.
Youcanalsosetupthe"Wedge"toissuecommandstoanotherapplicationaftereachrecordofincomingserialdatahasbeenreceived.
Thusyoucouldcausethereceivingapplicationtoperformactionsbasedonthedatabeingreceived;forexampleyoucouldforceanapplicationtorunamacroorupdateagraphorchartinrealtimeusingthedatareceivedfromthedevice.
WinWedgeoffersanarrayoffeaturesincludingtheabilitytoparseandfilterdatareceivedthroughtheserialportaswellasaddadditionaldataincludingdate/timestampsorcursornavigationkeystrokestoincomingdata.
Twotranslationtablesallowsyoutotranslateincomingcharacterstoothercharactersortospecifickeystrokes.
Youmayevenpre-define"SerialOutputStrings"thatcanbetransmittedtoyourserialdeviceeitherautomaticallyatregulartimedintervalsorbyclickingyourmouseonabuttoninWinWedgewindoworbypressinga"HotKey"onyourPC'skeypad.
YoucanuseaspecialsetofDDEcommandstotransmitdataorcommandstringsouttheserialportdirectlyfromanotherprogram.
AllthesefeaturesmakeitpossibletocreateextremelysophisticateddevicecontrolinterfacesforvirtuallyanyserialinstrumentdirectlyfromwithinanyWindowsapplicationprogram.
WhatcanyoudowithWinWedgeWinWedgecanbeusedinapplicationsrangingfromsimpledatainput(i.
e.
readingdatafromabarcodescannerorscaleintoaspreadsheet)tocomplexdevicecontrolinterfaces(i.
e.
usingWinWedgewithExcel,Access,InTouchorotherHMIsorLIMStocreateanOn-Line,realtime,processcontrolprogramthatcommunicateswithmultiplelaboratoryinstruments).
ThebestwaytounderstandthecompletecapabilitiesofWinWedgeistoreadthismanualthoroughly.
WinWedgehasmanyfeaturesincludingpowerfulDDEcapabilitiesthatarenotimmediatelyapparentfromthemenusandwindowspresentedwhenyourunWinWedgeonyourPC.
Again,theonlywaytolearnaboutitsfullcapabilitiesistoreadthismanualinitsentirety.
SeeAlso:CoolWedgeTricks(pg.
99)4BeforeYouBeginWeatTALTechnologieswouldliketotakethisopportunitytothankyouforpurchasingWinWedge.
WesincerelyhopethatitprovestobetheperfectsolutionforallyourserialI/Oapplications.
WealsohopethatyoufindWinWedgebotheasyandenjoyabletouse.
Ifthereisaparticularfeaturethatyouwouldliketoseeinafutureversionorperhapsachangeineitherthesoftwareorthedocumentationthatwouldmakethisproducteasiertouse,pleasecontactus.
Yourfeedbackwillbegreatlyappreciated.
Wewouldalsoliketotakethisopportunitytoremindyoutoreadthecopyrightnoticeandlicenseagreementonpagetwoofthismanualthoroughly.
YouhavepurchasedalicensetousethissoftwareinasinglePCandthusyoumaynotuseitonmorethanonePCatatimewithoutpurchasingadditionallicenses.
Pleasehelpustoprotectyourinvestmentbyadheringtothetermsofthisagreementandbyreportingcopyrightviolationsdirectlyto:TALTechnologies,Inc.
Tel:800-722-6004or215-496-0222Fax:215-496-0322email:support@taltech.
comSkype:taltech1SystemRequirementsThe32bitversionofWinWedgewillrunonanyWindows95,98,ME,NT,2000,XP,Vista,orWindows7system(i.
e.
any32or64bitversionofWindowsandanynewer32or64bitversionsofWindowsthatMicrosoftmayreleaseinthefuture).
WinWedgeusesroughly2Mbofdiskspaceand16ormoreMbofRAMmemoryisrecommended.
MostPCshaveseveralGigabytesofRAMandseveralhundredGigaytesofharddiskspacethereforeyoushouldnothaveanyproblemsinstallingandrunningWinWedgeoneventhemostbarebonesWindowsworkstation.
DevicesCompatiblewithWinWedgeWinWedgewasdesignedprimarilyasaninterfacetomostcommonlyusedRS232datacollectiondevicesincludingElectronicScales,BarCode,RFIDTagandMagneticStripeReaders,ElectronicMeasuringTools,Medical,IndustrialandLaboratoryInstruments,TelephonePBXandCallerIDsystems,DataLoggers,FlowMeters,Sensors,PlateReaders,SpectrumAnalyzers,VOMs,pHmeters,Densitometers,CMMs,StripChartRecorders,Titrators,QualityandProcessControlInstruments,CoinCounters,PLCs,GPSreceiversetc.
.
AnytypeofdevicewithaserialinterfacewhoseoutputdataistransmittedinasomewhatstructuredASCIItextformatisagoodcandidateforusewithWinWedge.
Note:ManyRS422andRS485serialcanalsobeusedwithWinWedgeprovidedthatyouhavethecorrecttypeofserialI/OadapterorconverterinstalledinyourPC.
WinWedgecanalsobeusedwithmanytypesofUSBdevicesprovidedthattheUSBdevicecomeswithadriverthatcausesthedevicetoappearasastandardCOMportinWindows.
ThisincludesallcommerciallyavailableUSBtoSerialconverters.
Forexample,ifyourPCdoesnothaveanyavailableRS232serialports,youcanalwaysaddserialportstoitbypurchasingaUSBtoSerialadd-onadapteravailableatanycomputerorofficesupplystoreforroughly$10to$30.
AllUSBtoSerialadd-onadapterscomewithadriverthatyouinstallinWindowssothattheoperatingsystemrecognizestheadapterandcausesittoappearintheWindowsDeviceManagerasastandardRS232COMport.
5What'sNewInVersion3.
XVersion3.
XofWinWedgeaddsseveralnewcapabilitiestopreviousversionsincluding:userdefinable"HotKeys"thatallowyoutocontrolmanyserialI/Ofunctionswithasimplekeypress,supportforupto32serialports,aPre-InputCharacterTranslationTable,additionalDataParsingandFilteringcapabilitiesaswellasaTimedAutomaticSerialOutputFunctionandanexpandedsetofDDECommands.
Completecontextsensitivehelp(availablebypressingfunctionkeyF1)hasalsobeenaddedtoallwindowsanddialogboxesthusmakingWinWedgeeasiertosetupanduse.
Anew"VirtualInstrument"modeevenallowsyoutotestthefunctionalityofWinWedgewithoutrequiringanactualserialinstrumenttobeattachedtoyourPC.
Theusersmanualhasalsobeenre-writtentoincludemanyexamplesforsettingupandusingWinWedgewithdifferentserialdevicesandothersoftwareapplications.
AllnewfeaturesweredesignedtosupportawiderrangeofRS232instrumentsandI/OdataformatsaswellasmakeWinWedgemucheasiertosetupanduse.
WhyIsItCalledWinWedgeAWedge(orkeyboardwedge)isahardwaredevicethatconnectsbetweenacomputeranditskeyboard.
Typicallyawedgeprovidesaserialportthatallowsdatatobeinputtedfromaserialdeviceasifitwasbeingtypedinonthekeyboard.
BeforethedevelopmentofWinWedge,keyboardwedgesweretheonlyavailablesolutionifyouneededtoinputserialdatadirectlyintoanofftheshelfprogramlikeExcel,Access,Word,etc.
Unfortunately,keyboardwedgesareseverelylimitedincapability,arepainfullyslow,andtheycannotsupporttwowayserialI/O.
Theyarealsoexpensive,pronetonumerousproblemsandcanbedifficultorimpossibletoinstall,especiallyonalaptopthatdoesnothaveakeyboardportoradesktopPCthatusesaUBSkeyboard.
WinWedgeisasoftwareonlyalternativetoakeyboardwedgethatallowsyoutoconnectaserialdevicedirectlytoyourWndowsPC'sserialportwithnoneedforanyadditionalhardware,thusthename:WinWedge.
BecauseWinWedgeisimplementedasasoftwareproduct,itworksdirectlywithyourPC'soperatingsystemandcanthereforeoperatemuchfasterthanahardwarewedge.
Itcanalsoprovidefeaturesthatareeitherdifficultorimpossibletoimplementinahardwareproductsuchasdataparsing,filtering,formattingandtranslationfunctions,fullybi-directionalserialI/Ocapability,date/timestampingfunctionsandsupportforoperatingsystemspecificfeatureslikeDynamicDataExchangeandtruebackgroundoperation.
Ifyoucomparefeatures,WinWedgeislightyearsaheadofeventhemostsophisticatedhardwarewedgeavailable.
Ifyoucomparepricesyou'llalsofindWinWedgetobefarmoreeconomicalaswell.
6Who'sUsingWinWedgeWinWedgewasoriginallydevelopedbyTALTechnologiesin1989asasimpleinterfaceforbarcodereaders.
Itquicklybecameapparentthataproductofthistypewasneededforusewiththehundredsofdifferenttypesofdevicesthatcommunicatethroughaserialinterface.
Sincethen,WinWedgehasevolvedintoanextremelypowerfulproductcapableofinterfacingvirtuallyanytypeofserialinstrumenttoaPC.
Severalhundredthousandcopiesofthe"Wedge"havebeenlicensedtousersineverycountryaroundtheglobe.
ThefollowingisjustashortlistofsomeofthemanycompaniesthatrelyonWinWedgeforhundredsofdifferentserialdatacollectionapplications.
3M,AbbottLabs,Allen-Bradley,AlliedSignal,AmericanCyanamid,AmericanExpress,Ametek,Amgen,Amtrack,Amway,AndersonConsulting,ARCOChemical,AshlandChemical,ASTResearch,AT&T,AtlanticElectric,Avery,BASFCorp.
,Battelle,BauerIndustries,BaxterHealthcare,BectonDickinson,BellAtlantic,BellIndustries.
,Black&Decker,Boeing,BordenChemical,Bose,Bristol-Myers-Squibb,BridgestoneFirestone,BushIndustries,ButterballTurkey,Cable&Wireless,CambridgeAeroflo,CamcarTextron,CanonUSA,Catepillar,CentersforDiseaseControl,CERN,ChevronResearch,CibaCorp.
,CibaCorningDiagnostics,CorningGlass,CrayResearch,Cryovac,DanaCorp,DanflossElectronics,DataElectronics,DataVision,DelcoChassis,DelcoRemy,DHHS,DHLInternational,DominoSugar,Donnelly,DowChemical,DowDeutschland,DowJones,DowPipeline,Dupont,Duracell,EatonCorp.
,EDS,ElanEngineering,EliLilly,Epson,EsselteMeto,EurothermChessell,Eveready,FDA,FederalExpress,FederalReserve,Firestone,FirstBrands,FischerTechnologies,FisherControls,FisherRosemountSystems,FloridaPower,FloridaSteel,FordMotorCo.
,Friskies,Frito-Lay,Fuji-Xerox,FujitsuMicroelectronics,GSA,GatesRubber,GEFamuc,GEMedical,GeneralElectric,GeneralDynamics,GeneralMills,GeneralMotors,GeorgiaPacific,Gillette,Goodyear,GreatLakesControls,Grumman,GulfStatesSteel,HarleyDavidson,HarpIreland,HeleneCurtis,HenryFordHospital,HewlettPackard,HoechstCelanese,HofferScientific,Honeywell,Hoover,HughesAircraft,HunterIndustries,ITIElectronics,IBMCorp.
,ImperialOil,Intel,Intellution,Intermec,J.
C.
Penney,Jack&JillIceCream,JamesRiverCorp.
,JandelScientific,JencoInstruments,JensenChevron,Johnson&Johnson,JohnsonControls,KaiserAluminum,KalCanFoods,Kimberly-Clark,KochIndustries,Kodak,Konica,KraftFoods,LakePharmaceutical,LandO'Lakes,Leeds&Northrup,LennoxIndustries,LeviStrauss,LiquidContainer,LockheedMartin,Lubrizol,LucasAerospace,M.
I.
T.
,M&MMars,MalaysianCarbon,MarionMerrellDow,MarsElectronics,Marsampharmaceuticals,MartelElectronics,Maytag,Merck&Co.
,Metrologic,MooreResearch,Motorola,NASA,NationalGypsum,NationalInstituteofHealth,NationalWeatherService,NavelMedicalResearch,NewYorkTimes,Nestle,Nikon,NipponDenso,NordicTrack,NortheastUtilities,NorthernStatesPower,NorthernTelecom,NortonChemical,NovaScotiaPower,Nynex,OceanSpray,OlympicControls,OsramSylvania,Ortho-McNeilPharmaceuticals,OtterTailPowerCo.
,OwensCorning,PCCAirfoils,PacificGasandElectric,PackardElectric,Penzoil,Pfizer,PhilipsConsumerElectronics,PickerInternational,PioneerHi-BredInternational,PioneerMicroSystems,Pitney-Bowes,PlantGeneticSystems,Polaroid,PorterInstruments,PPGIndustries,PrinceSportsGroup,Pratt&Whitney,Proctor&GamblePharmaceutical,RaguFoods,RandMining,RavenswoodAluminum,Raychem,ReynoldsMetals,RichmomdMemorialHospital,RobertBoschInd.
,RosemountAnalytical,RockwellInternational,Rohr,RRDonnelley,RWJohnsonPharmaceuticalResearch,Sandoz,SanyoElectricCo,SartoriusCorp.
,SeagateTech.
,ScottPaper,Sears&Robuck,Siemens,SmithCorona,SmithKlineBeecham,Spaulding,SpectraPhysics,SSIServices,StanleyTools,Sony,SouthernResearchInstitute,StarcraftAerospace,StrathmorePaper,SummittControls,Sunkist,SymbolTechnologies,TCBYEnt.
,TEC,Teledyne,TelxonCorp.
,TexasBeef,TexasInstruments,TexasMedicalCenter,TheAmericanTobaccoCo.
,TheCocaColaCo.
,TheGap,TheGliddenCo.
,TheMennenCo.
,ThePisterGroup,TheTraneCo.
,TimberlineInstruments,Toshiba,ToyotaAmerica,TrimosSylvac,TVA,Unisys,Upjohn,UnitedParcelService,U.
K.
MinistryofDefense,U.
S.
Telecom,U.
S.
Army,Navy,CoastGuard,U.
S.
Fish&Wildlife,U.
S.
GeologicalSurvey,U.
S.
Gypsum,U.
S.
PostalService,Underwriter'sLabs,Unilever,VAMedicalCenter,Verifone,Verbatim,Volvo,W.
L.
Gore,WashingtonPost,Wausau,Westinghouse,WyethAyerst,Xerox,ZenecaPharmaceutical,Zymark,andmany,manymore.
.
.
.
NationallaboratoriesusingWinWedgeincludeOakRidge,Sandia,LosAlamos,Argonne,FermilabandLawrenceBerkeleylaboratoriesandhundredsofindustrialanduniversityresearchlaboratoriesworldwidefromHarvardandMITtoUniversitatStuttgart.
7GettingStartedInstallingandRunningWinWedgeWinWedgecomeswithaninstallationprogramcalled"SETUP.
EXE"thatwillcopyallWinWedgeprogramfilestoyourharddiskandalsoinstalltheWinWedgeiconsintotheWindows"StartMenu".
ToinstallWinWedge,placetheWinWedgeCDROMintoyourCDROMdriveandselect"Run"fromtheStartMenu.
Whenthe"Run"windowappears,typethecommand"d:SETUP"(wheredisthedriveletterforyourCDROMdrive)andclick"OK".
TheSETUPprogramtakesapproximatelyoneminutetocopyallfilesandinstallWinWedgeintotheWindowsStartMenu.
WinWedgecanberunbyclickingyourmousecursorontheWinWedgeiconintheStartmenu.
SeeAlso:ActivatingWinWedgeAutomaticallyWithaSpecificConfigurationFile(pg.
14)HowToObtainTechnicalSupportIfyouexperiencedifficultyconfiguringWinWedgeafteryouhavereadthismanualthoroughly,pleasecallTALTechnologiesatTel:(215)-496-0222orFax:(215)-496-0322fortechnicalsupport.
Questionscanalsobesentviae-mailto:support@taltech.
comYoumayalsoreachusonSkypeusingtheSkypeusername:taltech1OnlyregisteredusersofWinWedgeareeligiblefortechnicalsupport.
PleasehaveyouroriginalWinWedgeCDROMandthisusersmanualavailablewhencallingforsupportand,ifpossible,beatyourPCwithWinWedgerunningwhenyoucall.
TALTechnologiesalsohasawebpageat:http://www.
taltech.
comwhereyoucanfindtechnicalinformationandexamplesaswellasaWinWedge"KnowledgeBase"containinganswerstomanyfrequentlyaskedquestions.
Important:Ifyouhavenotalreadydoneso,pleasetakethetimefilloutthesoftwareregistrationformonourwebsiteathttp://www.
taltech.
net/register.
asp.
Ifyoucallfortechnicalsupportandyouarenotaregistereduserthenwewillnotbeabletoprovideyouwithtelephoneore-mailsupport.
SeeAlso:DiagnosingSerialCommunicationsProblems(pg.
86)Troubleshooting(pg.
87)8QuickStartGuideToUsingWinWedgeOutlinedbelowarethemosttypicalminimalstepsthatarerequiredtouseWinWedgesuccessfully.
Pleasenote:ThissectionhasbeenprovidedasageneraloverviewofthetypicalstepsinvolvedinsettingupWinWedgeandisbynomeansareplacementfortherestofthismanual.
Step1.
SelecthowWinWedgewilltransferincomingserialdatatoyourotherWindowsprogramsbychoosingoneoftheoptionsintheModemenu.
WinWedgecantransferincomingserialdatatootherprogramsbyeitherconvertingthedatato"keystrokes"andtypingthedataintoanotherapplication'swindoworitcanpassthedatausingDynamicDataExchange(DDE).
SendingdataaskeystrokesisgenerallymuchsimplerthanusingDDEhoweverDDEprovidesgreaterflexibilityinhowyoucandealwiththedataintheotherprogram.
Foracompletedescriptionofeachofmode,readthesectionofthismanualentitled:TheModeMenu(pg.
15)Step2.
SelecttheSettingsoptioninthePortmenuandchoosethecommunicationsparametersthatmatchthesettingsfortheserialdevicethatyouwillbeusing.
Afteryouselectyourcommunicationsparameters,youshouldselecttheAnalyzeoptionfromthePortmenuandtransmitsomesampledatafromyourserialdeviceinordertobothtestthatyouareusingthecorrectserialcommunicationsparametersandalsotogainanunderstandingofhowthedatafromyourserialdeviceisstructured.
Refertothesections:ThePortMenu(pg.
19)andDiagnosingSerialCommunicationsProblems(pg.
88)forfurtherinformation.
Step3.
Select"InputDataRecordStructure.
.
.
"fromtheDefinemenu.
Thiswillpresentyouwithaseriesofwindowsthatallowyoutofirstdescribethestructureofyourincomingserialdataandfinallydescribehowyouwanttoparse,filterandformatthedataaswellasaddadditionaldata,keystrokes,ordate/timestampstothedatabeforepassingitontothetargetapplicationprogram.
Thisstepcanbefairlycomplexthereforeitishighlyrecommendedthatyoureadthesections:DefiningtheInputDataRecordStructure(pg.
25)andUnderstandingTheDataFromYourSerialDevice(pg.
90)Step4.
IfthedevicethatyouareusingrequiresdataorcommandstobesentbacktoitfromyourPC,pleasereadthesections:DefiningSerialOutputStrings(pg.
38)andDefiningHotKeysandHotKeyActions(pg.
40)Step5.
ThefinalstepistoActivateWinWedgetostartitworking.
YoumaywanttosaveyourWinWedgeconfigurationatthispointbyselecting"Save"fromtheFilemenu.
ToactivateWinWedge,select"TestMode"fromtheActivatemenu.
Refertothesection:TheActivateMenu(pg.
44)forfurtherinformation.
Note:WinWedgewillnotworkuntilyouactivateitbyselectingoneoftheoptionsintheActivatemenu.
Werecommendselecting"TestMode"untilyouhaveeverythingworkingthewayyoudesire.
SeeAlso:ATypicalWinWedgeConfigurationExample(pg.
9)MoreWinWedgeConfigurationExamples(pg.
94)DiagnosingSerialCommunicationsProblems(pg.
86)Troubleshooting(pg.
87)9ATypicalWinWedgeConfigurationExampleThissectionshowsthetypicalstepsforsettingupWinWedgeforusewithabarcodereaderorasimplemeasuringinstrumentlikeadigitalcaliper,forcegage,weighscale,orpHmeter.
ThestepsoutlinedbelowshowhowtoconfigureWinWedgetoreaddatafromyourdevicedirectlyintoanotherWindowsapplicationwhereverthecursoris;asifthedatawerebeingtypedinonyourkeypad.
Thisexampleassumesthattheapplicationthatyouprimarilywanttocapturedatatoisaspreadsheet.
Italsoassumesthatyouwouldliketohavesuccessivereadingsfromyourinstrumentstackedupinacolumninthespreadsheet.
Youshouldbeginbyreadingtheownersmanualfortheserialdevicethatyouareusingtofindoutthecommunicationsparametersthatituses.
Forthisexamplewewillassumethatthedeviceusestheparameters:9600baud,evenparity,7databitsandonestopbit.
Step1.
PlugtheinstrumentintoserialportCOM1orCOM2,turniton,andrunWinWedgebyclickingonitsiconintheWindows"Start"menu.
Step2.
Selectthe"SETTINGS"optionfromthe"PORT"menuinWinWedgeandchoosethecommunicationsparametersCOM1(orCOM2),9600baud,EvenParity,7DataBits,onestopbitandnoflowcontrolfromthewindowthatappearsandthenclicktheOKbuttontoreturntothemainmenu.
Step3.
Select"ANALYZE"fromthe"PORT"menuandtransmitasamplereadingfromyourdeviceintothe"InputData"textboxintheAnalyzewindow.
Thisstepservestwopurposes,first,totestthatyourserialcommunicationsparametersarecorrectandthatthedeviceisconnectedproperlyandsecond,togainanunderstandingofhowthedatafromthedeviceisstructured.
Ifdatadoesnotappearinthetextboxmarked"InputData",thenreadthesectionofthismanualentitled"Troubleshooting"(pg.
87).
IfdataappearsintheInputDatatextbox,thenexamineallthecharactersthatarereceivedlookingforregularfeatureslikedelimiters,orspecialcharacterslikecarriagereturnsorlinefeeds,etc.
.
(Acarriagereturn(ASCII13)willappearasamusicalnoteandalinefeed(ASCII10)willlooklikeasmallrectanglewithacircleinsideit.
)Youmaywanttotakeseveralreadingsfromthedevicejusttomakesurethateachreadingisstructuredinasimilarmanner.
10Mostsimpledevicessuchaselectronicbalances,barcodereaders,calipers,andforcegagestransmitasinglenumberorshortdatastringfollowedbyacarriagereturnorcarriagereturnlinefeedpair.
Fortherestofthisexample,wewillassumethatthisishowthedatafromyourdeviceisstructured.
Afteryouhaveexaminedthedatafromyourdevicethoroughlyandaresatisfiedthatthedeviceistransmittingyourdatacorrectly,clickonthebuttonmarked"Quit"toreturntothemainmenu.
Step4.
BecausewewanttobeabletoreaddatadirectlyintoanyWindowsprogram,theeasiestwaytodothisistohaveWinWedgeconverttheserialdatatokeystrokessothatitwillappearasifitisbeingtypedinonyourkeyboard.
Select"SendKeystrokesTo.
.
.
"fromtheMODEmenu(evenifitisalreadychecked).
ThiswillpresentawindowpromptingfortheApplicationTitleBarTextand/orCommandLinethatwillidentifytheapplicationthatyouwantWinWedgetosendallkeystrokesto.
Inthisexample,wewantWinWedgetosendthedatatowhateverapplicationhastheinputfocuswhenthedataisreceivedthereforethetwoitems"ApplicationTitleBarText"and"CommandLine"shouldbecompletelyclearedout.
Leavingtheseitemsblank(asshown)causesWinWedgetosendthedatafromyourdeviceaskeystrokestowhateverapplicationhastheinputfocuswhenthedatacomesinthroughtheserialport.
Afterclearingoutthesetwoitems,clicktheOKbuttontoreturntothemainmenu.
Step5.
Thenextstepistodefinethestructureofthedatathatisbeingreceivedfromyourserialdevice.
Weprimarilywanttosendthedatatoaspreadsheetandhavethecursormovedownonecellaftereachreading,hencewemustalsoinstructWinWedgetoaddaDownArrowkeypressattheendofeachreadingfromourdevice.
Todothis,select"InputDataRecordStructure.
.
.
"fromtheDEFINEmenu.
Thefirstwindowthatappears(left)willallowustodescribetheeventsthatdeterminethestartandendofeachdatarecordtransmittedbyourdevice.
Inthiscaseeachdatarecordisasmalltextstringendingwithacarriagereturn(ASCII13).
Thus,wewouldspecify"AnyCharacterReceived"asthe"StartofRecordEvent"and"CarriageReturnorCrLfReceived"asthe"EndofRecordEvent".
Aftertheseoptionsareselected,clickonthe"Continue.
.
.
"buttontoproceed11Thenextwindowtoappearprovidesoptionstodescribeanoverall"Structure"foreachdatarecord.
Inthisexampleourdataonlyconsistsofasingle"Field"thereforewewouldselect"SingleFieldDataRecords"andclickthe"Continue.
.
.
"button.
Inthenextwindowtoappear,placethecursorinthetextboxlabeled"FieldPostambleKeystrokes"andthenclickthebuttonmarked"KeystrokeList".
Whenthekeystrokelistappears,scrolldownthroughthelistuntiltheword"Down"ishighlightedandthenclicktheOKbuttoninthekeystrokelistwindow.
Thisshouldcausetheword"{DOWN}toappearinthe"FieldPostambleKeystrokes"textbox(asshown).
Thenclickthebuttonmarked"OK"toreturntothemainmenu.
WinWedgeisnowcompletelyconfiguredtoworkthewaywewantitto.
Youshouldsaveyourconfigurationatthispointbyselecting"Save"fromtheFILEmenu.
Itisagoodideatochoosenamesforyourconfigurationfilesthatareeasilyassociatedwiththedevicethatyouareusing.
ForexampleyoumightusethenameBALANCECOM1.
SW3forabalanceconnectedtoCOM1.
Step6.
AfterconfiguringWinWedgeyoumustactivateitbyselecting"TestMode"fromtheACTIVATEmenuinordertostartitworking.
AfteryouactivateWinWedge,awindowcontainingatextboxmarked"InputDataField(s)"willappearonyourscreentoindicatethatithasbeenactivatedsuccessfully.
Step7.
Atthispoint,WinWedgeisnowreadyandwaitingtodoitsjob.
Ifyouopenyourspreadsheet(oranyotherWindowsprogram)andplacethecursorinacellandthentransmitareadingfromyourserialdevice,thedatawillappearjustasifitwerebeingtypedinonyourkeyboardwitha"DownArrow"keypressbeingissuedautomaticallyafterthedataappears.
SeeAlso:MoreWinWedgeConfigurationExamples(pg.
94)CoolWedgeTricks(pg.
99)12TheMainMenuWhenyourunWinWedgeyouwillbepresentedwiththefollowing"MainMenu":Thetitlebarofthemainmenuindicatesthatyouareinsetupmodeanditalsodisplaysthefilenameofanycurrentlyselectedconfigurationfileinparentheses.
BeforeyoucanuseWinWedge,youmustconfigureitforyourparticularserialdevice.
YouconfigureWinWedgebyselectingvariousoptionsfromthemainmenuandthenafteritisconfigured,you"Activate"itbyselectingoneoftheoptionsintheActivatemenu.
Themainmenuoptionsandtheirfunctionsare:File-AllowsopeningandsavingofconfigurationfilesandexitingofWinWedge.
SeeAlso:TheFileMenu(pg.
13)Mode-AllowsselectionofthemethodusedtotransferserialinputdatafromWinWedgetoanotherapplicationandoptionallyspecifytheapplicationthatistoreceivethedata.
SeeAlso:TheModeMenu(pg.
15)Port-Allowsselectionandtestingofallserialportcommunicationsparameters.
SeeAlso:ThePortMenu(pg.
19)Define-ThedefinemenucontainsoptionsthatallowyoutocustomizehowWinWedgeshouldworkforyourparticularapplication.
Thedifferentsubmenuitemsallowthedefinitionoftheinputdatarecordstructure,parsinginstructions&filterstobeappliedtoincomingdata,additionalcursornavigationkeystroketobeissuedduringtheinputofdata,translationsofincomingcharacters,definitionofhotkeysandserialoutputdatastrings.
SeeAlso:TheDefineMenu(pg.
23)Activate-AllowsactivationofWinWedgeusingthecurrentconfiguration.
WinWedgewillnotdoanythinguntilitisactivatedbyselectingoneoftheactivationoptionsinthismenu.
SeeAlso:TheActivateMenu(pg.
44)Help-ProvidesOn-LinehelpforWinWedge.
Inadditiontothehelpmenu,WinWedgehascompletecontextsensitivehelpthatisavailablebypressingfunctionkeyF1.
SeeAlso:AccessingOn-LineHelp(pg.
49)13TheFileMenuSelecting"File"fromtheWinWedgemainmenupresentsthesub-menushownbelow:Filesub-menuoptionsandtheirfunctionsareasfollows:New-UnloadsanycurrentlyloadedconfigurationfileandresetsWinWedgetoitsdefaultconfiguration.
Open-OpensawindowthatallowsselectionofapreviouslysavedWinWedgeconfigurationfile.
Save-SaveschangestothecurrentlyopenWinWedgeconfigurationfile.
SaveAs-Opensawindowthatallowsyoutosavethecurrentconfigurationwithafilenamethatyouspecify.
Exit-ExitsWinWedge.
WinWedgeConfigurationFilesWhenyouconfigureWinWedgeforusewithaparticularserialdeviceandaspecificapplicationprogram,youcansaveyourconfigurationtoadiskfilethatcanbereloadedlater.
Bysavingyourconfigurationstoadiskfile,youonlyhavetocreatetheconfigurationonce.
ThenexttimeyouneedtouseWinWedgewithaparticulardevice,youcansimplyrunWinWedgeandloadinyourpreviouslysavedconfigurationfileandthenactivateWinWedge.
ThissavesyouthetroubleofhavingtoconfigureWinWedgeeachtimeyouwanttouseit.
IfyousaveyourconfigurationfilestoyourWindowsDesktopfolder,youcanevenlaunchandactivateWinWedgewiththesavedconfigurationfilebydoubleclickingonthefile'sicononyourdesktopwithouteverhavingtoopenWinWedgefirst.
14ActivatingWinWedgeAutomaticallyWithaSpecificConfigurationFileWinWedgesupportsoneoptionalcommandlineargumentusingthefollowingsyntax:WinWedge.
ExefilenamewherefilenameisthenameofapreviouslysavedWinWedgeconfigurationfile.
IfthefilenameforaWinWedgeconfigurationfileissuppliedonthecommandlineusedtolaunchWinWedge,thespecifiedconfigurationfilewillbeloadedautomaticallyandWinWedgewillactivateitselfusingthatconfiguration.
ThefilenamemustbethenameofavalidWinWedgeconfigurationfilecompletewiththefilenameextensionandalsothedriveanddirectorypathforthefileifitisnotinthesamefilefolderwiththeWinWedgeprogramfiles.
Thefilenameextension".
SW3"isthedefaultfilenameextensionforallWinWedge3.
xconfigurationfiles.
TheinstallationprogramforWinWedge(SETUP.
EXE)automaticallyestablishesan"Association"betweenthefilenameextension".
SW3"andtheexecutableprogram"WinWedge.
exe".
ThisallowsyoutolaunchWinWedgeconfigurationfilesdirectlywithouthavingtogothroughtheprocessoflaunchingWinWedge,openingtheconfigurationfileandthenactivatingWinWedge.
Forexample,afteryoucreateandsaveaconfigurationfileforWinWedge,youcansimplydoubleclickonthenameoftheconfigurationfileintheWindowsExplorerandWindowswillautomaticallylaunchWinWedgeandactivateitusingtheselectedconfiguration.
YoucouldalsocreateshortcutstoyourWinWedgeconfigurationfilesandthendraganddroptheshortcutsontoyourdesktop.
ThiswouldplaceanicononyourdesktopthatyoucouldusetolaunchWinWedgewiththeparticularconfigurationfile.
ActivatingWinWedgeAutomaticallyWhenYouStartWindowsToloadandactivateWinWedgeautomaticallywithaparticularconfigurationfilewhenyoustartWindows,opentheWindowsExplorerandselectapreviouslysavedWinWedgeconfigurationfileanddraganddroptheconfigurationfileintothefoldernamed"StartUp".
The"StartUp"folderisusuallylocatedinthe"Programs"folderinsidethe"StartMenu"folderinyour"Windows"folder.
Fromthispointon,wheneveryoustartWindows,WinWedgewillautomaticallyloadandactivateitselfwiththeselectedconfigurationfile.
Note:WinWedgecanbeconfiguredtoautomaticallyminimizeitselftothesystemtrayonyourtaskbarthereforeifyouplaceaWinWedgeconfigurationfileinyourStartUpfolderthathasthe"auto-minimizeoptionenabled,allthattheuserwillseeisasmalliconinthesystemtrayafterWinWedgehasbeenlaunchedandactivated.
SeeAlso:ThePreferencesWindow(pg.
42)15TheModeMenuWinWedgecanoperateinoneoftwo"modes"thatcontrolhowitwilltransferincomingdatafromyourserialdevicetoanotherapplicationprogram.
WinWedgecantransferdataeitherbyconvertingthedatatokeystrokesandthensendingthekeystrokesdirectlytoanotherapplicationoritcanuseDynamicDataExchange(DDE)topassdatatoanyapplicationthatsupportsDDE.
ThetwochoicesintheMODEmenu,"SendKeystrokes"and"DDEServer",allowforthetransferofincomingserialdatadirectlyintoanotherrunningWindowsprogram.
Eachofthesetwomodeshasitsownuniqueadvantagesandthechoiceofwhichmodetousedependsgreatlyonwhatyouaretryingtoaccomplishaswellasonthecapabilitiesoftheapplicationprogramthatyouwillbesendingdatato.
Itisextremelyimportantthatyoufullyunderstandthedifferencesbetweenthesetwomodes.
SeeAlso:SendingKeystrokesvs.
DynamicDataExchange(pg.
18).
SendKeystrokesModeIn"SendKeystrokesMode",WinWedgewillconvertincomingserialdatatokeystrokesandthensendthesekeystrokesdirectlytoanyapplicationthatyouspecify.
ThisistheeasiestandmostcommonwaytouseWinWedgewithmostsimpledeviceslikebarcodereaders,electronicbalancesandmeasuringtoolslikecalipers,gagesandmeters.
Whenyouselect"SendKeystrokesTo.
.
.
"fromtheModemenu,awindowwillappearthatletsyouspecifytheapplicationprogramthatyouwantWinWedgetosendthedatato.
WinWedgeispre-configuredtosendkeystrokestotheNOTEPADaccessorythatcomeswithWindowshoweveryouwillprobablywanttochangethistoadifferentapplicationprogram.
Youmayentereithertheapplication'stitlebartext(thetextthatappearsinthetitlebaroftheprogram'smainmenu)oryoumayalsospecifythecommandlineusedtolaunchtheprogram(theapplication'sfullpathnameandEXEfilenamealongwithanycommandlinearguments).
Ifyouspecifyonlythetitlebartext,thentheapplicationmustberunning,eitherminimizedorinawindow,beforeWinWedgecansenditanydata.
Ifyouspecifyonlytheapplication'scommandline,thenWinWedgewillautomaticallylaunchtheapplicationbeforesendingitanydata.
16AfteryouactivateWinWedgein"SendKeystrokes"mode,wheneverdataisreceivedfromyourserialdevice,WinWedgewilltrytosendthedatatotheapplicationthatyouspecify.
ThelogicusedbyWinWedgeistofirstsearchforanapplicationwiththespecifiedtitlebartextandiftheapplicationisalreadyrunning,WinWedgewillactivateitsothatithastheinputfocusbeforesendingkeystrokestoit.
Ifawindowwiththespecifiedtitlebartextisnotfoundorifthetitlebartextisnotspecified,thenWinWedgewilltrytoruntheprogramusingthecommandlinespecified.
Ifthisissuccessful,thenWinWedgewillretrievethetitlebartextfromtheapplicationafteritstartsrunningsothatitcanfindtheapplication'swindowlateron.
Whenspecifyingthetitlebartext,youdonotneedtoenterthecompletetitleandmayuseasubstringofthetext.
Forexample,tosenddatatoMicrosoftExcel,youcanspecifyExcelforthetitlebartextandaslongastherearenootherprogramsrunningthatcontaintheword"Excel"intheirtitlebar,WinWedgeshouldbeabletofindExcel'swindowcorrectly.
Youmayspecifyboththetitlebartextandcommandlineineitherupperorlowercase.
ImportantNote:Ifyoudonotspecifythetitlebartextoracommandline,WinWedgewillsendkeystrokestowhateverapplicationhastheinputfocuswhendataisinputtedfromyourserialdevice.
Inotherwords,WinWedgewillworklikeasecondkeyboard.
YoumayprefertouseWinWedgeinthismannerbecauseitallowsyoutoinputdatawhereverthecursorhappenstobeinwhateverapplicationhasthefocus.
Inthiscase,ifWinWedgeitselfhasthefocuswhendataisinputted,itwilljustdisplaythedatawithouttryingtosendittoanyotherprogram.
TechTip:SomeWindowsprogramsmayhavemorethanonewindowwiththesameTitleBarTextasthemainwindowandthereforeWinWedgemaynotalwaysbeabletofindtherightwindowtosendkeystrokesto.
IfyouexperiencedifficultiesingettingWinWedgetosendkeystrokestoaparticularapplicationprogramevenifyouaresurethatyouspecifiedthecorrectApplicationTitleBarTextorCommandLine,tryclearingoutbothoftheseitems.
AfteryouactivateWinWedge,launchand/orswitchtheinputfocustotheapplicationthatyouwanttoreceivethedataandplacethecursorinthelocationwhereyouwantdataentered.
17DDEServerModeWhenWinWedgeisinDDEServermode,insteadofsendingincomingserialdatatoanotherapplicationaskeystrokes,WinWedgeallowsotherWindowsapplicationsthatsupportDDEtoretrievetheincomingserialdatathroughDDE(DynamicDataExchange)links.
Whenyouselect"DDE(Server)"fromtheModemenu,awindowwillappearpromptingforaDDEApplicationName,aDDETopicandaDDECommand.
Inadditiontosendingtheserialdata,WinWedgecanbeconfiguredtoissueaDDEcommandtoanotherprogramaftereachinputfromaserialdeviceisreceived.
TheDDEcommandistypicallyusedtoforcetheprogramthatisreceivingthedatafromWinWedgetoperformanactionlikerunningamacroorsubroutine.
Forexample,ifyouweretospecifyExcelfortheDDEApplicationName,SystemfortheDDETopicand[RUN("MyMacro")]fortheDDECommand,WinWedgewouldforceExceltorunaVBAsubroutinenamed"MyMacro"aftereachdatarecordisreceivedthroughtheserialportbyWinWedge.
TheinformationthatyousupplyinthiswindowisusedtospecifytheDDECommandProcessorfortheprogramthatwillreceivetheDDEcommandfromWinWedge.
Note:ThisinformationisneededonlyifyouintendtoconfigureWinWedgetosendaDDEcommandtotheapplication,otherwiseitcanbeclearedoutorsimplyleftasis.
SeeAlso:UnderstandingDynamicDataExchange(pg.
56)DDEAndWinWedge(pg.
58)DDEExamples(pg.
63)ThedefaultDDEApplicationNameis"Excel"andthedefaultDDETopicis"System".
ThesearethecorrectparametersforMicrosoftExcel'sDDEcommandprocessor.
TheDDEApplicationNameforMSWordis"WinWord"anditsDDETopicisalso"System".
ForMSAccess,theDDEApplicationNameis"MSAccess"andtheDDETopicisthenameofyouropenAccessdatabase(withoutthefilepathorthe.
MDBfilenameextension).
TofindtheApplicationNameandTopicforanyotherprogram'sDDEcommandprocessor,refertoitsuserdocumentation.
ItiscommonforapplicationsthatsupportDDEcommandstousetheapplication'sexecutablefilename(withouttheEXEextension)asitsDDEApplicationName.
ItisalsotypicaltousetheDDETopic"System".
18SendingKeystrokesvs.
DynamicDataExchangeTheprimaryadvantageofsettingupWinWedgetosendkeystrokestoanotherapplicationratherthanpassingdatausingDDEissimplicity.
Bysendingkeystrokes,nospecialprogrammingisrequiredintheapplicationthatwillreceivethedata.
Forexample,whenreadingdataintoaspreadsheet,acommonrequirementistohavesuccessivereadingsfromadeviceappearinacolumninthespreadsheet.
BysendingkeystrokesyoucouldconfigureWinWedgetosenda"DownArrow"keystrokeaftereachinputfromyourdevicetomovethecursordownonecellandthusbereadyforthenextinputdirectlybelowthepreviousinput.
SeeAlso:SpecifyingPre/PostambleKeystrokes(SendKeystrokesMode)(pg.
33)AdisadvantageofsendingkeystrokesisthattheapplicationthatisreceivingthedatamustbeintheforegroundandhavetheinputfocusbeforeWinWedgecansendanykeystrokestoit,thustruebackgroundprocessingisnotpossiblewhensendingkeystrokes.
SendingkeystrokesfromoneapplicationtoanotherisalsoslightlyslowerthanusingDDE.
DDEontheotherhanddoesnotrequirethereceivingapplicationtohavetheinputfocusthereforealldatatransferscanoccurinthebackgroundwhileyouworkwithotherprogramsintheforeground.
OnedifficultywithDDEisthat"linked"datafromWinWedge(oranyotherDDEServer)isalwaystransferredtothesamelocationintheclientapplication(i.
e.
a"linked"cellinaspreadsheet).
Togetsuccessivedatareadingsintoacolumninaspreadsheetyoumustwriteamacrointhespreadsheetthatrunsautomaticallyaftereachinputisreceived.
ThepurposeofthemacrowouldbetoeitherexplicitlyrequestthedatafromWinWedgeorcopyeachnewdataitemfromalinkedcellandpasteittothebottomofthecolumninyourspreadsheet.
OnewaytoaccomplishthisistohaveWinWedgeissueaDDECommandaftereachinputthatcausesExceltorunamacrothateitherrequeststhedataorcopiesanylinkedDDEdataintoacolumn.
ApowerfulfeatureofDDEisthatapplicationsthatsupportitcansendcommandsdirectlytoeachotherandthusyoucouldfullyautomateadatacollectionprocessbetweenyourapplicationprogramandWinWedge.
Thisrequiresasmallamountofprogramminginyourapplicationbuttheextraeffortallowsyoutocreateextremelysophisticateddeviceinterfaces.
Also,becauseallDDEoperationscanoccurinthebackground,evenwithaminimizedapplication,DDEoperationstypicallyexecutemuchfasterthansendingkeystrokesfromoneapplicationtoanother.
Note:WinWedgedoesnothavetobein"DDEServerMode"inordertoacceptandprocessDDEcommands.
WinWedgewillstillexecuteanyDDEcommandssenttoitevenifitisin"SendKeystrokesMode".
SeeAlso:UnderstandingDynamicDataExchange(pg.
56)DDEExamples(pg.
63)WinWedgeDDECommands(pg.
59)19ThePortMenuThePORTmenuoptionsandtheirfunctionsare:Settings:Displaysawindowwhereyoucanselectallserialcommunicationsparameters,(i.
e.
COMport,baudrate,parity,numberofdatabits,flowcontrol,buffersizes,etc.
)SeeAlso:ThePortSettingsWindow(pg.
20)Analyze:Thisoptiondisplaysawindowthatallowsyoutotestallserialcommunicationsparametersandalsovieworanalyzethestructureandcontentsofdatareceivedfromyourserialinputdevice.
TheAnalyzefeatureisextremelyusefulfortestingthecommunicationslinkbetweenyourPCandyourserialdeviceaswellasfordeterminingthestructureandcontentsofalldatareceivedfromthedevice.
ItishighlyrecommendedthatyouusethisfeaturetotestthecommunicationslinkbetweenWinWedgeandyourserialdevicebeforeactivatingWinWedgefromtheActivateMenu.
SeeAlso:ThePortAnalyzeMenuOption(pg.
21)SeeAlso:DiagnosingSerialCommunicationsProblems:(pg.
86)20ThePortSettingsWindowThePortSettingswindowallowsyoutoselecttheserialcommunicationsparametersrequiredbythedevicethatyouareusing.
AllcommunicationsparametersselectedinthePortSettingswindowmustexactlymatchthesettingsfortheserialdevicethatyouwillbeusing.
Ifyoudonotknowthecorrectsettingsforyourdevice,thenyoushouldcontactitsmanufacturerforthisinformation.
ForgeneralinstructionsonhowtodeterminethecorrectparametersusingthePortAnalyzefeatureofWinWedge,pleaserefertothesection:Troubleshooting(pg.
87)TheBufferSizeoptionsinthePortSettingswindowallowyoutospecifythesizeofthereceiveandtransmitbuffers.
Buffersizevaluesmayrangebetween128and32000bytes.
Thedefaultinputbuffersizeof1024bytesshouldbesufficientformostsimpledevices.
Ifyouneedtoinputlargeramountsofdatawithnoflowcontrol,youmayneedtoincreasetheinputbuffersizetoavoidlosingdata.
TheOutputBufferSizeisrelativelyunimportantandshouldbeleftaloneformostapplications.
Youmayseeaslightperformanceincreaseinapplicationsthattransmitlargeamountsofdataifyouenlargetheoutputbuffersize.
Note:IfyouneedadditionalserialportsforyourPC,TALTechnologiescarriesalineofinexpensive2,4and8portadd-onadapters.
Pleasevisithttp://www.
taltech.
comorcall800-722-6004forinformationandpricing.
IfyoujustneedtoaddasingleserialporttoyourPC,thenoneverysimplewaytodothisistopurchasea"USBtoSerial"adapteratanyofficeorcomputersupplystore.
Theytypicallycostunder$30.
00andtheycomewithadriverthatyoumustinstallsothatthenewportwillberecognizedbyWindows.
USBtoSerialadaptersaretypicallyassignedCOMportnumbersstartingatCOM3orabove.
AfteryouinstalltheUSBtoSerialadapter'sdriverandconnectittoyourPC,youmayneedtolookintheWindowsDeviceManagertofindoutwhatCOMportnumberhasbeenassignedtotheadapter.
21ThePortAnalyzeMenuOptionThisoptionpresentsawindowthatallowsyoutotesttheserialportsettingsthatyouchoseinthePortSettingswindow.
ThePortAnalyzewindowalsoletsyouvieworanalyzedatathatistransmittedfromyourserialdevice.
ThisfeaturecanbeextremelyusefulwhenyouareconfiguringWinWedgeforyourparticularapplication.
IfyouselectthisoptionandtheserialportchoseninthePortSettingswindowexistsandisavailableforuse,thefollowingwindowwillappear:ThetitlebarofthePortAnalyzewindowwillshowthecurrentlyactivecommunicationsparameters(i.
e.
serialport,baudrate,parity,databitsandstopbits).
The"InputData"textboxdisplaysallcharactersreceivedfromyourserialdevice.
AllcharactersareshownusingtheirdisplayableASCIIcharactersincludingcontrolcodes.
(i.
e.
acarriagereturn(ASCII13)shouldappearasamusicalnote,anASCII1willbeahappyface,etc.
)AnASCIIchartisavailabletohelpdecipherthemeaningsofcharactersintheinputbufferandalsotoselectcharacterstobeplacedinthe"Output"textbox.
TodisplaytheASCIIchart,clickthebuttonmarked"ASCIIChart".
DirectlyaboveandtotherightoftheInputBufferisatextboxlabeled"TotalByteCount"thatwillcontainacountofallcharacterscurrentlyintheinputbuffer.
The"ClearInput"buttonisusedtocleartheinputdatatextboxandresetthetotalbytecounttozero.
Note:TheInputDatatextboxcandisplayamaximumof32767charactersatatime.
22AnautomaticanalyzefeatureallowsyoutohaveWinWedgemakeaneducatedguessatthestructureofyourinputdatarecords.
WinWedgecanbeconfiguredtoparseandfilteryourserialdata,howeverinordertohaveitdothis,youwillfirstneedtoknowwhattherecordstructureisforyourdata.
Ifyoupressthe"Analyze"buttonwhilethereisdataintheinputdatatextbox,WinWedgewillofferaguessattherecordstructureandaskyouifyouwouldliketoautomaticallypre-configureitusingtheguessedatrecordstructure.
Note:Thecapabilityoftheautoanalyzefeatureislimitedtorecognizingonlythemostcommonrecordstructuresandthusyoumaynotalwaysbeabletouseittopre-configureWinWedge.
Youareentirelyfreetodefineyourinputrecordstructureinanywaythatyoulike.
SeeAlso:DefiningtheInputDataRecordStructure(pg.
25)UnderstandingTheDataFromYourSerialDevice(pg.
90)Whenviewingdataintheinputdatatextbox,youcanselectportionsofthedatausingyourmouseorthecursorcontrolkeys.
Whenyoudothis,thestartingbytepositionoftheselecteddataintheinputdatatextboxisdisplayednexttothelabel"StartPosition"andthebytecountfortheselecteddataisdisplayednexttothelabel"ByteCount"(locatedinsidetheframelabeled"SelectedText").
Thisfeatureallowsyoutomeasurethelengthsofspecificdatafieldsinyourinputdatarecords.
TocopydatafromtheInputbuffertotheWindowsclipboard,selectthedatathatyouwanttocopythenholdthecontrolkey(Ctrl)downandpresstheInsertkey.
InthecenteroftheAnalyzewindowisacheckboxwiththecaption"ActivatePre-InputCharacterTranslationTable".
Whenthisoptionischecked,alldatareceivedwillbetranslatedusingthe"Pre-InputCharacterTranslationTable"beforebeingdisplayed.
Ifitisnotchecked,thedatathatappearswillbetheexactinputfromyourserialdevicewithnocharactertranslations.
SeeAlso:TranslationTables(pg.
34)Insidetheframewiththecaption"Output"isatextboxandfourbuttonslabeled"ASCIIChart","Send","DTR~"and"Break".
Thetextboxisanoutputbufferwhereyoucanentertextorcontrolcodestobesentouttoyourserialdevice.
Manydevicesallow(orrequire)youtosendthemcommandstringsorcontrolcodestorequestdata.
YoumaytypeandeditdatadirectlyintheOutputtextbox.
YoumayalsoselectspecificcharactersorcontrolcodestobeplacedintheoutputtextboxfromanASCIIchartthatisavailablebypressingthe"ASCIIChart"button.
Totransmitthedataintheoutputtextboxouttheserialport,clickyourmouseonthe"Send"button.
Tocleartheoutputbuffer,selectalltextintheOutputtextboxwithyourmouseorcursorcontrolkeysandpresstheDeletekey.
Thebuttonmarked"DTR~"iscalledtheDataTerminalReadyLineTogglebutton.
Whenthisbuttonispressed,itturnsofftheserialportDTRlineforapprox.
100ms.
Thebuttonmarked"Break"canbeusedtoissueaserialBreaksignal.
ThesebuttonsareprovidedbecausesometypesofserialdevicesinterpretthetogglingoftheDTRlineortheissuingofaBreaksignalasarequestfordata.
23TheDefineMenuTheoptionsintheDEFINEmenuandtheirfunctionsare:InputDataRecordStructureThisoptionpresentsaseriesofwindowsthatallowyoutodefinethestructureoftheinputdatafromyourserialdevice.
ThewindowspresentedalsoallowyoutospecifyhowyouwouldlikeWinWedgetoparseandfiltertheincomingserialdatabeforetransferringittoanotherapplication.
Whenyoudefinetheinputdatarecordstructure,youcanalsoaddadditionaldataorkeystrokestobeissuedfollowingtheinputofeachdatafield.
SeeAlso:DefiningTheInputDataRecordStructure(pg.
25)Pre-InputCharacterTranslationsDisplaysatranslationtablethatallowsyoutotranslateincomingASCIIcharacterstoothercharactersbeforetheyareacteduponbyWinWedge.
ThisisanextremelypowerfulconceptthatallowsagreatdealofflexibilityinthewayincomingdataisparsedorfilteredbyWinWedge.
SeeAlso:TranslationTables(pg.
34)Pre-TransferCharacterTranslationTableDisplaysatranslationtablefortranslatingcharacterstokeystrokeswhenWinWedgeisinSendKeystrokesmodeorfortranslatingcharacterstoothercharacterswhenWinWedgeisinDDEServermode.
Pre-TransfertranslationsareperformedafterWinWedgehasparsedandfilteredanincomingdatarecord,justbeforethedataistransferredtoanotherapplicationprogram.
SeeAlso:TranslationTables(pg.
34)24SerialOutputStringsOpensawindowwhereyoucanpre-definecharacterstringstobetransmittedbacktoyourserialdevicebyWinWedge.
Severaloutputstringsmaybedefinedincludinganacknowledgmentstringaswellasupto20"buttoncontrolled"outputstringsandone"timercontrolled"outputstring.
Theoutputstringsaretypicallyusedtopromptadeviceorcontrolaninstrumentthatsupportstwowaycommunications.
SeeAlso:DefiningSerialOutputStrings(pg.
38)HotKeysandHotKeyActionsThisoptionpresentsawindowwhereyoucandefineupto50differenthotkeysthatcanbeusedtoperformanyofthirteendifferentactionsincludingtransmittingstringsouttheserialport,togglingthestateoftheRTSorDTRserialI/Olinesandenabling,disablingandresettingWinWedge.
SeeAlso:DefiningHotKeysandHotKeyActions(pg.
40)PreferencesAllowsyoutochoosevariouspreferencesincludingoptionsthatcontrolhowtheWinWedgewindowwillappearafteritisactivated.
SeeAlso:ThePreferencesWindow(pg.
42)25DefiningtheInputDataRecordStructureMostserialdevicestransmitdatarecordsinawell-definedstructurewitheachrecordcontainingoneormorepartsorfieldsofdata.
BecauseWinWedgehasnowaytoknowhowthedatafromyourparticulardeviceisstructuredorhowtodeterminewhatpartsofthedataareimportanttoyourapplicationandwhichpartsshouldbeignored,youmustfirstdefinetheseparametersbeforeactivatingWinWedge.
TheInputDataRecordStructureoptioninthe"DEFINE"menuallowsyoutofirstdefinetheoverallrecordstructureofyourdataandthendefinehowWinWedgeshouldparseandfiltertheindividualdatafieldswithineachrecordbeforesendingthedataontoanotherapplication.
ThisoptionalsoprovidesamechanismforaddingadditionaldataorkeystrokestotheserialdatabeforeoraftereachdatafieldissentfromWinWedgetoyourtargetapplicationprogram.
Whendefiningtheinputdatarecordstructure,severalbasicdescriptorsmustbespecifiedstartingwiththeeventsthatdeterminethestartandendofeachdatarecord.
WhenyouselectInputDataRecordStructurefromtheDefinemenu,thefollowingwindowappears:TheStartOfRecordEventTheStartOfRecordEventoptionsspecifytheeventthattriggersWinWedgetostartacceptingcharactersaspartofeachnewdatarecord.
IfyouselectAnyCharacterReceivedasthestartofrecordevent,thefirstcharacterreceivedwillbeconsideredtobethestartofeachrecord.
AllsubsequentcharactersreceivedwillbetreatedaspartoftherecorduntilanEndOfRecordEventoccurs.
TheAlpha/NumericCharReceivedoptioninstructsWinWedgetoignoreallinputdatauntilavalidAlpha/Numericcharacterisreceived(i.
e.
noncontrolcharactersorcharswithASCIIcodesgreaterthan31andlessthan127).
TheNumericCharReceivedoptioncausesWinWedgetowaituntilanumericcharacterisreceived(i.
e.
0123456789.
-).
26TheSpecialCharReceivedoptionallowsyoutospecifywhichcharactersaretosignalthestartofeachnewdatarecord.
Ifyouusethisoption,youmayenteroneormorecharactersinthetextboxnexttothisoption.
Toentercontrolcodesinthetextbox,presstheASCIIChartbuttonandchoosethespecificcharacter(s)fromthedisplayedASCIIChart.
Ifyouentermorethanonecharacter,thereceptionofanyofthecharacterswilltriggerthestartofarecord.
Forexample,ifyouspecify"AB",eitheran"A"ora"B"willsignalthestartofarecord(notthecompletestring"AB").
SeeAlso:Pre-InputCharacterTranslationTable(pg.
34)TheEndOfRecordEventSimilartotheStartOfRecordEvent,theEndOfRecordEventoptionsallowyoutospecifytheeventthatwillsignaltheendofeachinputdatarecord.
WinWedgewillnottransferanydatatoatargetapplicationuntiltheselectedEndOfRecordEventoccurs.
ThereforeyoushouldselecttheEndofRecordEventthatwillalwaysreliablydeterminewheneachdatarecordends.
Ifeachdatarecordisterminatedbyacarriagereturnorcarriagereturnlinefeed,theCarriageReturnorCrLfReceivedoptionshouldbechosen.
Carriagereturnsandlinefeedsarenotremovedautomaticallyifthisoptionischosen.
Ifyoudonotwantthesecharactersaspartofyourdata,usethe"Pre-TransferCharacterTranslationTable"toremovethembytranslatingthemto"Nul".
SeeAlso:TranslationTables(pg.
34)Ifthedatarecordstransmittedbyyourdevicealwaysconsistofafixednumberofbyteswithoneormorefixedlengthdatafields,thentheoptionFixedNumberofBytesReceivedshouldbechosen.
Ifyouchoosethisoption,youwillbepromptedwiththefollowingwindowtoenterthecompleterecordlengthforyourdatarecords.
SeeAlso:Pre-InputCharacterTranslationTable(pg.
34)ThePortAnalyzeMenuOption(pg.
21)27Ifyourincomingserialdataisnotalwaystransmittedasfixedlengthstringsandtherealsoisnospecificcharacterwithinthedatathatcanbeusedtosignaltheendofeachdatarecordbutthedataistransmittedinburstssuchthattherewillalwaysbeasmalltimedelaybetweendatainputs,thenTimeDelayBetweenRecordsshouldbechosen.
Note:Manytypesofbarcodescannerstransmitdatainthismanner.
Ifyouselectthisoption,youwillbepromptedtoentertheminimumamountoftime(in1/18secondincrements)betweenthearrivalofeachnewdatarecord.
Youshouldspecifythesmallesttimedelayvaluepossibletoaccuratelydeterminetheendofaninputdatarecord.
Ifyouspecifytoolargeavalue,thenyouriskthepossibilityoftwoormoreinputsbeinginterpretedasonelonginput.
Thedefaultvalueof3/18ofasecondisalmostalwaysthebestvaluetouseforthetypesofdevicesthatWinWedgeistypicallyusedwith.
TheSpecialCharReceivedEndofRecordEventoptionallowsyoutospecifycharactersthatwillsignaltheendofaninputrecord.
Ifyouchoosethisoption,youmayenteroneormorecharactersinthetextboxnexttothisoption.
Toentercontrolcodesinthistextbox,pressthe"ASCIIChart"buttonandchoosethecharactersfromadisplayedASCIIChart.
Thereceptionofanyofthecharactersenteredwillsignaltheendofaninputdatarecord.
NOTE:Specialcharactersarenotautomaticallyremovedifthisoptionischosen.
Ifyoudonotwantthesecharacterstoappearaspartofyourdata,thenyoucanusethe"Pre-TransferCharacterTranslationTable"toremovethembytranslatingthemto"Nul".
SeeAlso:Pre-TransferCharacterTranslationTable(pg.
36)28IfyouchooseeitherCarriageReturnorCrLfReceived,TimeDelayBetweenRecordsorSpecialCharReceivedastheEndofRecordEvent,youwillalsobepromptedtoselecta"recordstructure"foryourdatafromthefollowingwindow:Thethreepossiblerecordstructuresandtheirmeaningsarelistedbelow:SinglefielddatarecordsThe"Eachdatarecordcontainsasingledatafield"optionmeansthateachentiredatarecordshouldbeconsideredasasingleentitythusnoparsingshouldbeperformedonthedata.
Note:Themaximumlengthforasingledatafieldis32766bytes.
NOTE:Sometypesofserialdevicesproduceanoutputthatmaybetoocomplexortooinconsistenttobeparsedintoasetnumberof"fields"byWinWedge.
Forthesetypesofdevices,itmaybeeasiertodefinetheentireoutputfromthedeviceasasingledatafieldandthenusethecapabilitiesofthetargetapplication(themacrolanguageinExcelforexample)toparsethedatareceivedfromWinWedge.
SeeAlso:UnderstandingtheDataFromYourSerialDevice(pg.
90)Pre-InputCharacterTranslationTable(pg.
34)SendingKeystrokesVs.
DynamicDataExchange(pg.
18)29MultipledelimiteddatafieldsThe"MultipleDelimitedDataFields"recordstructureoptionspecifiesthatyourdatarecordsconsistoftwoormoreuniquefieldsthatshouldbeparsedbasedontheposition(s)ofadelimitercharacterwithineachrecord.
Forexamplethefollowingdatarecordconsistsoffourdatafieldsdelimitedbycommasandwithacarriagereturnlinefeedattheendoftherecord:12345,9090,Value=123,98765Ifyouselectthisoption,youwillbepromptedwiththewindowshownbelowtospecifythedelimitercharacterusedtoseparatedatafieldsandalsoenterthemaximumnumberofdatafieldsthatcouldbecontainedinasingledatarecord.
WinWedgesupportsdatarecordswithupto40datafields.
Ifmorethanthespecifiednumberoffieldsarereceivedforaparticularrecord,theadditionaldataisdiscarded.
Iflessthanthespecifiednumberoffieldsarereceived,theremainingfieldswillbeleftempty.
Note:Ifyouaretryingtointerfaceadevicethatoutputsdatarecordswithmorethan40datafieldsperrecord,thereareseveralmethodsthatyoucanusetoovercomethe40fieldlimitinWinWedge.
WhenWinWedgeisin"SendKeystrokes"mode,onemethodistodefinetherecordstructureas"SingleField"datarecordsandthenusingthe"Pre-TransferTranslationTable"totranslatethedelimitercharacterstocursornavigationkeystrokessuchastheRightArrow,DownArrow,TaborEnterkeys.
Anothermethodinvolvespassingeachdatarecordasasingledatafield(ineither"SendKeystrokes"or"DDEServermodes")andthenusingthemacrolanguageinthetargetapplicationtoparsethedataandputtheindividualdatafieldswhereveryouwouldlikethemtogo.
SeeAlso:DefiningTheInputDataRecordStructure(pg.
25)Overcomingthe40fieldlimitinWinWedge.
(pg.
71)30SpecialConsiderationsRegardingDelimiterCharactersAlldelimitercharacterswillberemovedfromtheinputdataandthuswillnotappearaspartofeachdatafield.
Ifyouchooseaspacecharacterasyourdelimiter,WinWedgewilltreatstringsofconsecutivespacesasasingledelimiter.
Also,ifachosendelimitercharactermatchesacharacterthatsignalstheendofaninputrecord,(forexample,ifyouchooseacarriagereturnasyourdelimitercharacterandyoualsochose"CarriageReturnorCrLfReceived"asyourEndofRecordEvent),WinWedgewilltreatthecharacterasthedelimiteruntilthespecifiednumberofdatafieldshavebeenreceivedafterwhichthenextdelimiter/endofrecordcharacterwillsignaltheendoftherecord.
SeeAlso:DefiningTheInputDataRecordStructure(pg.
25)Forexample,supposeyouhaveadevicethattransmitstwolinesofdatawithacarriagereturnattheendofeachline.
Ifyouspecifythe"EndofRecordEvent"as"CarriageReturnorCrLfReceived"andalsospecifyacarriagereturnasyourdelimiterandthenspecify"2"forthe"MaximumNumberofDataFields",WinWedgewilltreatthedatafromthefirstlineasthefirstdatafieldandthedatafromthesecondlineastheseconddatafield.
SeeAlso:UnderstandingtheDataFromYourSerialDevice(pg.
90)Incaseswhereyourinputdatarecordscontaintwoormoredifferentdelimitercharacters,youcanusethe"Pre-InputCharacterTranslationTable"toconvertalldelimiterstoasinglecharacter.
Forexample,considerthefollowingrecord:Instrument#123,Reading#3=23.
45Normallythisdatarecordwouldbeinterpretedtocontaintwofields:"Instrument#123"and"Reading#3=23.
45",withasinglecommadelimiterbetweenthetwo.
IfyouweretousethePre-InputCharacterTranslationTabletoconvertbothpoundsigns(#)andequalsigns(=)tocommas,thenafterthetranslation,therecordwouldappeartoWinWedgeas:Instrument,123,Reading,3,23.
45Thetranslatedrecordthusnowcontainsfiveindividual,commadelimited,datafields.
SeeAlso:Pre-InputCharacterTranslationTable(pg.
34)ThePortAnalyzeMenuOption(pg.
21)MultiplefixedlengthdatafieldsMultiplefixedlengthdatafieldsshouldbechosenastherecordstructureifyouneedtoparseyourdatarecordsbasedonthelengthofeachdatafield.
Ifyouusethisoption,youwilllaterbeabletospecifytheexactlength(numberofcharacters)containedineachdatafield.
Thisoptionshouldbeusedonlyincaseswhereyoucanalwaysrelyoneachdatafieldtocontainafixednumberofbytes.
Thisoptionisthedefaultifyouchose"FixedNumberofBytesReceived"astheEndofRecordEvent.
SeeAlso:Pre-InputCharacterTranslationTable(pg.
34)31SpecifyingFiltersandFieldLengthsAfteryouspecifytheStartandEndofRecordEventsandchoosethebasicstructureofyourdatarecords,an"InputRecordDefinitionEditor"windowwillappear.
Thiswindowiswhereyouspecifyafiltertobeappliedtoeachdatafieldandtheinputlengthofeachfield.
IfWinWedgeisin"SendKeystrokesMode",thiswindowalsoallowsyoutospecifyarecordPreambleandfieldPostamblesthatconsistofadditionalkeystrokesthatareissuedbeforeoraftereachdatafieldissenttoanotherprogram.
SeeAlso:SpecifyingPre/PostambleKeystrokes(SendKeystrokesMode)(pg.
33)Note:SomeofthecontrolsintheInputRecordDefinitionEditorwindowmaynotbedisplayedormayhavedifferentcaptionsthantheexamplebelowdependingonthechosenrecordstructureandalsodependingontheselecteddatatransfermode.
Thelowerhalfofthewindowiswhereyouspecifyan"InputFilter"tobeappliedtoeachdatafieldinyourinputdatarecordsaswella"FieldPostamble".
Incaseswhereeachdatafieldconsistsofafixednumberofbytes,youmustalsospecifyafield"Length".
Underthelabel"Field"isastatusboxindicatingthenumberofthecurrentdatafieldthatyouaredefiningaFilter,aLengthandaFieldPostamblefor.
Ifyourdatarecordsconsistofmorethanonedatafield,therewillbetwobuttonsmarked"NextField"and"PreviousField"inthewindow.
Thesebuttonsareusedtoscrollforwardandbackwardthroughtheparametersforeachdatafield,(thefirstfieldisField(1);pressingthe"NextField"buttonwilldisplayparametersforField(2),etc.
).
32SelectingFiltersThechoicesforthe"Filter"thatcanbeappliedtoeachdatafieldare;"None","IgnoreThisField",and"NumericDataOnly".
Specifying"None"meansthatnofilteristobeappliedtothedataforthecurrentfield,thusallcharactersaretobeacceptedasreceived.
Ifyouselect"IgnoreThisField",thennodataisacceptedandtheentirefieldisignored.
TheIgnorefilteristhususedtoignoreorremovedatafieldsthatarenotrequiredbyyourapplication.
Specifying"NumericDataOnly"causesallAlphacharactersandcontrolcodestobefilteredoutandonlyallowscharacters:0123456789-.
tobeacceptedasvaliddata.
The"NumericDataOnly"filterisespeciallyusefulwhenreadingnumbersintoaspreadsheet.
Leadingspacesornon-numericcharacterscancausedatatobeinterpretedasalabelinsteadofanumber.
TheNumericfiltercanalsobeusedtoreducethenumberofdatafieldsthatneedtobeparsedaswellasremovetrailingcarriagereturnsandlinefeeds.
Forexample,supposeyouhadadevicethattransmitsthefollowingcommadelimited,carriagereturnterminateddatarecords:X=0123.
45,Y=0321.
22Ifyouareonlyinterestedinthetwonumericvalues,youcoulddefinetherecordstructureas"multipledelimiteddatafields"choosingthecommaasthedelimiterandspecifyingtwoasthemaximumnumberoffieldsandfinallyapplyinga"NumericDataOnly"filtertoeachofthetwodatafields.
Inthiscaseyouwouldendupwiththetwonumericvaluesonlyandtheadditionalcharacters"X=","Y="andthecarriagereturn()wouldberemovedbythenumericfilter.
SpecifyingFieldLengthsThetextboxlabeled"Length"iswhereyouspecifytheexactnumberofdatabytesthatwillbereceivedforaparticularfield.
The"Length"textboxwillonlyappearifyouselectedeither"FixedNumberofBytesReceived"asthe"EndOfRecordEvent"or"MultipleFixedLengthDataFields"astherecordstructure.
Thefieldlengththusspecifiestheexactnumberofbytesineachdatafieldintheinputrecord.
Fieldlengthsmayrangefrom1to32766bytes.
Forfixedlengthdatarecords,thesumtotalofallfieldlengthsenteredshouldequalthetotallengthofeachinputdatarecord.
SeeAlso:Pre-InputCharacterTranslationTable(pg.
34)InthemiddletowardtherightsideoftheInputRecordDefinitionEditor(labeled"BytesDefined")aretwostatusboxesthatdisplaythetotalofallspecifiedfieldlengthsaswellasthetotalrecordlengthofyourdatarecords(specifiedearlierforfixedlengthrecords).
Thisinformationisonlyvisiblewhentheendofrecordeventissetto"FixedNumberofBytesReceived".
33SpecifyingPre/PostambleKeystrokes(SendKeystrokesMode)WhenWinWedgeisinSendKeystrokesMode,theinputRecordDefinitionEditorwillhaveatextboxmarked"RecordPreambleKeystrokes"intheupperhalfofthewindow.
Also,foreachdatafieldthatyouhavedefined,youmayenterasequenceof"FieldPostambleKeystrokes".
PreambleandPostamblekeystrokesareadditionalkeystrokesthatyouwouldlikeissuedbeforeoraftereachdatafieldissenttoanotherWindowsapplication.
Theyaretypicallyusedtocontrolthereceivingapplicationorsendcursornavigationkeystrokesbeforeoraftereachdatafieldsothattheserialdataendsupwhereitissupposedtogo.
The"RecordPreambleKeystrokes"arekeystrokesthatyouwouldlikeissuedimmediatelybeforethefirstdatafieldfromyourserialdeviceistransferredtoyourapplicationprogram.
Forexample,thepreamblekeystrokescouldbeusedtomovethecursortoaspecificlocationinthetargetapplicationjustbeforeanydataistransferredtoit.
The"FieldPostambleKeystrokes"areissuedimmediatelyfollowingthedataforeachparticulardatafield.
FieldPostamblekeystrokesareusuallyusedtonavigatearoundintheapplicationthatisreceivingthedata.
Forexample,ifyouarereadingdatafromadeviceintoaspreadsheetandyouwantsuccessivereadingsenteredinasinglecolumn,youcouldissueafieldpostamblekeystrokeconsistingofa{DOWN}arrow.
Thiswouldcausethecursortomovetothenextcelldowninthespreadsheetaftereachinputfromthedevice.
YoudefineRecordPreambleandFieldPostamblekeystrokestomimicthekeysyouwouldpressifyouweretypingthedatamanuallyonthekeyboardWhenspecifyingRecordPreambleandFieldPostamblekeystrokes,youmustfollowtherulesoutlinedinthesection:KeystrokeMacroRules(pg.
50)ThebuttonmarkedKeystrokeListallowsyoutoselectindividualkeystrokesfromalistwhileeditingpreambleorpostamblekeystrokes.
AllkeystrokesinthelistconformtotheproperKeystrokeMacroRules.
PreambleandPostambleKeystrokemacrosmayalsocontainspecialdateand/ortimestamps.
SeeAlso:DateandTimeStampsInMacros(pg.
51)34TranslationTablesWinWedgeprovidestwotranslationtables;aPre-InputCharacterTranslationTableandaPreTransferCharacterTranslationTable.
Thetwotranslationtablesallowyoutotranslatecharactersreceivedfromyourserialdeviceattwodifferentpoints,beforethedataisacteduponbyWinWedge,andjustbeforedataistransferredtoanotherapplicationprogram-afterthedatahasbeenparsedandfiltered.
Pre-InputCharacterTranslationTableThePre-InputCharacterTranslationTableallowsyoutotranslateincomingASCIIcharacterstootherASCIIcharactersbeforetheyareacteduponbyWinWedge.
ThisisanextremelypowerfulconceptbecauseitcandramaticallyaltertheoperationofWinWedgeaswellasthewayinwhichyouthinkaboutyourserialdatawhenyouconfigureWinWedge.
Forexample,supposethatyourserialdevicetransmitteddatarecordscontainingmultipledelimiteddatafieldsbutsomeofthefieldsweredelimitedwithcommasandothersweredelimitedwithsemi-colons.
InthiscaseyoucouldusethePre-InputCharacterTranslationTabletotranslatesemi-colonstocommasandthendefinethe"RecordStructure"inWinWedgeas"MultipleDelimitedDataFields"choosingthecommaasthedelimiter.
InthiscaseWinWedgewouldactonallsemi-colonsasiftheywerecommadelimiters.
SeeAlso:SpecialConsiderationsRegardingDelimiterCharacters(pg.
30)YoucanalsousethePre-InputTranslationTabletostripoutspecificcharactersfromtheserialdataorevenremoveanentiredatarecordifitcontainsaspecificcharacter.
IfyouselectPre-InputCharacterTranslationTablefromtheDefinemenu,thefollowingwindowcontainingthetranslationtablewillappear:35ThetranslationtableshowstheASCIIvaluesforallpossiblecharactersaswellastheircorrespondingANSIcharacters,ASCIIcontrolcodemnemonicsandthecurrenttranslationforeachcharacter.
Totranslatecharacters,highlightthecharacterthatyouneedtotranslateandclickthe"Translate"button.
ThiswillcausethefollowingASCIICharttobedisplayedwhereyoucanselectaspecifictranslation.
The"ResetAll"buttoninthetranslationtablecausesalltranslationstoreverttotheirdefaultsettings.
Thefirsttwochoices"Ignore"&"VoidRecord"intheASCIIChartdonotrepresentactualcharactersbutinsteadhavespecialmeaningswhenselected.
"Ignore"causesthetranslatedcharactertobeignoredbyWinWedge.
Whenacharactertranslatedto"Ignore"isreceived,itwillbediscardedandthusitwillnotappearintheinputdata.
Also,becausethecharacterisbeingignored,itspresenceisnotcountedwhenreadingdataintoafixedlengthrecordorafixedlengthdatafield.
Thus,"Ignore"removesthecharacterfromtheinputdatabeforeitreachesWinWedge.
"VoidRecord"causesWinWedgetoinvalidatetheentirecurrentdatarecord.
Ifacharacterthathasbeentranslatedto"VoidRecord"ispresentanywhereinaninputdatarecord,theentirerecordiscompletelyignoredandwillnotbetransferredtoanotherapplicationprogramordiskfile.
Thisfeaturecanbeusefulinsituationswhereyouwouldliketorejectcertaindatarecordsfromadevice.
Forexample,supposeyouhadadevicethatalwaystransmittedaspecial"initializationrecord"eachtimethedeviceisturnedon.
Iftheinitializationrecordcontainedanycharacterthatwouldneverappearinanyfollowingrecord,youcouldusethe"VoidRecord"translationtoremovetheunwantedinitializationrecord.
36Pre-TransferCharacterTranslationTableThePre-TransferCharacterTranslationTableisusedtotranslatecharactersafterWinWedgehasparsed,filteredandformattedyourdata;i.
e.
justbeforethedataissenttoanotherapplicationprogram.
The"Pre-TransferTranslationTable"isalmostidenticaltothe"Pre-InputCharacterTranslationTable"exceptthatthistranslationtablewillworkdifferentlydependingonthecurrentoutputmodethatWinWedgeissetfor(i.
e.
"SendKeystrokes"or"DDEServer"Mode).
IfWinWedgeisin"SendKeystrokesMode",thenthistranslationtableisusedtoconvertindividualcharacterstospecifickeystrokes.
SerialdataconsistsofASCIIcharacters.
BecausemanyASCIIcharactersdonotcorrespondtoaspecifickeystroke,thePre-TransferCharacterTranslationTableprovidesawaytomapcharacterstospecifickeystrokes.
Totranslatecharacters,highlightthecharacterthatyouneedtotranslateandthenclickthe"Translate"button.
Thiswilldisplaythefollowing"KeystrokeSelection"windowthatallowsyoutochooseaspecifickeystrokeorkeycombination.
ThekeystrokeselectionwindowcontainsalistofallkeystrokesaswellasthreecheckboxesthatallowyoutoindicatetheShift,Ctrl,andAlttogglekeystatestobeusedinconjunctionwiththeselectedkeystroke.
Thefirstiteminthekeystrokelist,"NUL",doesnotrepresentanactualkeystrokebutinsteadisusedtoremoveunwantedcharacterssuchascarriagereturnsandcontrolcodesorothercharactersbeforedataissenttoanotherapplicationprogram.
37IfWinWedgeisin"DDEServerMode"thenthePre-TransferCharacterTranslationTablewillappearasshownbelow.
ThistranslationtableallowsyoutotranslatecharacterstootherASCIIcharacters.
Whenyouclickonthe"Translate"buttontotranslateacharacter,thefollowingASCIIChartwillappearallowingyoutotranslatetheselectedcharactertoanotherASCIIcharacter.
ThisASCIIChartissimilartotheonedisplayedforthePre-InputTranslationTableexceptthatitdoesnothavean"Ignore"or"VoidRecord"entry.
NOTE:WhenusingWinWedgeinDDEServerMode,characterstranslatedto"Nul"inthePre-TransferCharacterTranslationTablewillberemovedfromtheoutputteddata.
TranslatingcharacterstoNULcanthusbeusedtoremoveunwantedcharacters.
38DefiningSerialOutputStringsSelecting"OutputStrings"fromtheDefinemenuopensthewindowshownbelowwhereyoumaydefineanacknowledgmentstring,atimercontrolledoutputstringandupto20buttoncontrolledoutputstringsthatcanbesenttoyourserialdevicewhileWinWedgeisactive.
TheAcknowledgmentStringisacharacterstringthatisautomaticallysentouttheserialportaftereachcompletedatarecordisreceivedfromyourserialdevice.
ThecapabilitytosendanAcknowledgmentstringwasoriginallyintendedforthosedevicesthatrequireanacknowledgment(anACKcharacterforexample)butitcouldalsobeusedasawaytocontinuallyrequestdatafromadevicethatcanbepolledbysendingitacharacterstring.
ATimerControlledOutputStringmayalsobedefinedthatisautomaticallytransmittedatregularintervals.
Thetimerintervalvaluemayrangefrom50to99,999,999milliseconds(i.
e.
1/20thofasecondtoonceevery27hours).
AcheckboxalsoallowsyoutospecifyiftimedautomaticoutputsareinitiallyenabledassoonasyouactivateWinWedge.
Ifatimercontrolledoutputstringisdefined,amenuitemintheWinWedgewindow(displayedafterWinWedgeisactivated)willallowyoutoenableordisableTimedAutomaticOutputs.
Youcanalsodefinehotkeysthatcanbeusedtoenableanddisablethesendingofthetimercontrolledoutputstring.
SeeAlso:DefiningHotKeysandHotKeyActions(pg.
40)39InthebottomoftheOutputStringEditorwindow,youmayalsodefineupto20"ButtonControlledOutputStrings"(referencedas"String1"through"String20")thatareeachassociatedwitha"button"intheWinWedgewindowafteryouactivateWinWedge.
ClickingyourmouseonanoutputstringbuttonintheWinWedgewindowcausesthestringtobesentouttheserialporttoyourdevice.
Whendefiningbuttoncontrolledoutputstringsyoumayalsospecifya"ButtonCaption"foreachbuttontoremindyouofitscontentsorpurpose.
Forexample,manyelectronicbalancescanbepromptedtotransmitaweightreadingbysendingthemacertainpromptstring.
ForaSartoriusbalancethepromptisanEscapecharacter(ASCII27)followedbyacapitalP.
ForaMettlerbalancethepromptisacapitalSfollowedbyacarriagereturn(ASCII13)andalinefeed(ASCII10).
Forthissituation,youcoulddefineabuttoncontrolledoutputstringcontainingtherequiredpromptcharactersandalsodefineitsbuttoncaptionas"SendData".
Thenwheneveryouclickyourmouseonthebuttonwiththecaption"SendData"intheWinWedgewindow,thepromptstringwouldbesenttothescalecausingittosendbackaweightreading.
Whendefiningacaptionforabuttonyoucanassignanaccesskeytothebuttonbyincludinganampersand(&)inthecaptionimmediatelyprecedingthecharacteryouwanttobeusedastheaccesskey.
ThischaracterwillappearunderlinedinthebuttoncaptionwhenWinWedgeisactivated.
PressingtheunderlinedcharacterincombinationwiththeAltkeywhileWinWedgeisactiveandhastheinputfocushasthesameeffectasclickingyourmouseonthebutton.
Forexample,specifying"&SendData"forabuttoncaptionwouldcausethebuttontoappearasbelowwithAlt+Sbeingtheaccesskey.
SeeAlso:DefiningHotKeysandHotKeyActions(pg.
40)WheneditinganyoftheoutputstringsintheOutputStringEditorwindow,anASCIIchartisavailablesothatyoucanselectASCIIcharactersorcontrolcodesthatcannotbeenteredonyourkeyboard.
Forexample,toenteraspecificASCIIcharacterinanoutputstring,movethecursortothepointintheoutputstringwhereyouwouldlikethecharactertogoandthenclickyourmouseonthebuttonmarked"ASCIIChart".
WhentheASCIIchartappears,scrolldownthelistuntilthecharacterthatyouwantishighlightedandclicktheOKbuttonintheASCIIchart.
Thecharacterwillappearwherethecursorisintheoutputstring.
40DefiningHotKeysandHotKeyActionsWinWedgeallowsyoutodefineupto50hotkeysthatcanbeusedtocontrolseveralserialI/OfunctionsandalsocontroltheoperationofWinWedge.
Whenyouselect"HotKeysandHotKeyActions"fromtheDefinemenuthefollowingwindowwillbedisplayed.
Eachhotkeythatyoucandefinehasanumberfromoneto50andyoucanselectaparticularhotkeybychoosingitshotkeynumberfromthelistboxwiththecaption"HotKey".
SelectingHotKeyActionsYoudefineahotkeybyfirstselectingaHotKeyActionfromthelistofavailableactionsandthenyouspecifythekeystrokethatwillbeusedtoinvoketheaction.
WinWedgesupportsthefollowing13hotkeyactions:HotKeyActionMeaning1.
TransmitStringTransmitsacharacterstringouttheserialportWhenyouselect"TransmitString",atextinputboxwillappearinthebottomofthewindowwiththecaption"OutputString".
Thisiswhereyouenterthecharacterstringthatyouwanttransmittedouttheserialportwhenthehotkeyispressed.
Wheneditingtheoutputstring,abuttonwiththecaption"ASCIIChart.
.
.
"willalsoappearinthewindowsothatyoucanchoosecontrolcodes(orASCIIcharactersthatcannotbetypedonyourkeyboard)thatyouwanttoplaceintheoutputstring.
2.
IssueBREAKSignalIssuesaserialBREAKsignal3.
ToggleDTRfor100msTogglestheserialportDTRlinefor100ms4.
EnableTimerEnablestimercontrolledoutputs5.
DisableTimerDisablestimercontrolledoutputsSeeAlso:DefiningSerialOutputStrings(pg.
38)6.
RaiseDTRRaisestheserialportDTRline7.
LowerDTRLowerstheserialportDTRline8.
RaiseRTSRaisestheserialportRTSline9.
LowerRTSLowerstheserialportRTSline4110.
ResetWinWedgeResetsWinWedgeWhenyouperformareset,theserialinputbufferisflushedandWinWedgeisresettothestateitwasinwhenitwasfirstactivated.
SeeAlso:ActivatingWinWedge(pg.
44)11.
SuspendWinWedgeSuspendsWinWedgeWhilesuspended,WinWedgecontinuestocollectserialdataandstoreittoaserialinputbufferhoweverthedatawillnotbetransferredtoanotherprogramuntilyouresumeWinWedge.
12.
ResumeWinWedgeResumesWinWedgeifitiscurrentlysuspended13.
Resumefor1DataRecordResumesWinWedgeforasingledatarecordonlyIfWinWedgeissuspendedandyouresumeitforonedatarecord,thenextdatarecordavailableintheserialreceivebufferwillbeprocessedafterwhichWinWedgewillautomaticallysuspenditselfagain.
TheResumefor1DataRecordactionthusallowsagreaterdegreeofcontroloverwhereandwhendataisenteredintoanapplicationbecauseitletsyouacceptdataspecificallywhenyouarereadytoreceiveit.
SelectingHotKeyKeystrokesToselectahotkeykeystrokethatwillinvokeaparticularhotkeyaction,placethecursorinthetextboxlabeled"HotKeyKeystroke"andthenpressthekeyorkeycombinationthatyouwanttouse.
Adescriptionofthekeystrokewillappearinthetextboxafteryoupressit.
Whenthecursorisinthe"HotKeyKeystroke"textbox,abuttonwillalsoappearwiththecaption"KeystrokeList.
.
.
".
Clickingthisbuttonpopsopenalistboxsothatyoucanchooseyourhotkeykeystrokefromthelist.
Notes:HotkeysdefinedinWinWedgearesystemwidehotkeysandthusarealwaysdetectedbyWinWedgenomatterwhatapplicationhastheinputfocus.
AllhotkeykeystrokesarealsodiscardedaftertheyaredetectedbyWinWedgeandthusarenotpassedthroughtotheapplicationyouareworkinginwhenyoupressthehotkey.
Itisalsopossibletodefinemultiplehotkeyactionsforthesamehotkeykeystrokehoweverifyoudothis,onlythehotkeyactionwithlowesthotkeynumberwillbeinvoked.
TechTip:WhenusingWinWedgein"SendKeystrokes"mode,itispossibleforWinWedgetosenditselfhotkeykeystrokes.
ThisinterestingsideeffectcouldbetakenadvantageoftocauseWinWedgetosuspendorresetitselfifacertaincharacterisreceived.
(UsethePre-TransferCharacterTranslationTabletotranslatethecharactertoahotkeykeystrokewhoseactionistosuspendorresetWinWedge).
YoucouldalsocontinuouslypollaninstrumentbyhavingWinWedgeissuea"FieldPostambleKeystrokeMacro"thatcontainsahotkeythatinvokesthe"TransmitString"action.
42ThePreferencesWindowWhenyouselectthePreferencesoptionfromtheDefinemenu,thefollowingwindowwillappear.
TheBeepOnInputoptioninstructsWinWedgetobeepyourPC'sspeakerwhendatahasbeenreceivedandisabouttobetransferredtoyourapplication.
TheMinimizeOnActivationoptioncausesWinWedgetorunminimizedorasaniconwhenactivated.
WhenWinWedgeisminimized,itsiconwillappearinthesystemtrayonyourWindowstaskbar.
ToopentheWinWedgewindowafterithasbeenminimized,rightclickontheWinWedgeiconinthesystemtrayandselecttheoption"OpenWinWedge"fromthemenuthatappears.
TheActivateInitiallySuspendedoptioncausesWinWedgetobesuspendedwhenitisinitiallyactivated.
WhenWinWedgeissuspended,itwillstillcollectserialdataandstoreitinabufferuntilyouresumeWinWedgeeitherbyselectinga"resume"optionfromtheactivatedWinWedge'smenuorbypressingahotkeyorissuingaDDEcommandtoWinWedgethatcausesittoresumeitsoperation.
TheDisplayWinWedgeWindowAlwaysOnTopoptioncausestheWinWedgewindowtoalwaysbedisplayedontopofallotherwindowsafteryouactivateit.
HavingtheWinWedgewindowalwaysontopofotherWindowscanmakeiteasiertoclickonanybuttonsintheWinWedgewindowandalsotoviewthedatathatWinWedgeisreceiving.
43TheDisplayDTRToggleButtonoptioncausesabuttontoappearintheWinWedgeWindowwiththecaption"DTR~".
ThisbuttonisusedtotoggletheserialportDataTerminalReadylinefor100ms.
Thisactionisinterpretedbycertaintypesofserialdevicesasarequesttotransmitadatarecord.
TheDisplayBreakButtonoptioncausesabuttontoappearintheWinWedgeWindowwiththecaption"BREAK".
ThisbuttonisusedtoissueaserialBREAKsignal.
CertaintypesofserialinstrumentsusetheBreaksignalasarequesttoeithertransmitadatarecordorperformaresetfunction.
Forexample,mostmodemswillhangupandresetthemselvesifaBREAKsignalisissuedtothem.
TheDisplayDate/TimeoptionturnsonandoffaDate/TimedisplayintheWinWedgeWindow.
Ifyouenablethisoption,youwillalsobepromptedtoenteraformatexpressionforthedisplayedDateandorTimeusingformattingcharactersdescribedinthesection:FormattingDate/TimeExpressions(pg.
52).
WhenWinWedgeisactivatedwiththeDate/Timedisplayenabled,atextboxwillappearintheWinWedgeWindowthatcontainstheDateorTimeformattedusingtheexpressionthatyouspecify.
Ifnoformattingexpressionisspecified,adefaultof"mm/dd/yyhh:nn:ssAM/PM"isused.
ThepurposeoftheDate/TimedisplayistoprovidearealtimeclockthatcanbelinkedviaDDEtootherWindowsprograms.
TheDDEApplicationnamefortheDate/TimedisplayisWinWedgetheDDETopicisCOMnwherenistheserialport(1-16)thatWinWedgeiscurrentlyactivatedfor,andtheDDEItemnameisDATETIME.
44TheActivateMenuThe"Activate"menucontainstheentries,"TestMode","NormalMode"and"VirtualInstrumentMode"thatareusedtoactivateWinWedgeandstartitworking.
WinWedgemustbeactivatedusingoneoftheseoptionsbeforeitwillactuallyperformanyserialI/Ofunctionsortransmitdatatoanapplicationprogram.
Thesethreeoptionsandthedifferencesbetweenthemaredescribedindetailbelow.
ActivatingWinWedgeinTestModeorNormalModeWinWedgewillnotacceptanyserialdatauntilitisactivatedbyselectingeither"TestMode"or"NormalMode"fromtheActivatemenu.
ThedifferencebetweenthetwomodesisthatwhenyouactivateWinWedgein"TestMode",youwillbeabletoreturntotheWinWedgemainmenuandedityourconfigurationparameters.
TestmodeshouldalwaysbeselectedwhenyouarefirstconfiguringWinWedgeforusewithaparticularapplicationandaparticularserialdevice.
Untilyouhaveeverythingworkingproperly,youwillfinditmucheasiertoactivateWinWedgeinTestmode.
IfyouactivateWinWedgein"NormalMode",youwillnotbeabletogobackandeditanyconfigurationparameterswithoutquittingWinWedgeandthenrestartingitandreloadingyourconfigurationfile.
WhenyouactivateWinWedgein"NormalMode",itsmainmenuandallsubmenus,windows,andsetupcodeareunloadedfrommemoryinordertoconservesystemresources.
Thishelpsfreeupsystemmemoryandotherresourcesthatmaybeneededbyotherapplicationprogramsanditalsoimprovesoverallsystemperformance.
45TheWinWedgeWindowWhenyouactivateWinWedgeineitherTestorNormalmode,themainmenuwilldisappearandawindowsimilartotheonebelowwillappear.
Thiswindowiscalledthe"WinWedgeWindow".
ThetitlebaroftheWinWedgeWindowwillindicatetheserialportthatitiscurrentlyconfiguredfor.
ThemenubarintheWinWedgeWindowcontainstheentries,Edit,QuitandAbout.
Thenumberof"InputDataFields"(thetextboxesunderthelabel"InputField(s)")and"SerialOutputButtons"(thecolumnofbuttonsontheleftsideofthewindow)thatwillbevisibleintheWinWedgewindowdependsonhowmanywerepreviouslydefinedwhenyouconfiguredWinWedge.
SeeAlso:DefiningSerialOutputStrings(pg.
38)Thebuttonwiththecaption"DTR~"iscalledthe"DataTerminalReadyLineToggleButton".
Thisbuttonwillappearonlyifthe"DisplayDTRToggleButton"optionisselectedinthePreferenceswindow.
PressingthisbuttoncausestheserialportDataTerminalReadyLinetobetoggledfrom"on"to"off"forapprox.
100ms.
Thisactionisinterpretedbycertaintypesofserialdevicesasarequestfordata.
SimilartotheDTRtogglebutton,the"Break"buttoncanbeusedtoissueaBREAKsignaltoadevice.
The"Record#"textboxwilldisplayacountofthetotalnumberofinputdatarecordsthathavebeenprocessedsinceWinWedgewasactivated.
TheRecord#valueisstoredasadoubleprecisionnumberwhichmeansthatitsvaluecangoashighastenraisedtothe300thpower.
(Ifyouweretoinputdataatarateof10recordspersecond,itwouldtakeseveralhundredyearsbeforetheRecord#wouldreachitsmaximumvalue.
)Note:TheWinWedgeWindowcanbeminimizedwithoutaffectingitsoperation.
TheonlydisadvantageofminimizingtheWinWedgeWindowisthatyoumustre-openitinordertopressanyoutputstringbuttonsthatyoumayhavedefined.
IfyouwanttorunWinWedgeminimizedandstillbeabletosenddataouttheserialport,youwouldhavetouseotherfeaturesinWinWedgesuchasHotKeys(pg.
40)orDDECommands(pg.
59)totransmitdataouttheserialport.
46TheEditMenuTheEditmenucontainsasingleCopyentry.
TheCopycommandallowsyoutocopythecontentsofoneofyourinputdatafields,therecordnumberorthedate/timedisplayintotheWindowsclipboard.
Tousethisfeature,clickyourmouseinthetextboxthatyouwanttocopyandselect"Copy"fromthemenu.
AnydatacopiedfromWinWedgecanbeeitherPastedorPasteLinkedtootherWindowsapplications.
SeeAlso:EstablishingDDELinksUsingtheWindowsClipboard(pg.
57)47TheQuitMenuTheQuitmenuprovidesthreemainchoices,"Suspend","Reset"and"Quit".
Ifatimercontrolledoutputstringwasdefined,afourthoption"Enable/DisableTimedOutput"willalsoappear.
SeeAlso:DefiningSerialOutputStrings(pg.
38)Selecting"Suspend"suspendstheoperationofWinWedgeandchangestheSuspendmenuitemto"Resume"(whichallowsyoutoresumeWinWedge).
WhileWinWedgeissuspended,thetitlebarwillcontainanSinparentheses(S)toremindyouthatWinWedgeiscurrentlysuspended.
WhenWinWedgeissuspended,therewillalsobeanadditionalQuitmenuoptionwiththecaption"ResumeForOneRecord"thatallowsyoutoresumeWinWedgeforasingledatarecordafterwhichWinWedgewillbeautomaticallyre-suspended.
Thisfeatureallowsyoutopullindataonerecordatatime.
SeeAlso:DefiningHotKeysandHotKeyActions(pg.
40)WinWedgeDDECommands(pg.
59)IfyouselectResetfromtheQuitmenu,WinWedgewillflushitsserialreceivebufferandalsoresetallinternalvariablestotheirdefaultvalues.
ThishasthesameeffectasquittingandthenreactivatingWinWedge.
IfyouquitWinWedgeafteractivatingitin"TestMode",youwillbereturnedtothemainmenu.
IfWinWedgewasoriginallyactivatedin"NormalMode",WinWedgewillquitrunningaltogether.
SeeAlso:ActivatingWinWedgeAutomaticallyWithASpecificConfigurationFile(pg.
14)TheEnable/(Disable)TimedOutputoptionisusedtoturnonandoffanyautomatictimercontrolledoutputstringthathasbeendefined.
IfatimercontrolledoutputhasbeendefinedandiscurrentlyEnabled,thenthisitemwillhavethecaption"DisableTimedOutput".
Likewise,ifthetimercontrolledoutputstringiscurrentlyDisabled,thisitemwillhavethecaption"EnableTimedOutput"thusallowingyoutore-enableit.
SeeAlso:DefiningSerialOutputStrings(pg.
38)48ActivatingWinWedgeinVirtualInstrumentModeWhenyouactivateWinWedgein"VirtualInstrumentmode",itwillbehaveexactlyasitdoeswhenyouactivateitin"TestMode"exceptthatinsteadofcommunicatingwithaphysicalinstrumentconnectedtooneoftheserialportsonyourPC,anadditionalwindowcalleda"virtualserialdevice"windowwillappearonyourscreen.
ThevirtualserialdevicewindowallowsyoutotestthefunctionalityofWinWedgewithoutrequiringanyrealhardwaredevicetobeconnectedtoaserialportonyourPC.
Thewindowhasan"InputBuffer"thatwilldisplayanydatathatwouldnormallybetransmittedfromWinWedgeoutaserialportanditalsoprovidesan"OutputBuffer"whereyoucanenterandsenddatatoWinWedgetosimulatedatathatnormallywouldbereceivedfromadeviceconnectedtoanactualserialport.
ThevirtualserialdevicewindowthusallowsyoutestthefunctionalityofWinWedgewithoutrequiringanactualinstrumentordevicetobeconnectedtoyourPC.
Tosimulateadevice,entersometypicaldatainthe"OutputBuffer"andclickonthebuttonmarked"Send".
Thiswilltransmitthedatafromthe"OutputBuffer"toWinWedgejustasifitwerebeingtransmittedthroughaserialport.
ToentercontrolcodesorothercharactersthatcannotbetypedonyourkeyboardintotheOutputtextbox,anASCIIchartisavailablebyclickingthebuttonmarked"ASCIIChart".
AnydatathatistransmittedfromWinWedgewillappearintheInputBuffer.
Thebuttonmarked"ClearInput"isusedtoclearoutthecontentsoftheInputBuffertextboxandthebuttonmarked"Quit"willreturnyoutothemainmenuofWinWedge.
Note:WhenyousenddatatoWinWedgefromtheVirtualSerialDevicewindow(andfromarealinstrument),WinWedgewillnotdoanythingwiththedatauntilthespecified"EndofRecordEvent"occurs.
Forexample,ifyouspecifiedthe"EndofRecordEvent"asacarriagereturnoraspecialcharacterreceived,youshouldincludethesecharactersinanydatathatyoutransmittoWinWedgefromtheVirtualSerialDevicewindow.
Youcanenteracarriagereturn-linefeedpair(ASCII13&ASCII10)intheOutputtextboxbypressingtheEnterkeyoryoucanselectthesecharactersfromtheASCIIchart.
SeeAlso:DefiningtheInputDataRecordStructure(pg.
25)49AccessingOn-LineHelpOn-LinehelpisavailablefromthemainmenuofWinWedgebyselectingtheHelpmenuitem"Index".
ThisoptionwillaccesstheWindowshelpsystemanddisplayanindexofavailablehelptopicsforWinWedge.
On-Linehelpisonlyavailablefromthemain(setup)menuandcannotbeaccessedafterWinWedgehasbeenactivated.
ContextsensitivehelpisalsoavailablebypressingfunctionkeyF1.
Ifyouselectthe"TALontheWeb"optionandyourPCisconnectedtotheInternetandyouhaveawebbrowserinstalled,yourwebbrowserwillopentotheTALTechnologieswebsite(http://www.
taltech.
com).
ThiswebsitecontainsagreatdealofadditionalinformationabouttheWinWedgeproductlineaswellasanexcellenttechnicalsupportsectionwhereyoucanreceiveadditionalhelpandanswerstocommontechnicalsupportquestionsrelatingtoWinWedge.
Selectingthesubmenuitem"About"willdisplayacopyrightnotice.
50KeystrokeMacroRulesWhenediting"RecordPreamble"or"FieldPostamble"keystrokemacroswithWinWedgein"SendKeystrokesMode",tospecifyasinglekeyboardcharacter,usethecharacteritself.
Forexample,torepresenttheletterA,typean"A".
Ifyouwanttorepresentmorethanonecharacter,appendeachcharactertotheonebefore.
Torepresentthelettersa,b,andc,simplyenter:abc.
Theplussign(+),caret(^),percentsign(%),tilde(~)parentheses()andsquarebrackets[]havespecialmeaningstoWinWedge.
Tospecifyoneofthesespecialcharacters,enclosethecharacterinsidecurlybraces.
Forexample,tospecifytheplussign,use{+}.
Tosendcurlybracecharacters,use"{{}"and"{}}",respectively.
Tospecifycharactersthatarenotdisplayedwhenyoupressakey(suchasEnterorTab)andotherkeysthatrepresentactionsratherthancharacters,usethecodesinthetablebelow:KeyCodeKeyCodeBackspace{BACKSPACE},{BS}or{BKSP}Tab{TAB}Break{BREAK}Up{UP}CapsLock{CAPSLOCK}F1{F1}Clear{CLEAR}F2{F2}Delete{DELETE}or{DEL}F3{F3}Down{DOWN}F4{F4}End{END}F5{F5}Enter{ENTER}or~F6{F6}Escape{ESCAPE}or{ESC}F7{F7}Help{HELP}F8{F8}Home{HOME}F9{F9}Insert{INSERT}F10{F10}Left{LEFT}F11{F11}NumLock{NUMLOCK}F12{F12}PageDown{PGDN}F13{F13}PageUp{PGUP}F14{F14}PrtScrn{PRTSC}F15{F15)Right{RIGHT}F16{F16}ScrollLock{SCROLLLOCK}TospecifykeyscombinedwithanycombinationofShift,Control,andAlt,precedetheregularkeycodewithoneormoreofthesecodes:KeyCodeShift+Control^Alt%TospecifythatShift,Control,and/orAltshouldbehelddownwhileseveralkeysarepressed,enclosethekeysinparentheses.
Forexample,toholdtheShiftkeywhilepressingEthenC,use"+(EC)".
ToholddownShiftwhilepressingE,followedbyCwithouttheShiftkey,use"+EC".
Tospecifyrepeatingkeys,usetheform{keynumber}wherethereisalwaysaspacebetweenkeyandnumber.
Forexample,{LEFT42}meanspressthe"LeftArrow"key42times;{x10}meanspresstheletter"x"10times.
51DateAndTimeStampsInMacrosWinWedgesupportssixdateandtimestampfunctionsthatarespecifiedbyenteringthefollowingkeywordsinanypreambleorpostamblekeystrokemacrodefinedwhenWinWedgeisinSendKeystrokesMode.
KeywordFunctionRange{Century}Insertsthecurrentcentury19-99{Year}Insertsthecurrentyear00-99{Month}Insertsthecurrentmonth01-12{Day}Insertsthecurrentday01-31{Hour}Insertsthecurrenthour00-24{Minute}Insertsthecurrentminute00-59{Second}Insertsthecurrentsecond00-59Alldate&timevaluesaresentasatwobytestringpaddedwithazeroontheleftifthevalueislessthanten.
Onlyoneoccurrenceofeachstampfunctionmaybespecifiedinanyonemacro.
Forexample,thefollowingmacro:"{Year}/{Month}/{Day}:{Hour}:{Minute}:{Second}"isvalidbut"{Year}{Year}"isinvalid.
52FormattingDate/TimeExpressionsDate/TimeformatexpressionscanbeusedtoformattheDate/TimedisplayinWinWedgewindowandcanalsobeusedwiththeSENDDATE(format)DDEcommand.
SeeAlso:ThePreferencesWindow(pg.
42)WinWedgeDDECommands(pg.
59)Toformatdatesandtimes,youcanspecifyeitherthenameofacommonlyusedformatthathasbeenpre-definedinWinWedgeoryoucancreateuser-defineddate/timeformatsusingspecialformattingcharactersthathavespecialmeaningwhenusedinaformatexpression.
Thefollowingtableshowsthepre-defineddataformatnamesyoucanuseandthemeaningofeach:FormatNameDescriptionGeneralDateDisplayadateand/ortime.
Forrealnumbers,displayadateandtime.
(e.
g.
4/3/9305:34PM);Ifthereisnofractionalpart,displayonlyadate(e.
g.
4/3/93);ifthereisnointegerpart,displaytimeonly(e.
g.
05:34PM).
LongDateDisplayaLongDate,asdefinedintheInternationalsectionoftheControlPanel.
MediumDateDisplayadateinthesameformastheShortDate,asdefinedintheInternationalsectionoftheControlPanel,exceptspelloutthemonthabbreviation.
ShortDateDisplayaShortDate,asdefinedintheInternationalsectionoftheControlPanel.
LongTimeDisplayaLongTime,asdefinedintheInternationalsectionoftheControlPanel.
LongTimeincludeshours,minutes,seconds.
MediumTimeDisplaytimein12-hourformatusinghoursandminutesandtheAM/PMdesignator.
ShortTimeDisplayatimeusingthe24-hourformat(e.
g.
17:45).
53Thefollowingtableshowsthecharactersyoucanusetocreateuser-defineddate/timeformatsandthemeaningofeach:CharacterMeaning:Timeseparator.
Thetimeseparatorseparateshours,minutes,andsecondswhentimevaluesareformatted.
TheactualcharacterusedasthetimeseparatordependsontheTimeFormatspecifiedintheInternationalsectionoftheControlPanel.
/Dateseparator.
Thedateseparatorseparatestheday,month,andyearwhendatevaluesareformatted.
TheactualcharacterusedasthedateseparatorintheformattedoutputdependsonDateFormatspecifiedintheInternationalsectionoftheControlPanel.
cDisplaythedateasdddddanddisplaythetimeasttttt,inthatorder.
Onlydateinformationisdisplayedifthereisnofractionalparttothedateserialnumber;onlytimeinformationisdisplayedifthereisnointegerportion.
dDisplaythedayasanumberwithoutaleadingzero(1-31).
ddDisplaythedayasanumberwithaleadingzero(01-31).
dddDisplaythedayasanabbreviation(Sun-Sat).
ddddDisplaythedayasafullname(Sunday-Saturday).
dddddDisplayadateserialnumberasacompletedate(includingday,monthandyear)formattedaccordingtotheShortDatesettingintheInternationalsectionoftheWindowsControlPanel.
ThedefaultShortDateformatism/d/yy.
ddddddDisplayadateserialnumberasacompletedate(includingday,monthandyear)formattedaccordingtotheLongDatesettingintheInternationalsectionoftheControlPanel.
ThedefaultLongDateformatismmmmdd,yyyy.
wDisplaythedayoftheweekasanumber(1forSundaythrough7forSaturday).
54wwDisplaytheweekoftheyearasanumber(1-53).
mDisplaythemonthasanumberwithoutaleadingzero(1-12).
Ifmimmediatelyfollowshorhh,theminuteratherthanthemonthisdisplayed.
mmDisplaythemonthasanumberwithaleadingzero(01-12).
Ifmimmediatelyfollowshorhh,theminuteratherthanthemonthisdisplayed.
mmmDisplaythemonthasanabbreviation(Jan-Dec).
mmmmDisplaythemonthasafullmonthname(January-December).
qDisplaythequarteroftheyearasanumber(1-4).
yDisplaythedayoftheyearasanumber(1-366).
yyDisplaytheyearasatwo-digitnumber(00-99).
yyyyDisplaytheyearasafour-digitnumber(100-9999).
hDisplaythehourasanumberwithoutleadingzeros(0-23).
hhDisplaythehourasanumberwithleadingzeros(00-23).
nDisplaytheminuteasanumberwithoutleadingzeros(0-59).
nnDisplaytheminuteasanumberwithleadingzeros(00-59).
sDisplaythesecondasanumberwithoutleadingzeros(0-59).
ssDisplaythesecondasanumberwithleadingzeros(00-59).
tttttDisplayatimeserialnumberasacompletetime(includinghour,minuteandsecond)formattedusingthetimeseparatordefinedbytheTimeFormatintheInternationalsectionoftheControlPanel.
AleadingzeroisdisplayediftheLeadingZerooptionisselectedandthetimeisbefore10:00A.
M.
orP.
M.
.
Thedefaulttimeformatish:mm:ss.
55AM/PMUsethe12-hourclockanddisplayanuppercaseAMwithanyhourbeforenoon;displayanuppercasePMwithanyhourbetweennoonand11:59PM.
am/pmUsethe12-hourclockanddisplayalowercaseAMwithanyhourbeforenoon;displayalowercasePMwithanyhourbetweennoonand11:59PM.
A/PUsethe12-hourclockanddisplayanuppercaseAwithanyhourbeforenoon;displayanuppercasePwithanyhourbetweennoonand11:59PM.
a/pUsethe12-hourclockanddisplayalowercaseAwithanyhourbeforenoon;displayalowercasePwithanyhourbetweennoonand11:59PM.
AMPMUsethe12-hourclockanddisplaythecontentsofthe1159string(s1159)intheWIN.
INIfilewithanyhourbeforenoon;displaythecontentsofthe2359string(s2359)withanyhourbetweennoonand11:59PM.
AMPMcanbeeitheruppercaseorlowercase,butthecaseofthestringdisplayedmatchesthestringasitexistsintheWIN.
INIfile.
ThedefaultformatisAM/PM.
Thefollowingareexamplesofuser-defineddateandtimeformats:FormatDisplaym/d/yy12/7/58d-mmmm-yy7-December-58d-mmmm7Decembermmmm-yyDecember58hh:mmAM/PM08:50PMh:mm:ssa/p8:50:35ph:mm20:50h:mm:ss20:50:35m/d/yyh:mm12/7/5820:5056UnderstandingDynamicDataExchangeDynamicDataExchangeisafeatureofWindowsthatallowstwoprogramstopassdatadirectlytoeachotherorsendcommandsdirectlytoeachother.
DDEcanbethoughtofasadirectconversationbetweentworunningapplicationprograms.
Inmostcases,oneapplicationisprovidingsomeformofdatatoanotherapplication.
Theapplicationthatisthesourceofthedataiscalledthe"server"andtheapplicationthatisreceivingthedataiscalledthe"client".
Thus,WinWedgeisprimarilyaDDEServerthat"serves"incomingserialdatatoother(client)programs.
WinWedgecanalsoactasaDDEclientinsomespecialcases.
Eachdataitemthataserverapplicationcanprovidehasauniqueidentifierconsistingofthreeparts,aDDEApplicationName,ADDETopicName,andaDDEItemName.
TheDDEApplicationNameisalmostalwaystheexecutablefilenamefortheserverapplication(withoutthe.
EXEextension),theDDETopictypicallyidentifiesagrouporcategoryofdataintheserverapplicationandeachdataitemthataserverapplicationcanprovidehasauniqueDDEItemname.
Thus,theApplicationName,Topic,andItemNameidentifytheexactsourceofthedatainaserverapplication.
(Sortoflikeatelephonenumberwiththethreeparts:AreaCode,ExchangeandNumber.
)DDElinksarealwaysinitiatedintheclientapplication.
TheclientinitiatesaDDElinkbybroadcastingamessagecontainingaDDEApplicationName,ADDETopic,andoptionallyaDDEItemtoallotherapplicationscurrentlyrunning.
Ifaserverapplicationisrunningthatcanprovidethedata,itrespondstotheDDEinitiateandtheWindowsoperatingsystemopensa"link"betweenthetwoapplications.
Fortunately,mostWindowsprogramsthatsupportDDEinsulatetheuserfromthelowleveldetailsofestablishingDDElinksandsimplyallowyoutospecifytheApplicationName,Topic,andItemNameforaspecificpieceofdataandthelinkisthenautomaticallyestablishedforyoubyyourapplicationprogram.
Forexample,ifyouentertheformula:=WinWedge|Com1!
'Field(1)'inacellinanExcelspreadsheetandthenpresstheEnterkey,ExcelwillautomaticallyestablishaDDElinkbetweenWinWedgeandthespreadsheetcell.
(Note:WinWedgemustberunningandactivatedonCOM1inorderfortheabovelinkformulatobesuccessful).
Afterthelinkisestablished,anydatainthetextbox"Field(1)"intheWinWedgewindowwillautomaticallyappearinthe"linked"cellinthespreadsheet.
Also,wheneverthedataforField(1)inWinWedgechanges,thecontentsofthespreadsheetcellwillautomaticallybeupdatedwiththenewdata.
Itislikehavingtheoperatingsystemdoanautomaticcut&pastefromtheservertotheclientwhenevertheserver'sdatachanges.
Theformula:=WinWedge|Com1!
'Field(1)'containsthethreepartsnecessarytosuccessfullylinktoWinWedge;theDDEApplicationName(WinWedge),theDDETopic(Com1)andthespecificDDEItemName'Field(1)'.
EitherapplicationinvolvedinaDDEconversationcanterminatethelink.
SomeapplicationshavemenuoptionsthatallowyoutoselectivelyterminateanyopenDDElinks.
Closingeitherofthelinkedapplicationsalsocausesalllinksbetweenthetwoprogramstobeterminated.
57DDEalsoallowsaclientapplicationtosendcommandstoaserver.
ThetypesofDDEcommands,ifany,thataserverprogramcanacceptwillvarydependingontheapplicationandshouldbewelldocumentedintheapplication'suser'smanualalongwiththeDDEApplicationNameandTopicNamerequiredbyclientprogramstoestablishtheDDElinktotheserver'scommandprocessor.
WinWedgesupportsoverthreedozenDDEcommandsthatallowotherapplicationstocontrolWinWedgeortransmitdataoutaserialport.
Allofthesecommandsaredescribedindetailinthesection:WinWedgeDDECommands(pg.
59).
EstablishingDDELinksUsingTheWindowsClipboardApplicationsthatsupportDDEusuallyprovideaneasywaytoinitiateDDEconversationsusingtheWindowsclipboard.
IfanapplicationcanfunctionasaDDEclient,itwillalmostalwayshavea"PasteLink"or"PasteSpecial"commandinitsmainmenu(usuallyinan"Edit"menu).
DDEserverapplicationswilllikewisehavea"Copy"commandintheirmainmenu(alsoinan"Edit"menu).
Note:Thepresenceofa"Copy"commandinaprogramdoesnotnecessarilymeantheprogramcanactasaDDEserver.
ToinitiateaDDEconversation,youwouldopenuptheserverapplicationandselectthedatatobelinkedusingyourmouse(thecontentsofanInputDataFieldtextboxintheWinWedgewindowforexample)andthen"Copy"thedatatotheclipboardbyselecting"Copy"initsEditmenu.
Next,youwouldopenuptheclientapplicationandclickyourmouseinthepositionwhereyouwouldlikethe"Linked"datatoappear(acellinaspreadsheetforexample)andthenchoose"PasteLink"or"PasteSpecial-PasteLink"fromtheclientapplication'sEditmenu.
IftheCut&PasteLinkprocessissuccessful,thedatafromtheserverwillappearintheclientapplicationfromthatpointonuntilthelinkisterminatedastheresultofendingeithertheclientortheserverapplication.
That'sallthereistoit!
NomessingaboutwithApplicationNames,TopicsorItemsbecauseallthatinformationishiddenawayandpassedimplicitlythroughtheWindowsclipboard.
58DDEandWinWedgeWinWedgecanfunctionasbothaDDEServerandaDDEClientinconversationswithotherapplications.
Asaserver,WinWedgecansupplydatafromthe"InputDataFields",theRecordNumberandtheDate/TimedisplayfieldintheWinWedgewindow.
ItcanalsoprocessDDEcommandsthataresenttoitfromanotherapplication.
Asaclient,WinWedgecanalsoissueaDDEcommandtoanotherapplicationaftereachdatarecordisreceivedthroughtheserialport.
Whenyouselect"DDEServer"fromtheModemenu,WinWedgewilldisplayawindowwhereyoucanspecifyaDDEApplicationName,aDDETopic,andaDDEcommandtoissueaftereachdatarecordisreceivedbyWinWedge.
TheDDEcommandistypicallyusedtoforceanotherapplicationprogramtorunamacroorsubroutineafterWinWedgereceiveseachdatarecordfromaserialdevice.
ThepurposeofthemacroorsubroutinewouldtypicallybetoretrievetheserialdatafromWinWedge.
TheDDEcommandisthereforeusedasameansfortriggeringan"event"inanotherapplicationprogramsignalingthatWinWedgehasjustreceivedanewrecordofdatathroughtheserialportandthatthedataisavailablefortheotherprogramtoretrieve.
SeeAlso:DDEServerMode(pg.
17)OtherapplicationscaninitiateDDElinkswithWinWedgeusingtheDDEApplicationName"WinWedge"andtheDDETopic"COMn"where"n"isthenumberoftheserialadapterthatWinWedgeisactivatedfor.
TheDDEItemsavailablewillbethecontentsofeachdefinedinputdatafieldandthecontentsoftheDate/TimeandRecord#displayintheWinWedgewindow.
TheDDEItemnamesforthedatafieldsarereferencedas"Field(1)"through"Field(n)"where"n"isthehighestdefinedfieldnumber.
TheDDEItemnamefortheDate/Timedisplayis"DATETIME"andtheDDEItemnamefortheRecord#displayfieldis"RECORDNUMBER".
Ifyouusethe"Copy"&"PasteLink"methodtoinitiateDDEconversationswithWinWedge,thisinformationwillbeautomaticallysuppliedtotheclientapplicationanddoesnotneedtobeexplicitlyspecified.
ToinitiateDDEconversationswithWinWedgefromamacroinaspreadsheetorotherapplication,youwillhavetorefertotheuser'smanualoron-linehelpforthespecificapplicationtolearnthesyntaxofthecommandsormacroinstructionsthatcanbeusedtoinitiateDDElinks,sendDDECommandsorperformDDERequests.
Manyexampleareprovidedinthe"DDEExamples"sectionofthismanualandshouldthereforeprovideagoodoverviewofhowtocommunicatewithWinWedgeusingDDE.
SeeAlso:DDEExamples(pg.
63)59WinWedgeDDECommandsWinWedgesupportsalloftheDDEcommandslistedbelow.
Note:DDEcommandswillonlyexecuteifWinWedgehasbeenactivated.
SeeAlso:ActivatingWinWedge(pg.
44)UnderstandingDynamicDataExchange(pg.
56)DDEExamples(pg.
63)CommandFunction[APPEXIT]ExitsWinWedge.
[APPMINIMIZE]MinimizesWinWedgeWindow.
[APPNORMAL]OpensWinWedgeWindow.
[BEEP]CausesWinWedgetoBeeponce.
[BREAK]IssuesaSerialBreaksignal.
[CLEAR]ClearsallinputdatafieldsinWinWedgeWindow.
[COPYFIELD(n)]Copiesthedatafield"n"intotheWindowsclipboard.
[COPYDATE]Copiesthedate/timedisplayfieldintotheclipboard.
[COPYRECNUM]Copiestherecordnumberdisplayfieldintotheclipboard.
[SUSPEND]SuspendsWinWedge.
[RESUME1]ResumesWinWedgeforonedatarecord.
[RESUME]ResumesWinWedge.
[RESET]FlushesallbuffersandresetsWinWedge.
[RTS=ON]SetstheserialportRTSlineon.
[RTS=OFF]SetstheserialportRTSlineoff.
[DTR=ON]SetstheserialportDTRlineon.
[DTR=OFF]SetstheserialportDTRlineoff.
[TOGGLEDTR]TogglestheserialportDTRlinefor100ms.
[SEND(text)]Sendsthetextinparenthesesouttheserialport.
[SENDCODE(n)]SendsthecharacterwithASCIIcode"n"outtheserialport.
[SENDDATE(format)]SendsthedateortimeouttheserialportusingaspecifiedDate/Timeformatstring.
[SENDFILE(filename)]Sendsthecontentsofthespecifiedfileouttheserialport.
[SENDOUT('text',n.
.
.
)]Sendstextandcontrolcodesouttheserialport.
TextmustbesuppliedasquotedstringsusingsinglequotesandcontrolcodesmustbesuppliedasASCIIvalues.
Textandcontrolcodesmaybecombinedinanycombinationwithindividualelementsseparatedbycommas.
ForExample,[SENDOUT('Test',13,10)]sendsthewordTestfollowedbyacarriagereturn(ASCII13)andalinefeed(ASCII10).
60[PUSH(buttoncaption)]PushesabuttonintheWinWedgeWindow.
Thebuttonisspecifiedusingitscaption.
Thespecifiedcaptionshouldbethesameasthatenteredwhenitwasoriginallydefinedincludingampersands.
SeeAlso:DefiningSerialOutputStrings(pg.
38)[CONFIG(filename)]ReconfiguresWinWedge.
filenamespecifiestheconfigurationfiletouseandmustincludethefilenameextensionandthefulldriveanddirectorypathifitisnotinthecurrentdirectory.
Youmaynotspecifyaconfigurationthatusesadifferentserialportthantheonecurrentlyinuse.
[TIMER-ON]Enables/Disablessendingoftimedautomaticoutputstrings.
[TIMER-OFF][TIMERINTERVAL=n]Changesthetiminginterval(ms)fortimedautomaticoutputstringstothevaluen(between1and99,999,999).
Note:AllDDEcommandsmustbeenclosedinsquarebrackets.
WhensendingDDEcommandstoWinWedgefromanotherprogram,usetheDDEApplicationName"WinWedge"andtheDDETopic"COMn"where"n"isthenumberoftheserialportthatWinWedgehasbeenactivatedfor.
61UsingtheLINKTESTutilitytotestDDEcommandsWinWedgecomeswithautilitycalledLINKTESTthatallowsyoutotestallWinWedgeDDEcommandsortestDDEcommandsthatcanbesenttootherprograms.
TotestanyWinWedgeDDEcommands,WinWedgemustberunningandactivatedineither"TestMode","NormalMode"or"VirtualInstrumentMode".
LINKTESTprovidestwotextboxeswhereyouspecifytheDDEApplicationNameandDDETopicNamefortheapplicationthatyouwanttosendaDDEcommandto.
ThedefaultsfortheseparametersarethoserequiredbyWinWedgewhenitisactivatedforCOM2.
Ifyouareusingadifferentserialport,youshouldchangetheDDETopicNametothecorrectvalue.
Athirdtextboxlabeled"DDECommand"iswhereyouentertheDDECommandthatyouwanttosend.
AfterenteringaDDECommand,youcanhaveLINKTESTissuethecommandtothespecifiedapplicationbyclickingthebuttonmarked"Execute".
Ifyougetanerrormessagethatreads"NoForeignApplicationRespondedtoDDEInitiate"thenyoueitherdidnotspecifythecorrectparametersfortheDDEApplicationnameorDDETopicortheapplicationisnotcurrentlyrunning.
Ifyougetanerrorthatreads"ForeignApplicationWon'tPerformDDEMethodorOperation"thentheapplicationdoesnotrecognizeeitherthecommandorthesyntaxforthecommandyouaretryingtohaveitexecute.
ForadditionalinformationaboutusingLINKTESTincludingalistofallDDECommandsthatWinWedgecanrecognize,clickthebuttonmarked"Help"intheLinkTestwindow.
IfyouuseLINKTESTwithanapplicationotherthanWinWedge,youwillhavetorefertoitsusersmanualtofindouttheproperDDEparameters(ApplicationNameandTopicName)andalsothepropersyntaxofanyDDEcommandsthatitcanrecognize.
62UnderstandingHowDDEWorksHelpsAvoidCommonProgrammingMistakesWindowsisa"messagebased",multitaskingoperatingsystem.
Multitaskingmeansthatyoucanhavemorethanoneapplicationrunningatatimeand"messagebased"(alsoreferredtoas"eventdriven")meansthatwhileanapplicationisrunning,itissittinginmemorydormant,waitingforeventmessagestobesenttoitbytheoperatingsystem.
Whenyoupressakeyonyourkeyboardorclickyourmouse,youaregeneratingevents.
Atthemomentaneventoccurs,theoperatingsystemsendsamessagedescribingtheeventtotheapplicationthatisthetargetoftheevent(i.
e.
thetoplevelwindowforkeyboardandmouseevents).
Messagesaresentbywritingthemtoamessage"queue"fortheapplication.
Whenthesystemisidle(i.
e.
noprogramsarebusydoinganything),Windowspassescontroltoeachrunningapplicationinturntogiveitachancetoprocessanyeventmessagesthatitfindsinitsmessagequeue.
Whentheapplicationisfinishedprocessingallitsmessages,itpassescontrolbacktotheoperatingsystemsothatthenextrunningapplicationcanprocessitseventmessages.
Theimportantpointhereisthatwhileoneapplicationisbusydoingsomething,otherapplicationsmaynotbeabletoprocesstheirowneventmessagesuntilthefirstapplicationfinishesoruntilWindowsspecificallypassescontroltotheapplicationtoletitprocessitsevents.
DDEprovidesawayforoneapplicationtosendmessagesdirectlytoanother.
WhenoneprogrampassesdataorsendsaDDEcommandtoanotheritissendingamessagethatwillgetplacedintheotherapplication'smessagequeue.
Thereceivingapplicationwillnotbeabletoactonthatmessageuntilthesendingprogramgoesidlethusallowingittoprocessitsmessages.
Ifyouunderstandwhatisgoingonbehindthescenes,youcanavoidsomecommonmistakes.
Forexample,supposeyouhaveadevicethatrespondstoapromptsentviatheserialport.
Whenthedevicereceivesthepromptitsendsbackastringofdata.
SupposethatyoualsowanttowriteanExcelmacrothatwillsendacommandtoWinWedgecausingittosendthepromptouttheserialportandthenyouwantExceltoreadtheresponsebackfromthedevicebyperformingaDDERequesttoWinWedge.
YoumightcomeupwiththefollowingExcelVBAsubroutinethat,althoughitappearstobequitelogical,willnotwork.
SubPromptMyGizmo()Chan=DDEInitiate("WinWedge","COM1")'openaDDElinkwithWinWedgeDDEExecuteChan,"[SENDOUT('',13,10)]"'sendapromptouttheserialportMyData=DDERequest(Chan,"Field(1)")'readbacktheresponsefromField(1)Sheets("Sheet1").
Cells(1,1).
Formula=MyData'writethedatatocellA1inSheet1DDETerminateChan'terminatetheDDElinkEndSubThereasontheabovesubroutinewillnotworkisbecausetheDDEExecutestatementonlysendsamessagetoWinWedge.
ThesubroutinedoesnotrelinquishcontrolandletWinWedgeprocessthemessageuntilitreachesthe"EndSub"statement.
TheDDERequestthatfollowstheDDEExecutestatementisaskingfordatathatwillnotbeavailableuntilWinWedgegetsachancetorun;i.
e.
afterthissubroutinehasfinishedexecuting.
Don'tworry,therearemanywaystoworkinsidea"messagebased"systemasyouwillfindinthefollowingpagesofexamplemacrosandsubroutines.
63DDEExamplesThefollowingpagescontainexamplemacrosandsubroutinesforsomeofthemorecommonPCapplicationprograms(i.
e.
MicrosoftExcel,Access,Word,VisualBasicandFoxPro).
TheexamplesdemonstratehowtodothingssuchastransmitandreceiveserialdatausingDynamicDataExchangewithWinWedgeorlaunchandunloadWinWedgefrommemoryaswellasperformvariousotherrelatedfunctions.
TheexamplesaredesignedtodemonstratehowtoperformthemostcommontypesofserialI/OoperationswithWinWedgeusingDDE.
AlloftheexampleslistedinthefollowingpagescanbefoundinafilecalledEXAMPLES.
RTFlocatedinyourWinWedgeprogramdirectoryalongwithalloftheotherWinWedgeprogramfiles.
InmostcasesyoushouldbeabletocutandpastetheexamplecodefromtheEXAMPLES.
RTFfiledirectlyintotheapplicationthatyouwanttouse.
Thecommentsintheexampleswillexplainthedetailsofhoweachroutineworksandwillalsopointoutanylinesthatmayneedchanginginordertoworkwithyourparticularsystem.
Important:DynamicDataExchangeisanextremelypowerfulandflexiblewaytopassdataorcommandsdirectlyfromoneapplicationtoanotherhoweverthispowerandflexibilitydoesnotcomewithoutasmallpriceinadditionalcomplexity.
Theexamplesprovidedbelowshouldhelpgreatlytomaketheprocesseasier.
OnethingtoconsideristhattherearemanysituationswhereDDEmaynotberequiredandusingWinWedgein"SendKeystrokes"modemaybemoresuitable.
UsingWinWedgein"SendKeystroke"modeismucheasierandmuchquickertoconfigurethanusingWinWedge"DDEServer"mode.
Forexampleifyouarereadingdatafromasimpleinstrumentlikeabarcodereader,electronicbalanceoranelectroniccaliperandyouwanttoinputasmallamountofdataintoaspreadsheetordatabase,thenusing"SendKeystrokes"modemaybeabetterandmuchsimplerapproachthanusingDDE.
TheremayalsobesituationswhereitmightbeconvenienttoinputdatafromWinWedgeusing"SendKeystrokes"modeandalsosenddataouttheserialportbysendingDDEcommandstoWinWedge.
WinWedgedoesnothavetobeinDDEServermodeinordertoacceptandprocessDDEcommands.
YoucanstillsendDDEcommandstoWinWedgetohaveittransmitdataorpromptsoutaserialportevenwhenitisin"SendKeystrokes"mode.
SeeAlso:ATypicalWinWedgeConfigurationExample(pg.
9)TheModeMenu(pg.
15)SendingKeystrokesvs.
DynamicDataExchange(pg.
18)UnderstandingDynamicDataExchange(pg.
56)WinWedgeDDECommands(pg.
59)Note:TALTechnologiesalsomaintainsanextensive"support"sectiononourwebsitewhereyoucanfindadditionalDDEexamplesalongwithothertechnicalinformationandanswerstofrequentlyaskedquestions.
Ourwebaddressis:http://www.
taltech.
com64DDEExamplesforMicrosoftExcel(VisualBasicforApplications)ExcelExample#1-SendingDDEcommandstoWinWedgefromaVBAsubroutineThefollowingVBAsubroutinesendsastringofcharactersandcontrolcodesouttheserialportbyissuingtheDDEcommand"[SendOut()]"toWinWedge.
Thisexamplesendsanescapecharacter(ASCII27),acapital"P"andacarriagereturn-(ASCII13).
SubSendEscapeP()Chan=DDEInitiate("WinWedge","COM1")DDEExecuteChan,"[SENDOUT(27,'P',13,10)]"DDETerminateChanEndSubThefollowingsubroutineshowshowtosendatextstringpassedasanargumenttotheroutine.
SubSendText(StringToSend$)Chan=DDEInitiate("WinWedge","COM1")'ThefollowinglineconcatenatestheSENDcommandwiththedatatobesentDDEExecuteChan,"[SEND("&StringToSend$&")]"'DDEcommandsaresentastextstringsthereforeweneedtobuildourcommand.
'The&operatoristheExcelstringconcatenationoperatorthusweareconcatenating'Thethreestrings"[SEND(",thedatainthestringvariableStringToSend$and")]"'ThusifStringToSend$="ABC"thenthecommandthatissenttoWinWedgewouldbe:'[SEND(ABC)]"DDETerminateChanEndSubThefollowingsubroutinesendsacolumnofdataouttheserialportstartinginthecurrentlyactivecell.
Aftereachcell'sdataissent,itreadsthecelldirectlybelowthecurrentcell.
Ifthecellcontainsnodatathenitstops,otherwiseitcontinuessendinguntilithitsanemptycell.
SubSendCells()chan=DDEInitiate("WinWedge","COM1")'openalinktowinwedgeoncom1MyPointer=0'startingoffsetfromcurrentcellis0x$=ActiveCell.
Offset(rowOffset:=MyPointer,columnOffset:=0).
Formula'putstringfromcurrentcellinvariablex$WhileLen(x$)'whilethelengthofthestringisnot0DDEExecutechan,"[SENDOUT('"&x$&"',13)]"'sendthestringouttheserialport'theabovelinesendsthedatafollowedbyacarriagereturn(ASCII13)MyPointer=MyPointer+1'pointtothenextcelldownx$=ActiveCell.
Offset(rowOffset:=MyPointer,columnOffset:=0).
Formula'getnextcellWend'loopuntilwereachanemptycellDDETerminatechanEndSub65Thefollowingsubroutinedemonstrateshowtosendthecontentsofanystringvariableouttheserialport-evenstringsthatcontaincontrolcharactersornonprintableASCIIcharacters.
ThestringtobesentouttheserialportispassedasanargumenttotheSendStringsubroutine.
SubSendString(StringToSend$)'ThefollowingloopreadstheStringToSend$variableandgeneratesanewstringcontaining'theASCIIcharactervaluesforeachbyteinthestringseparatedbycommas.
'ThisresultingstringisthenusedastheargumenttotheSENDOUTcommandbelow.
'Ex:ifthevariableStringToSend$="ABC"thenthevariableArg$willbe"65,66,67"'SeethesyntaxoftheSENDOUTcommandintheWinWedgeusersmanualfordetails.
Forx=1ToLen(StringToSend$)Arg$=Arg$+LTrim$(Str$(Asc(Mid$(StringToSend$,x,1))))IfxLen(StringToSend$)ThenArg$=Arg$+","NextChan=DDEInitiate("WinWedge","COM1")'ThefollowinglineconcatenatestheSENDOUTcommandwiththedatatobesentDDEExecuteChan,"[SENDOUT("&Arg$&")]"'The&operatoristheExcelstringconcatenationoperatorthusweareconcatenating'Thethreestrings"[SENDOUT(",thedatainthestringvariableArg$and")]"'ThusifStringToSend$="ABC"thenthecommandthatissenttoWinWedgewouldbe:'[SENDOUT(65,66,67)]"-(theASCIIvaluesforcharsA,BandCare65,66and67)DDETerminateChanEndSubThefollowingsubroutinedemonstrateshowyouwouldcalltheaboveroutinepassingitthecontentsofaspreadsheetcellthussendingthecellcontentsouttheserialport.
SubTestSendString()X$=Sheets("Sheet1").
Cells(1,1).
ValueSendString(X$)EndSub66ExcelExample#2-LaunchingWinWedgefromExcelThefollowingVBAsubroutineexecutesWinWedgeandpassesitthenameofaWinWedgeconfigurationfile(MyConfig.
SW3)onthecommandline.
ThiscausesWinWedgetoautomaticallyloadthespecifiedconfigurationfileandthenactivateitselfinNORMALmode.
PublicConstMyPortAsString="COM1"'changeportifnecessarySubRunWedge()OnErrorGotoErrorHandler'SetupanerrortrapAppActivate"WinWedge-"&MyPort'trytoactivatetheWinWedgeWindow'theabovelinewillgenerateanerrorifWinWedgeisnotrunningoractivatedOnErrorGoto0'removeerrortrapAppActivateApplication.
Caption'setthefocusbacktoexcelExitSubErrorHandler:'WinWedgeisnotrunning-trytolaunchitRetVal=Shell("C:\WINWEDGE\WINWEDGE.
EXEC:\WINWEDGE\MyConfig.
SW3")IfRetVal=0Then'launchfailedMsgBox("CannotFindWinWedge.
Exe")'warnuserandquitExitSubElse'launchsucceededApplication.
WaitNow+TimeValue("00:00:03")'giveWinWedgetimetoloadEndIfResumeNextEndSubNote:IfyounameanExcelsubroutine"Auto_Open()",Excelwillautomaticallyrunthesubroutinewheneverthespreadsheetthatcontainsitisinitiallyopened.
TheAuto_OpensubroutineisanexcellentplacetolaunchWinWedge(aswellasdoanyotherinitializationfunctionsthatyoumightrequire).
Ifyoure-nametheabovesubroutineto"Auto_Open()"thenyoucansaveyourselfthestepofhavingtomanuallyruntheabovesubroutineafteryouopenyourworkbook.
SimilartotheAuto_Opensubroutine,ExcelalsosupportsanAuto_Closesubroutinethatrunsautomaticallywhenyoucloseyourspreadsheet.
ThismightbeagoodplacetotellWinWedgetoquitandunloaditselffrommemoryasinthefollowingexample.
SubAuto_Close()'thissubrunswhenyouclosethesheetOnErrorResumeNext'ignoreerrorsChan=DDEInitiate("WinWedge",MyPort)'openaddelinkwithWinWedgeDDEExecuteChan,"[Appexit]"'tellWinWedgetoquitDDETerminateChanEndSub67ExcelExample#3-RequestingdatafromWinWedgeusingaVBAsubroutine.
StepsforsettingupWinWedge:1.
Select"DDEServer"fromtheWinWedge"Mode"menu.
WhenthewindowappearsaskingforaTargetApplicationDDECommand,enter:EXCELastheDDEApplicationNameandthenenter:SYSTEMastheDDEtopicandfinally,enterthestring:[RUN("GetSWData")]astheDDECommand.
ThisisaDDEcommandthatwillbesenttoEXCELaftereachdatarecordisreceivedbyWinWedge.
ThiscommandwillforceExceltorunaVBAsubroutinecalled"GetSWData"whichwillreadinthedatafromWinWedgeandplaceitinacolumninaworksheet.
2.
SetuptherestoftheWinWedgeparametersasnecessaryforthedevicethatyouareusingandthenactivateit.
StepsforsettingupEXCEL:1.
CreateaVBAsubroutineandenterthefollowingcode:Tocreateamacroselect"Tools","Macro"and"Macros.
.
.
"thenenterasubroutinename"GetSWData"andclickthe"Create"button.
SubGetSWData()DimRowPointerAsLong,ChanAsLong,F1AsVariant,WedgeDataAsStringDimMaxRowsAsLong'FindthenextemptycellinColumnAlookingfromthebottomupMaxRows=ThisWorkbook.
Sheets("Sheet1").
Rows.
CountRowPointer=Thisworkbook.
Sheets("Sheet1").
Cells(MaxRows,1).
end(xlup).
row+1Chan=DDEInitiate("WinWedge","Com1")'establishDDElinktoWinWedgeonCom1F1=DDERequest(Chan,"Field(1)")'getField(1)dataintoavariantarrayWedgeData=F1(1)'convertvariantarraytoastringThisworkbook.
Sheets("Sheet1").
Cells(RowPointer,1).
Formula=WedgeData'Writethedatatocelladdress:(RowPointer,1)inSheet1,i.
e.
fillupColumn1(ColumnA)'IfyouareinputtingmultipledatafieldsfromWinWedgeyouwouldduplicatethecodeabovefor'eachadditionaldatafield.
Forexample,thefollowingthreelinespullindatafromField(2)'F1=DDERequest(ChannelNum,"Field(2)")'getField(2)dataintoavariantarray'WedgeData=F1(1)'convertvariantarraytoastring'ThisWorkbook.
Sheets("Sheet1").
Cells(RowPointer,2).
Formula=WedgeData'putdatainCol2DDETerminateChan'killtheDDElink'Insertadate/timestampinthesheetincolumn3ofthesamerowasthedataThisWorkBook.
Sheets("Sheet1").
Cells(RowPointer,3).
Value=Now'YOURCODEGOESHERETOFURTHERPROCESSTHEDATAIFNECESSARYEndSubTheexampleabovesetsupWinWedgetoissueaDDEcommandconsistingoftheExcel"RUN"commandforcingExceltorunthesubroutine"GetSWData()"aftereachdatarecordisreceivedfromyourserialdevice.
The"GetSWData"subroutineperformsaDDERequesttoWinWedgethatreturnsthecontentsofFIELD(1)toavariablenamed"WedgeData".
Thedataisthenassignedtoacellin"Sheet1"andapointervariableisupdatedsothatthenextinputwillbewrittentothecelldirectlybelowthelastinput.
ThisexampleassumesthatthenameoftheworksheetisSheet1.
68ExcelExample#4-RequestingDatafromWinWedgeusingVBASetLinkOnDatamethod.
(AndotherExceltricks)TheExcelVBAmacrolanguagehasafunctioncalled"SetLinkOnData"thatcanbeusedtocauseExceltoautomaticallyrunasubroutinewheneverdatafromaDDEServerisupdated.
InthepreviousexampleweshowedhowtoconfigureWinWedgetosendacommandtoExceltoforceittorunamacroaftereachdatarecordisreceivedfromadeviceonaserialport.
ThisexampleshowshowtousetheExcelSetLinkOnDatamethodinsteadofhavingWnWedgesendacommandtoExceltotriggerthemacrotorun.
ThetwotechniquesaresimilarinthataftereachdatarecordisreceivedbyWinWedge,ExcelautomaticallyrunsamacrothatreadsinthedatafromWinWedgeanddoessomethingwithit.
ThedifferenceisthatinthepreviousexampleWinWedgetriggersthemacrotorunwhereasinthisexampleExcelautomaticallyrunsthemacrowithnocoaxingfromWinWedge.
OneofthebenefitsofthefollowingmethodisthatWinWedgedoesnothavetobein"DDEServerMode"inordertohaveExcelrunthemacroaftereachdatarecordisreceivedbyWinWedge.
AlthoughWinWedgehasanexplicit"DDEServerMode",itisactuallyaDDEServernomatterwhatmodeitisin(i.
e.
"SendKeystrokes"or"DDEServer"modes).
ThereasonthatWinWedgehasaDDEServerModeatallissothatyoucanconfigureittosendaDDEcommandtoanotherapplicationaftereachinput.
SupposethatyouwantedtosendtheserialdataaskeystrokestooneapplicationandpassthedatatoExcelviaDDEinrealtime.
YoucouldsetupWinWedgeinSendKeystrokesmodeandusetheSetLinkOnDatamethodinExceltotriggeramacrothatwouldpullthedatafromWinWedgeintoaspreadsheet.
AnotherbenefitofthismethodisthatthedatafromWinWedgewillbetransferredtoExcelslightlyfasterthantheitwouldifWinWedgeweresendingacommandtoExcelaftereachinput.
InadditiontodemonstratingtheSetLinkOnDatamethodinExcel,thefollowingmacrosalsoshowhowtolaunchandactivateWinWedgeautomaticallywhenyouopenupyourspreadsheetaswellashowtoquitWinWedgeautomaticallywhenyoucloseyourspreadsheet.
Tousethefollowingmacros,setupWinWedgetoworkwithyourinstrumentbychoosingthecorrectserialcommunicationsparametersanddefiningtheinputdatarecordstructuretofitthedatathatisreturnedfromyourserialdevice.
IfyousetupWinWedgeinDDEServermode,makesurethatyoudonothavea"DDECommand"defined.
Next,activateWinWedgeinTestMode,switchtoExcelandenterthefollowingmacrosintoamoduleinyourExcelspreadsheet.
(YoumayhavetomodifythevaluesforsomeoftheGlobalconstantsasdescribedinthecommentsinthesubroutines.
)Afteryouhaveenteredthefollowingsubroutines,saveyourspreadsheetandcloseit.
Finally,re-openyourspreadsheetandstartcollectingdata.
WinWedgeshouldautomaticallyloadandactivateitselfwhenyouopenthesheet.
69GlobalRowPtrAsLong,ColPtrAsLong'defineglobalvariablesGlobalMyPortAsStringGlobalConstCmdLine="C:\WinWedge\WinWedge.
ExeC:\WinWedge\Config.
SW3"'changetheabovecommandlinetopointtoyourcopyofWinWedgeandyourconfigfileSubAuto_Open()'thissubrunsautomaticallywhenyouopenthespreadsheetFindWedge'checkifWinWedgeisalreadyrunningIfMyPort=""then'WinWedgeisnotrunning-trytolaunchitOnErrorResumeNext'ignoreerrorsandtrytolaunchWinWedgeRetVal=Shell(CmdLine)'launchWinWedgeusingcommandlinedefinedabove'theabovelinelaunchesandactivatesWinWedgewithaconfigfile:Config.
SW3IfRetVal=0Then'error-WinWedgenotfoundMsgBox("CannotFindWinWedge.
Exe")'displaywarningExitSub'andquitEndIf'otherwise-Application.
WaitNow+TimeValue("00:00:04")'giveWinWedgetimetoloadAppActivateApplication.
Caption'setthefocusbacktoExcelFindWedge'findoutwhichportWinWedgewasactivatedforEndIfStartCollecting'setupExceltocollectdatafromWinWedgeEndSubSubStartCollecting()RowPtr=1:ColPtr=1'initializeglobalvariablesSheets("Sheet1").
Activate'activatesheet1andsetupaDDElinktoWinWedgeSheets("Sheet1").
Cells(1,50).
Formula="=WinWedge|"&MyPort&"!
RecordNumber"ActiveWorkbook.
SetLinkOnData"WinWedge|"&MyPort&"!
RecordNumber",_"GetSWData"'theSetLinkOnDatamethodcausesExceltoruntheGetSWDatamacroautomaticallywhennew'dataisavailableinWinWedge(whentheRecordNumberisupdated).
UsingtheSetLinkOnData'methodinExceleliminatestheneedtohaveWinWedgesendaDDECommandtoExceltocause'ittoruntheGetSWDatasub.
TheRecordNumberDDEitemisupdatedafterallotherDDEdata'items(theinputdatafields)havebeenupdated.
EndSubSubAuto_Close()'thismacrorunsautomaticallywhenyouclosethespreadsheetSheets("Sheet1").
Activate'activatesheet1ActiveWorkbook.
SetLinkOnData"WinWedge|"&MyPort&"!
RecordNumber",""'shutdowntheSetLinkOnDatafunctionbyassigningitanemptystringtothemacronameSheets("Sheet1").
Cells(1,50).
Formula=""'removetheddelinkfromR1C50OnErrorResumeNext'ignoreerrorsChan=DDEInitiate("WinWedge",MyPort)'openaddelinkwithWinWedgeDDEExecuteChan,"[Appexit]"'tellWinWedgetoquitDDETerminateChan'terminatetheDDElinkEndSub70SubGetSWData()DimVArrrayAsVariant,MyStiringAsString,ChanAsLongColPtr=1RowPtr=RowPtr+1'pointtothenextrowdown'IfthisisthefirsttimethroughtheninitializeRowPointertopointtoRow1and'ColPointertopointtoColumn1-i.
e.
collectdataintocolumn1startinginRow1Chan=DDEInitiate("WinWedge",MyPort)'initiateDDElinkwithWinWedgeVArray=DDERequest(Chan,"Field(1)")'getField(1)fromWinWedgeMyString=VArray(1)'converttoastring'TheDDERequestfunctioninExcelreturnsavariantarraydatatype.
ThisisapeculiarityofExcel,'thereturntypeshouldbeastringdatatype.
TheabovelinefixestheExcel"inconsistency"and'convertsthevariantarraytoastringbyassigningelement1ofthevariantarraytoastring'Addyourcodeheretodosomethingwiththedatamaybe'orpossiblysendacommandbacktoWinWedgeasinthefollowingline'DDEExecutechan,"[Beep]"'sendabeepcommandtoWinWedgeThisWorkBook.
Sheets("Sheet1").
Cells(RowPtr,ColPtr).
Formula=MyString'theabovelinewritesthedatatocelladdress:(RowPtr,ColPtr)inSheet1DDETerminateChan'terminatetheddelinkEndSubSubFindWedge()'ThissubtriestofindWinWedgeandidentifytheportthatitisactivatedonMyPort="COM1":CurrentPort=1'startwithCOM1OnErrorGoToerrhandler'AppActivatecausesanerrorifWinWedgeisnotactiveAppActivate"WinWedge-"&MyPort'trytosetfocustoWinWedgeOnErrorGoTo0'disableerrortrapAppActivateApplication.
Caption'setthefocusbacktoExcelExitSub'quit&returntocallererrhandler:CurrentPort=CurrentPort+1'AppActivategeneratedanerror-trynextcomportMyPort="COM"+CStr(CurrentPort)'setMyPorttothenewport(COM2,COM3,etc.
.
.
)IfCurrentPort>8Then'ifports1-8havebeentestedandWinWedgenotfoundMyPort=""'setMyPort=""toindicateWinWedgewasnotfoundResumeNext'resumeatnextlineafterAppActivatestatementEndIfResume'trynextport-resumeatAppActivateStatementEndSub71ExcelExample#5-Overcomingthe40fieldlimitinWinWedgeExcelhastwo"idiosyncrasies"withitsDDERequest()function.
ThefirstisthattheDDERequest()functionalwaysreturnsavariablewiththedatatype"VariantArray".
ForsomeunknownreasontheDDERequestfunctioninExcelexpectstoreceiveaTabdelimitedarrayofdata.
Infact,iftheserialdatafromWinWedgeweretabdelimited,ExcelwouldautomaticallyparseitandfillupaVariantArraysuchthateachtabdelimiteddataitemwouldbestoredinsuccessivearrayelements.
Typically,datafrommostinstrumentsisnottabdelimitedthereforewhenyouperformaDDERequesttoWinWedgefromExcelyouendupwithaVariantArrayvariablewithonlyasingleelement(element1)containingallthedatafromthefieldinWinWedgethatyouarerequestingthedatafrom.
ExcelwillletyouassignaVariantArraytoacellinaspreadsheethoweverifyoutrytoperformstringfunctionsonaVariantArray,Excelgeneratesan"InvalidDataType"error.
TheVariantArraymustbeconvertedtoastringdatatypebeforeitcanbeusedinastringfunction.
ThisproblemiseasilyovercomebyassigningtheVariantArrayelement1toastring.
ThefollowingcodefragmentusestheDDERequestfunctiontoreturnaVariantArrayandthenusesanassignmentstatementtoconvertelement1oftheArraytoastring.
DDEChannel=DDEInitiate("WinWedge","Com2")DDEVariantArray=DDERequest(DDEChannel,"Field(1)")DDETerminateDDEChannelStringVariable$=DDEVariantArray(1)'assignArrayelement1toaStringvariableThesecondproblemisthattheDDERequest()functioncanonlyreturnstringdatathatislessthan255bytesunlessthestringisdelimitedwithtabs(seethefollowingsection"AdvancedExcelTricks"pg.
73).
IfyoutrytoDDERequest()adatastringthatislongerthan255bytes,Exceltruncatesthedataandyouloseanythingafterthe255thbyte.
Thefollowingsubroutineshowshowtogetaroundbothoftheproblemsdescribedaboveaswellashowtogetaroundthe40fieldlimitinWinWedge.
Togetpastthe40fieldlimitinWinWedge,insteadofusingtheparsingcapabilitiesinWinWedge,wewilluseourownparsingroutinewritteninExcelVBA.
TodothiswefirsthavetogetallthedatafromthedeviceintoasinglestringvariableinExcel.
ThisiswheretheproblemsinExcelcatchuptous,especiallywhenthetotallengthofthedatastreamcouldbemorethan255bytes.
ThefollowingexampleshowshowtoconfigureWinWedgeandExceltodealwithasituationwhereadevicetransmitsadatarecordcontainingover40datafieldsthataredelimitedwithcommasandterminatedwithacarriagereturn.
Thetotallengthofthedatacouldalsobeover255bytes.
IfExcelwerecapableofpullinginover255byteswiththeDDERequestfunction,thenallwewouldhavetodoisdefinethe"EndofRecordEvent"inWinWedgeas"CarriageReturnorCrLfReceived"andthendefinethestructureofthedatarecordsas"SingleField".
Finally,wewoulduseaVBAmacrotoparsethestringafterwepassittoExcel.
Becausethedatastringcouldbeover255byteslong,wehavetobreakitintopiecesbeforepassingittoExcelandthenputitbacktogetheragaininourVBAmacro.
72Thefirststepistoselect"DDEServer"fromtheWinWedge"Mode"menu.
WhenthewindowappearsaskingforaTargetApplicationDDECommand,enter:EXCELastheDDEApplicationNameandthenenter:SYSTEMastheDDEtopic.
andfinally,enterthestring:[RUN("NewGetSWData")]astheDDECommand.
ThiscommandwillcauseExceltorunasubroutinenamed"NewGetSWData"aftereachcompletedatarecordisreceivedbyWinWedge.
ToconfigureWinWedgetoinputthedatainawaythatthecanbeusedbytheExcelsubroutine,choose"InputDataRecordStructure"fromtheDefinemenuandthenselect"CarriageReturnorCrLfReceived"asthe"EndofRecordEvent".
ClicktheContinuebuttonandselect"MultipleFixedLengthDataFields"asthe"RecordStructure".
Finally,defineseveraldatafieldswithalltheirfieldlengthssetto250bytes.
Youneedtodefineenough250bytedatafieldssothatthelargestdatarecordfromthedevicewillfitinallthefieldsdefinedinWinWedge.
Forexampleifthelargestrecordtransmittedbythedeviceis1125bytes,thenyouwouldneedtodefinefive250bytedatafields.
Note:BesurenottoapplyanyFilterstoanyofthedatafieldsthatyoudefine.
ThefollowingsubroutineperformsthejobofpullingthedatainfromWinWedgeandthenputtingitbacktogetherintoonelongstring.
Finallythesubroutineparsesthedataintoindividualdatafieldsandplugseachfieldintoseparatecellsinarowofthespreadsheet.
SubNewGetSWData()'thissubisrunbyWinWedgeaftereachdatarecordisreceivedStaticRAsLong,CAsLong'R&CpointtotheRowandColumnwherethedatawillgoIf(R=0)Or(C=0)ThenR=1:C=1'makesureneitherRorCiszeroChan=DDEInitiate("WinWedge","Com1")'changetheserialportifnecessary'assumethatthereare5datafieldsdefined-changetomoreorlessifnecessaryField1=Application.
DDERequest(Chan,"Field(1)")'getfield1Field2=Application.
DDERequest(Chan,"Field(2)")'getfield2Field3=Application.
DDERequest(Chan,"Field(3)")'getfield3Field4=Application.
DDERequest(Chan,"Field(4)")'getfield4Field5=Application.
DDERequest(Chan,"Field(5)")'getfield5DDETerminateChan'killthelinkMyVar$=Field1(1)&Field2(1)&Field3(1)&Field4(1)&Field5(1)&","'Converteachvariantarraytoastring,concatenatethemalltogetherandaddafinal'commadelimiterforthefollowingparsingroutine.
Thefollowingcodeparsesthestring'MyVar$bysearchingforcommasandplacingeachdelimitedfieldinaseparaterowStartPos=1'startingpositioninthestring-startat1stbyteWhileStartPos456,789,123,456etc.
.
.
Youcanusethe"pre-transfertranslationtable"inWinWedgetoconvertallcommastotabssothatthedatawouldappearinWinWedgeasfollows:123456789123456789123456etc.
.
.
Note:WhenWinWedgeisinDDEServermode,itsdefaultbehavioristostripoutcarriagereturnsbytranslatingthemto"Nulls"thereforewewillalsoneedtotranslatecarriagereturnsbacktocarriagereturnsandnottonulls.
Select"PreTransferTranslationTable"fromtheDEFINEmenuandselectthecommacharacterinthetableandclickthebuttonmarked"Translate".
WhentheASCIIchartappears,scrollthechartdowntotheTABcharacter(ASCII9)andclicktheOKbuttontoperformthetranslation.
Next,selectthecarriagereturncharacter(ASCII13)inthetranslationtableandclickthe"Translate"buttonagain.
WhentheASCIIchartappearsthistime,selectASCII13andclicktheOKbutton.
ClicktheOKbuttoninthetranslationtabletoreturntothemainmenu.
IfyoudefinetherecordstructureinWinWedgeas"SingleFieldDataRecords"andthuspulltheentirearrayintoasinglefieldinWinWedgeandthenpullthearrayintoavariantarrayvariableusingExcel'sDDERequestfunctionandfinallyusetheFormulaArrayfunctiontoassignthevariantarraytoarangeofcells,Excelwillautomaticallyparsethedataandwriteittotherangeofcellssuchthateachcellwillcontainasinglevaluefromthearray.
DataelementsseparatedbytabswillbewrittentocellsacrossarowandeachcarriagereturninthedatacausesExceltoplacedatafollowingthecarriagereturninthenextrowdown.
ThefollowingexampledemonstrateshowtosetupWinWedgeandExceltopullinanentirecommadelimitedarray(whereeachlineofdatainthearrayiscarriagereturnterminated).
BypullingintheentirearraywithasingleDDERequestandlettingExcelparsethedataforus,youcanpasshugeamountsofdataextremelyquicklyintoalargerangeofcells.
74SupposeyouhaveadevicethattransmitsacommadelimitedarrayofdatasimilartothefollowingwheretheentirearrayistransmittedonceeverytensecondsorinresponsetoapromptandyouwouldliketoinputthedataintoarangeofcellsinExcelextremelyquickly:(representscarriagereturnsandrepresentslinefeedcharacters)123,456,789,123456,789,123,456789,123,456,789123,456,789,123456,789,123,456789,123,456,789StepsforsettingupWinWedge:1.
Select"DDEServer"fromtheWinWedge"Mode"menu.
WhenthewindowappearsaskingforaTargetApplicationDDECommand,enter:"EXCEL"astheApplicationNameandthenenter:"SYSTEM"astheDDEtopic.
Finally,enterthestring:[RUN("GetDataArray")]astheDDECommandandclicktheOKbuttontoreturntothemainmenu.
2.
Select"InputRecordStructure"inthe"Define"menuanddefinethestructureoftheinputrecord(s)toWinWedge.
Selectthe"StartofRecordEvent"as"AnyCharacterReceived"andthe"EndofRecordEvent"as"TimeDelayBetweenRecords"andthenclickthe"Continue"button.
Inthenextwindowtoappearpromptingforthetimebetweenrecords,leavethedefaultvalueof3clockticksandclickthe"Continue"buttonagain.
Next,select"SingleFieldDataRecords"fromthe"RecordStructure"windowandclickthe"Continue"buttonagain.
WhenyougettothefinalWindowwiththecaption"InputRecordDefinitionEditor",clicktheOKbuttontoreturntothemainmenu.
3.
BecauseExcelisexpectingtabdelimiteddatawithcarriagereturnsattheendofeachline,wewillneedtousethe"Pre-TransferTranslationTable"totranslatethecommastotabs.
Also,whenWinWedgeisinDDEServermode,itsdefaultbehavioristostripoutcarriagereturnsbytranslatingthemto"Nulls"thereforewewillalsoneedtotranslatecarriagereturnsbacktocarriagereturnsandnottonulls.
Select"PreTransferTranslationTable"fromtheDEFINEmenuandselectthecommacharacterinthetableandclickthebuttonmarked"Translate".
WhentheASCIIchartappears,scrollthechartdowntotheTABcharacter(ASCII9)andclicktheOKbuttontoperformthetranslation.
Nextselectthecarriagereturncharacter(ASCII13)inthetranslationtableandclickthe"Translate"buttonagain.
WhentheASCIIchartappearsthistime,selectASCII13andclicktheOKbutton.
Finally,clicktheOKbuttoninthetranslationtabletoreturntothemainmenu.
4.
SetuptherestoftheWinWedgeparametersasrequiredbyyourserialdeviceandthenactivateitbyselectingeither"TestMode"fromtheActivatemenu.
75StepsforsettingupEXCEL:1.
CreateoreditaVBAmoduleandenterthefollowingcodeinthemodule:(Tocreateanewsubroutineselect"Tools","Macro"and"Macros.
.
.
"thenenterasubroutinename"GetDataArray"andclickthe"Create"button.
)SubGetDataArray()StaticStartColasInteger,StartRowasInteger'retainvaluesbetweencalls'ThissubperformsaDDERequestforField(1)inWinWedgeandreadsinatabdelimited'arraywithcarriagereturnsattheendofeachline.
Itthenfillsarangeofcellswiththedata.
'ThenativeformatforExceldataistabdelimitedtextwithacarriagereturnattheendof'eachrowofdata.
IfweassignthistypeofdatatoarangeofcellsusingtheFormulaArray'function,Excelautomaticallyparsesthedataandfillsitintothespecifiedrange.
Chan=DDEInitiate("WinWedge","COM1")'initiateddechannelMyArray=DDERequest(Chan,"Field(1)")'requestfield(1)fromWinWedgeDDETerminatechan'terminatetheddechannel'thefirsttimethrough,StartColandStartRowwillbe0-initializeStartColandStartRowIfStartCol=0ThenStartCol=1'setthestartingcolumnwheredatawillgoinoursheetIfStartRow=0ThenStartRow=1'setthestartingrowx=0'setdefaultxdimensionto0OnErrorResumeNext'ignoreerrors(erroroccursifarrayhasonedimension)x=UBound(MyArray,2)'getupperboundofarrayxdimensionOnErrorGoTo0'allowerrorsy=UBound(MyArray,1)'getupperboundofarrayydimensionIfx=0Andy>=1Thenx=y:y=1'ifarrayhasonedimensionthenswapxandyEndRow=StartRow+y-1EndCol=StartCol+x-1Sheets("Sheet1").
Range(Cells(StartRow,StartCol),Cells(EndRow,EndCol)).
FormulaArray=_MyArray'fillcellsintherangestartingin"StartCol:StartRow"withthedataarrayfromWinWedge'StartCol=EndCol+1'un-commentthislinetomoverightthewidthofthearrayaftereachinputStartRow=EndRow+1'orun-commentthislinetomovebelowpreviousdataaftereachinput'keeptheabove2linescommentedouttohaveeachnewarrayoverwritethepreviousoneEndSubTheexampleabovesetsupWinWedgetoissueaDDEcommandtoExcelforcingittorunthesubroutine"GetDataArray()"aftereachcompletearrayisreceivedfromtheserialdevice.
The"GetDataArray"subroutineperformsaDDERequesttoWinWedgethatreturnsthecontentsofFIELD(1)toavariantarrayvariablenamed"MyArray".
ThedimensionsofthearrayareobtainesusingtheUBOUNDfunctionandtheentirearrayisthenassignedtoarangeofcellsthesamesizeasthearrayintheworksheet"Sheet1"usingtheFormulaArrayfunction.
TheexampleaboveassumesthattheopenworkbookcontainsaworksheetnamedSheet1.
Note:Thissubroutinewillalsoworkwithnonarraytypedata(i.
e.
singledatavalues).
Singledatavaluesareactuallyequivalenttoasingledimensionarraycontainingasingledataelement.
ThusyoucouldusethisexampleinplaceofExample#3onpage87.
76ExcelExample#7-ContinuallyPollingMultipleDevicesInSequence(orSendingMultiplePollstoaSingleDevice)Supposeyouhadagroupofdevicesconnectedviaamulti-dropRS422orRS485linesuchthateachdevicerespondedtoapromptbysendingbackarecordofdata.
SupposealsothatyouwantedtosetupWinWedgeandExceltopolleachdeviceinsequenceandretrievethedatastackingupthereadingsfromeachdeviceinseparatecolumnsinyourspreadsheet.
Inamulti-dropsituationyoutypicallyhavetowaitforeachdevicetorespondtoitspromptbeforeyoucansendthenextprompttothenextdevice.
ThefollowinginstructionsandexampleVBAsubroutinesshowhowtohandleasituationlikethis.
Note:ThefollowingexamplecanalsobeusedtosendmultiplepromptstoasingledeviceoveranRS232connectionandthusretrievemultipledataelementsfromthedevice.
StepsforsettingupWinWedge:1.
Select"DDEServer"fromWinWedge"Mode"menu.
Whenthewindowappearsaskingfora"TargetApplicationDDECommand",clearoutalltextboxespromptingforanApplicationName,aDDEtopicandaDDEcommand.
Note:InthisexamplewewillnotbeconfiguringWinWedgetosendaDDECommandtoExcelthereforetheseitemsarenotnecessaryandcanbeleftblank.
2.
Select"InputDataRecordStructure"inthe"Define"menuanddefinethestructureoftheinputdatarecord(s)toWinWedgeasrequiredforyourapplication.
3.
SetupWinWedgetotransmitthefirstpromptforthefirstdevicethatyouwanttopollusingeitheratimercontrolledoutputstringorabuttoncontrolledoutputstring-Select"OutputStrings"fromtheDEFINEmenu.
Ifyouuseatimercontrolledoutputstring,setthetimerintervaltoavaluethatishighenoughtoguaranteethatalldeviceswillbepolledbeforethefirstpromptgetssentagain.
Also,donotchecktheoption"EnableTimeronActivation"-wewillactivatethetimerlater,afterwearefinishedsettingupExcel.
4.
SetuptherestoftheWinWedgeparametersasrequiredbyyourdeviceandthenactivateit.
77StepsforsettingupEXCEL:1.
CreateoreditaVBAmoduleandenterthefollowingcodeinthemodule:PublicConstMyPortAsString="COM1"'ChangeporttomatchconfigurationofWinWedgePublicConstMaxPromptsAsLong=3'numberofpromptsordevicesDimRowPointerAsLong'rownumberforwheredataisstoredDimPrompt(MaxPrompts)AsString'createanarrayofpromptsSubGetSWData()DimMyDataAsVariant,MyDataStringAsString,ChanAsLong'thevariablePNumkeepstrackofwhichpromptwassentlast-startwithdevice1StaticPNumAsLong'preservethevalueofPNumbetweencallsIfPNum=0ThenPNum=1'SettheinitialvalueofPNumto1'Thefirsttimethrough,RowPointerwillbe0-findthefirstemptyrowinthesheetIfRowPointer=0ThenRowPointer=Sheets(1).
Cells(65000,1).
end(xlup).
row+1'definethepromptsforeachdevice-addalinebelowforeachprompt'seetheWinWedgemanualfordetailsabouttheSENDOUTcommand'WinWedgewillsendthefirstpromptsowedonotneedtodefineitherePrompt(2)="[SENDOUT('PString2',13,10)]"'promptfordevice2Prompt(3)="[SENDOUT('PString3',13,10)]"'promptfordevice3OnErrorResumeNext'ignoreerrorsChan=DDEInitiate("WinWedge",MyPort)'openalinktoWinWedgeMyData=DDERequest(Chan,"FIELD(1)")'getdatafromfield(1)'theabovelinegetstheresponsefromthelastpromptthatwassentMyDataString=MyData(1)'convertvariantarraytypetoastringvariable'ThedatafromField(1)ofWinWedgeisnowinthevariable"MyDataString"Sheets(1).
Cells(RowPointer,PNum).
Formula=MyDataString'theabovelinewritesthedatatocolumn"PNum"inrow"RowPointer"'PNumindicateswhichpromptrequestedthedatathatwejustgot'addcodeheretofurtherprocessthedataifrequired.
PNum=PNum+1'IncrementPromptNumber-countfrom1toMaxPromptsIfPNum>MaxPromptsThen'IfPNum>MaxPromptsthenloopbackto1PNum=1'andquit-WinWedgewillsendpromptforfirstdeviceRowPointer=RowPointer+1'incrementRowPointer-nextsetofdatagoestonextrowElse'otherwisesendthepromptforthenextdeviceDDEExecuteChan,Prompt(PNum)'sendthenextpromptEndIfDDETerminateChan'terminatethelinkEndSub78SubSetUpDDE()Sheets("Sheet1").
Activate'activatesheet1andsetupaDDElinktoWinWedgeSheets("Sheet1").
Cells(1,50).
Formula="=WinWedge|"&MyPort&"!
RecordNumber"ActiveWorkbook.
SetLinkOnData"WinWedge|"&MyPort&"!
RecordNumber",_"GetSWData"'theSetLinkOnDatamethodcausesExceltoruntheGetSWDatamacroautomatically'whennewdataisavailableinWinWedge(whentheRecordNumberisupdated).
'UsingtheSetLinkOnDatamethodinExceleliminatestheneedtohaveWinWedge'sendaDDECommandtoExceltocauseittoruntheGetSWDatasub.
'ExcelwillautomaticallyruntheGetSWDatasubwhenWinWedgeupdatesthe'RecordNumberDDEitem.
TheRecordNumberDDEitemisupdatedaftereach'datarecordisreceived.
EndSubAfterenteringthetwosubroutinesabove,runthesubroutine"SetUpDDE"toestablishaDDElinkbetweenExcelandtheRecordNumberDDEiteminWinWedge.
AfterExcelissetupandyouarereadytostartpromptingfordatayoucanenablethetimerinWinWedge.
WhatisgoingonhereisthatWinWedgewillsendthefirstprompttothefirstdevicecausingittosendbackaresponse.
Wheneachresponsecomesback,WinWedgeupdatestheRecordNumberDDEiteminExcelforcingittorunthemacroabove(becauseweusedtheSetLinkOnDatamethodintheSetUpDDEsubroutinetocausethistohappen).
ThefirstthingthemacrodoesispullinthedatafromWinWedgeandplaceitinacolumnusingthe"PNum"variableasthecolumnselector.
Forexample,ifPNumisequaltoone,thedataiswrittentocolumnA.
IfPNumisequaltotwothenthedataiswrittentocolumnB,etc.
.
Next,themacroincrementsa"PNum"variableandchecksitsvalue.
IfPNumisgreaterthanthemaximumnumberofprompts(i.
e.
devices)thenitresetsto1andquits;otherwiseittransmitsthenextpromptinthesequence.
Whentheresponsetothispromptcomesin,theprocessrepeatsitselfuntilwereceivethedatafromthelastdeviceandPNumisincrementedpastthenumberofdevices.
ThetimercontrolledoutputstringinWinWedgestartsthewholeprocessoveragainbypromptingfordatafromthefirstdevice.
Note:Youdonothavetouseatimercontrolledoutputstring.
Tokickoffathesequence,simplytransmitthepromptforthefirstdevice.
YoucandothisfromExcelbywritingamacrothatsendsaDDEcommandtoWinWedgetellingittosendthefirstpromptoryoucandefineahotkeyorabuttoncontrolledoutputstringinWinWedgethatwouldtransmitthefirstprompt.
SeeAlso:DefiningHotKeysandHotKeyActions(pg.
40)DefiningSerialOutputStrings(pg.
38)79DDEExamplesforMicrosoftAccessAccessExample#1-CollectingDataDirectlyToATableInAnAccessDatabaseStepsforsettingupWinWedge:1.
Select"DDEServer"fromthe"Mode"menuinWinWedge.
WhenthewindowappearsaskingforaTargetApplicationDDECommand,enter:MSACCESSastheDDEApplicationName.
FortheDDETopic,enterthefilenameofyouropendatabasefilewithoutthefilepathortheMDBExtension.
FortheDDECommand,enterthestring:[GrabData].
ThisisaDDEcommandthatwillbesenttoMSACCESSaftereachdatarecordisreceivedbyWinWedge.
2.
SetuptherestofWinWedgeasneededforyourserialdeviceandthenactivateit.
StepsforsettingupMSACCESS:MSAccessdoesnothavea"GrabData"DDEcommandsothefirststepistocreateone.
WhenyoudefineamacroinanAccessdatabase,thenameofthemacroautomaticallybecomesavalidMSAccessDDEcommandforaslongasthedatabaseisopen.
1.
Createanewmacrothatperformsthe"RunCode"Action.
ForthefunctionnamethatisrequiredbytheRunCodeaction,enterthename"GetWedgeData()".
Savethemacrowiththemacroname"GrabData"andfinally,createanewVBAModulewithafunctionnamed"GetWedgeData()"andenterthefollowingcodeinthebodyofthefunction:FunctionGetWedgeData()DimMyDataAsString,ChanAsLong'createvariablesChan=DDEInitiate("WinWedge","Com1")'openalinktoWinWedgeMyData=DDERequest(Chan,"FIELD(1)")'getdatafromfield(1)DDETerminateChan'terminatethelinkIfLen(MyData)=0ThenExitFunction'ifnodatathenquit'DatafromField(1)inWinWedgeisnowinthevariable"MyData".
Thefollowingcodeadds'anewrecordtoTABLE1andstoresthedatainafieldnamed"SerialData"DimMyDB,MyTable'dimvariablesfordatabaseandrecordsetobjectsSetMyDB=DBEngine.
Workspaces(0).
Databases(0)SetMyTable=MyDB.
OpenRecordset("TABLE1",DB_OPEN_TABLE)MyTable.
AddNew'addanewrecord-thenewrecordbecomesthecurrentrecordMyTable("SerialData")=MyData'writeourdatatoafieldnamed"SerialData"MyTable.
Update'updatethetableMyTable.
Close'closethetableEndFunctionTheexampleabovesetsupWinWedgetoissueaDDEcommandconsistingofthenameofanAccessmacrotoyourdatabaseaftereachdatarecordisreceivedfromyourserialdevice.
ThemacrocallsaVBAfunctionthatperformsaDDERequestbacktoWinWedgeandreturnsthecontentsofFIELD(1)toastringvariablenamed"MyData".
Itthencreatesanewrecordinatablenamed"Table1"andinsertsthedataintoatextfieldnamed"SerialData"thenewrecord.
Thisexampleassumesthatatablenamed"Table1"existsinthedatabaseandthatthetablecontainsatextfieldnamed"SerialData"80AccessExample#2-LaunchingAndTerminatingWinWedgeFromAccessFunctionLaunchWedge()'ThisfunctionwilllaunchWinWedgefeedingitthenameofaconfigurationfileonthe'commandlinecausingWinWedgetoautomaticallyloadtheconfigfileandactivateitselfCmdLine="C:\winwedge\winwedge.
exeC:\winwedge\test.
SW3"'Change"CmdLine"tospecifythecorrectpathforyourcopyofWinWedge.
Exe'MakesurethatthecompletepathisspecifiedforyourconfigurationfileaswellRetVal=Shell(CmdLine)x=Now+TimeValue("00:00:03")'waitforroughly3secondsDoWhileNowForthistypeofdatarecord,youmightselect"AnyCharacterReceived"astheStartOfRecordEventand"CarriageReturnorCrLfReceived"astheEndOfRecordEventandfortheRecordStructureyouwouldchoose"MultipleDelimitedDataFields"andspecifythattherearethreedatafieldsperrecordwithacommadelimiterseparatingeachfield.
Note:Theabovereferstoacarriagereturnandalinefeedcharacter.
Acarriagereturn(Cr)willappearinthe"Analyze"windowinWinWedgeasamusicalnoteandalinefeed(Lf)willappearasasmallrectanglewithacircleinsideit.
91Otherdevicesmayoutputdatawitharecordstructurethatislessobviousthantheexampleabove.
Considerthefollowingtwopossibledifferentoutputrecordstransmittedfromoneparticularlaboratoryinstrument:Sample#1,*213**32****23**Sample#2,*215**437**141**797**89**56Thetworecordsappearsimilarinthattheybothareterminatedbyacarriagereturn-linefeedandtheybothseemtocontainmultipledelimiteddatafields.
Aminorproblemwiththeabovetworecordsisthattheybothcontainadifferentnumberofdatafields.
Anothercomplicationisthattheyseemtocontainbothacommaandoneormoreasterisksasdelimitercharacters.
Inthefirstrecorditappearsthatwehavefourdatafields:"Sample#1","213","32"and"23"Inthesecondrecorditappearsthatwehavesevendatafields:"Sample#2","215","437","141","797","89"and"56"ThereareactuallyseveralwaystoconfigureWinWedgetocorrectlyparsebothrecordsintheaboveexample.
Themostelegantmethodistousethe"Pre-InputCharacterTranslationTable"tomodifythedelimiterssothattheyareallthesame.
Forexample,wecouldtranslateallasteriskstocommastoendupwiththetworecordsshownbelow:Sample#1,,213,,32,,,,23,,Sample#2,,215,,437,,141,,797,,89,,56Nowbothrecordsobviouslyhavemultiple,delimited,datafieldswithacarriagereturn-linefeedsignalingtheendofeachrecord.
Wenowdeterminethemaximumnumberoffieldsinarecordbyaddingupthenumberofdelimitersineachrecordandaddingone.
(i.
e.
thefirstrecordhas11fieldsandthesecondrecordhas13fieldsthereforethemaximumnumberofdatafieldsis13).
Now,whenyoudefinetherecordstructureinWinWedgeyouwouldselect"AnyCharacterReceived"astheStartOfRecordEventand"CarriageReturnorCrLfReceived"astheEndOfRecordEventandfortheRecordStructureyouwouldchoose"MultipleDelimitedDataFields"andspecifythatthemaximumnumberofdatafieldsperrecordis13withacommadelimiterseparatingeachfield.
Whenparsingrecordswithmultipledelimiteddatafields,ifyouchooseaspacecharacterasyourdelimiter,thenconsecutivespaceswouldbetreatedasasingledelimiter.
Therefore,intheaboveexample,ifinsteadoftranslatingasteriskstocommas,youweretotranslatebothcommasandasteriskstospaces,andthenyouchosethespacecharacterasyourdelimiter,youwouldeffectivelyendupwiththetworecordsshownbelowwitheachfieldnowseparatedbyasingle(space)delimiter:Sample#12133223Sample#2215437141797895692Supposeyouhadadevicethatnormallysentitsoutputtoaserialprinterinthefollowingmannerwithmorethanonelineofdata:Device#HeightWidthLengthCrLf>1231224227138327139427138CrLf>(representsacarriagereturn-linefeedandrepresentstheformfeedcharacter)Youcanstillthinkoftheentireoutputshownaboveasasingledatarecordeventhoughitcontainsseverallinesofdataoryoucanthinkofeachindividuallineasacompleterecord.
(Infact,youcouldeventhinkofeachwordornumberoutputtedfromthedeviceasacomplete,singlefield,datarecord).
AgaintherearemanydifferentwaystoparsetheentireoutputfromthedeviceusingthedifferentfeaturesavailableinWinWedge.
Ifyouwantedtocaptureonlythelineswithnumericdataandparseeachoftheselinesintorecordswithfourfields,onewaytoaccomplishthiswouldbetospecifythe"StartOfRecordEvent"as"NumericCharacterReceived"andthenspecifythe"EndOfRecordEvent"as"CarriageReturnorCrLfReceived".
Finallyyouwoulddefinetherecordstructureas"MultipleDelimitedDataFields"withfourfieldsperrecordandaspacecharacterasthedelimiter.
Becauseyouchose"NumericCharacterReceived"asthe"StartOfRecordEvent"andbecausetherearenonumericcharactersinthefirst,second,seventhandeighthlinesofdata,theselineswouldbeignored.
Ifyouwantedtocapturethenumericdataasabovebutwithall16numbersinonerecord,youcouldagainspecifythe"StartOfRecordEvent"as"NumericCharacterReceived"andthenspecifythe"EndOfRecordEvent"as"SpecialCharacterReceived"andselecttheDash("-")characterasthespecialcharacter.
Next,usingthePre-InputCharacterTranslationTable,youwouldtranslateallcarriagereturnsandlinefeedstospacesandfinallyyouwoulddefinetherecordstructureas"MultipleDelimitedDataFields"with16fieldsperrecordandthespacecharacterasthedelimiter.
OnceyouunderstandallofthefeaturesprovidedinWinWedge,youcangetverycreativewithhowyoudealwiththedatafromyourinstrument(s).
93TheimportantpointstorememberarethatWinWedgealwayswaitsuntiltheselected"StartOfRecordEvent"occursbeforeitstartsreadinginanydata;afterwhichitkeepsreadingincharactersuntilthespecified"EndOfRecordEvent"occurs.
Whenthe"EndOfRecordEvent"occurs,WinWedgetakesthedatarecordthatitjustreceivedandparsesitaccordingtothedefinitionoftheRecordStructurethatyouselected(i.
e.
SingleField,MultipleDelimitedFieldsorMultipleFixedLengthFields).
Foreachfieldthatyouhavedefined,WinWedgeappliesthechosenfieldfilterandthenpasseseachfieldtothetargetapplicationinsequencesendingeachfieldfollowedbythefield's"PostambleKeystrokes"thatyoudefined.
Inmanycasesyoucoulddefinethestructureofyourinputdatainmanydifferentways.
Forexampleifyourdevicetransmittedthefollowingdatainburstswithsometimebetweenbursts,youcoulddefinethe"EndOfRecordEvent"aseither"CarriageReturnorCrLfReceived"oras"TimeDelayBetweenRecords".
1,23,12,242,27,13,83,27,13,9Ifyouspecified"CarriageReturnorCrLfReceived"asthe"EndOfRecordEvent"thenWinWedgewouldseethedataasthreerecordswithfourfieldsperrecord.
Ifyouspecified"TimeDelayBetweenRecords"andalsousedthe"Pre-InputTranslationTable"totranslatecarriagereturnstocommasandlinefeedsto"Nul"or"Ignore",thenthedatawouldappeartoWinWedgeasfollows:1,23,12,24,2,27,13,83,27,13,9Inotherwordsyoucanthinkoftheoriginaldataaboveaseitherthreerecordscontainingfourfieldseachorasasinglerecordwith12fields.
Again,aslongasyouunderstandthedatafromyourserialdeviceandhaveaclearunderstandingofthefullcapabilitiesofWinWedge,youcantransformalmostanyserialdatacollectionproblemintoanextremelysimpletask.
SeeAlso:DefiningTheInputDataRecordStructure(pg.
25)ThePre-InputCharacterTranslationTable(pg.
34)94MoreWinWedgeConfigurationExamplesAcommontaskforWinWedgeistointerfaceaGagePortorGagePortNTtoaPCandtotakereadingsfromameasuringtoollikeagageorcaliperdirectlyintoaspreadsheet,(typicallyExcel),andhaveeachreadingfromthegageenteredintothespreadsheetsothattheyarestackedupinacolumn.
ThissectiondescribesatypicalconfigurationforboththeGagePortandWinWedge.
Note:ThedefaultconfigurationofaGagePorttransmitsdatarecordscontainingfourcommadelimiteddatafieldswithacarriagereturnattheendoftherecord.
Manyotherdevicestransmitdatainasimilarmannerthereforethisexamplemaybeapplicabletootherdevices.
ForexampleX-RiteDensitometers(usedformeasuringCyan,Yellow,MagentaandBlackcolordensities)alsotransmitrecordswithfourfieldsofdataandacarriagereturnattheendofeachrecord.
TheonlydifferencebetweendatafromthedensitometerandthedatafromaGagePortisthatthedensitometerusesasinglespaceasthedelimiterbetweeneachofthefourdatafields.
ItisverypossiblethatwhateverdeviceyouhappentobeusingalsohasasimilaroutputtoaGagePortthereforeevenifyouarenotusingaGagePort,youmayfindthisexampletobeeducational.
StepsforsettinguptheGagePort:1.
SetupyourGagePortin"PrinterMode"aspertheinstructionsprovidedwiththeGagePort.
ThisisdoneusingtheDIPswitchesontheGagePortorbysendingcommandstotheGagePortthroughtheserialport.
Also,usetheDIPswitchestosetthecommunicationsparametersfortheGagePortto9600baud,NoParity,EightDataBitsandOneStopBit.
WhensettoPrinterMode,areadingissentfromtheGagePortineitherofthethreefollowingcases:a.
Whenyoupressthe"transmit"buttononyourgage.
b.
WhenyoupressthefootswitchconnectedtotheGagePort.
c.
WhenapromptistransmittedthroughtheserialporttotheGagePortrequestingdata.
2.
ConnecttheGagePorttoaCOMportonyourPCusingthecableprovidedwithit.
StepsforSettingupWinWedge:Forthissituation,theeasiestwaytouseWinWedgeistosetitupin"SendKeystrokes"modesothatitwillconvertincomingserialdatatokeystrokesandthuscauseyourdatafromyourGagePorttoappearasifitisbeingtypedinonyourkeyboard.
1.
RunWinWedgebydoubleclickingonitsiconintheStartMenuinWindows.
952.
FromWinWedgeMODEmenu,select"SendKeystrokesTo.
.
.
"(evenifitisalreadychecked).
Thiswillcauseawindowtoappearaskingforthe"TitleBarText"and"CommandLine"fortheapplicationwhereyouwantthekeystrokessent.
Clearoutbothoftheseitemssothattheyarecompletelyempty(noblankspacesorvisiblecharacters).
ByclearingouttheseitemsandthusnotspecifyinganapplicationforWinWedgetosendthekeystrokesto,WinWedgewillsimplyactasasecondkeyboardandsendtheincomingserialdatatowhateverapplicationhasthecurrentinputfocus,i.
e.
thecurrentforegroundprogram.
3.
Select"Settings"fromthePORTmenuinWinWedgeandwhenthePortSettingswindowappears,choosethecommunicationsparameters:9600baud,NoParity,EightDataBitsandOneStopBitandthenclicktheOKbuttontoreturntothemainmenu.
4.
TotestthattheGagePortisconnectedproperlyandthatyourserialcableisworking,select"Analyze"fromthePortmenuinWinWedge.
WhenthePortAnalyzewindowappears,transmitareadingtoWinWedgebyeitherpressingtheTransmitbuttononyourgageorbypressingthefootswitchconnectedtotheGagePort.
Ifyourgagedoesnothaveatransmitbuttonorafootswitch,thenplacethecursorinthe"OutputBuffer"textboxintheAnalyzewindowandtypeinanuppercase"A"followedbyalowercase"r"andthenclickthebuttonmarked"Send".
IfareadingistransmittedsuccessfullyfromtheGagePort,youshouldseesomedatainthetextboxmarked"InputBuffer".
Youshouldreceive25charactersandthedatashouldbeinthefollowingformat:NNNN,UUUUU,PPThemeaningsofthefourfieldsareasfollows:NNNNFourdigitreadingnumber.
Tendigitgagereadingwithdecimalplaceandminussignifthereadingisnegative.
UUUUUFiveblankspaces.
PPTwodigitportnumber.
Trailingcarriagereturn.
(ShouldappearasamusicalnoteintheAnalyzewindow.
)IfyoudonotreceiveanydataintheInputBufferintheAnalyzewindow,theneithertheGagePortisnotconnectedproperlyoritisnotconfiguredcorrectly.
IfyoudogetdataintheInputBufferbutthedataiseithergarbledorconsistsofunreadablecharacters,thenyoumostlikelyhavethewrongcommunicationsparametersselectedineitherWinWedgeorintheGagePort.
(ThecommunicationsparameterssetinbothWinWedgeandtheGagePortmustmatch.
)RefertothetroubleshootingsectionofWinWedgeusersmanualforfurtherassistance.
AfteryougetgooddataintheAnalyzewindowinWinWedge,clicktheQuitbuttontoreturntothemainmenu.
5.
ThenextstepistoconfigureWinWedgetoparseandfilterthedatafromtheGagePortsothatyougetonlythedatathatyouareinterestedintoappearinyourspreadsheet.
InthiscasewewillassumethatyouareonlyinterestedintheactualreadingonthegageandthatnoneoftheotherinformationtransmittedbytheGagePortiswanted.
96Select"InputDataRecordStructure"fromtheDEFINEmenuinWinWedge.
Thefirstwindowtoappearwillpromptyoufora"StartOfRecordEvent"andan"EndofRecordEvent".
FortheStartofRecordEvent,choose"AnyCharacterReceived"andfortheEndofRecordEvent,choose"CarriageReturnorCrLfReceived"andclicktheCONTINUEbuttontoproceed.
Inthenextwindowtoappearpromptingfora"RecordStructure",select"MultipleDelimitedDataFields"andclicktheCONTINUEbutton.
Thiswilldisplayanotherwindowpromptingfora"DelimiterCharacter"andthe"MaximumNumberofDataFields".
ChoosetheComma(,)forthedelimitercharacterandenter4forthemaximumnumberofdatafieldsandclicktheCONTINUEbuttontoproceed.
Thefinalwindowtoappearisthe"InputRecordDefinitionEditor"window.
ThiswindowallowsyoutoselectfiltersthatcanbeappliedtoeachdatafieldintheincomingserialdataaswellasdefineanyadditionalkeystrokesthatyouwantissuedbeforeoraftereachindividualdatafieldissentfromWinWedgetotheapplicationwhereyouwantthedatatogo.
Select"IgnoreThisField"forthefilterforField1(leaveallothertextboxesblank)andclickthebuttonmarked"NextField".
Select"NumericDataOnly"forthefilterforField2andplacethecursorinthetextboxmarked"FieldPostambleKeystrokes"andclickthebuttonmarked"KeystrokeList".
Whenthekeystrokelistappears,scrollthelistuntiltheword"ENTER"ishighlightedandthenclicktheOKbutton.
Thisshouldcausetheword"{ENTER}"toappearintheFieldPostambleKeystrokestextbox.
Clickthebuttonmarked"NextField"andselect"IgnoreThisField"forthefilterforField3andclickthe"NextField"buttonagainandselect"IgnoreThisField"forthefilterforField4.
Finally,clicktheOKbuttontoreturntothemainmenuofWinWedge.
6.
Saveyourworkbyselecting"Save"or"SaveAs.
.
.
"fromtheFILEmenu.
SaveyourconfigurationfileusingthefilenameGAGEPORT.
SW37.
ThefinalstepistoactivateWinWedgebyselecting"TestMode"fromtheACTIVATEmenu.
AfterWinWedgehasbeenactivatedyoucanopenupExcelandplacethecursorinacellandwheneveryoutakeareadingonyourgage,thereadingshouldappearinthecellandthecursorshouldautomaticallymovedownonecell.
97AMoreComplexExampleThisexampleexploressomeofthelessobviousfeaturesofWinWedgeandhowtoapplythemtoamorecomplexsituation.
InthisexamplewewillassumethatyouhavealreadygonethroughthefirstfourstepsforsettingupWinWedgeoutlinedinthepreviousexampleandhavediscoveredthatthedatatransmittedbyyourinstrumentisstructuredasfollowswithfourlinesofdataandeachlineterminatedbyacarriagereturn:DataWidgetCoordinatesx=100.
7,xdeviation=.
50y=-170.
25,ydeviation=.
38z=110,zdeviation=-.
5Forourparticularapplication,weareinterestedincapturingonlythex,yandzvaluestoaspreadsheetsuchthatthethreevaluesappearnexttoeachotheronthesamerowbutinseparatecolumns.
i.
e.
withonecolumnof"x"values,onecolumnof"y"valuesandonecolumnof"z"values.
Wealsowanttoignorethefirstlineoftextandalsoeachofthethree"deviation"values.
Ifyouthinkoftheentireoutputfromthedeviceasasingledata"Record"containingagroupofdatafields,thefirstthingwemustdoistofigureoutawaytoisolatethethreex,yandzfieldsfromtherestofthedatausingtheparsingandfilteringcapabilitiesofWinWedge.
ThereareactuallyseveralwaystoachievetheresultsthatwewantusingdifferentfeaturesinWinWedge.
Oneapproachistofirstusethe"PreInputTranslationTable"totranslateallcommastocarriagereturnssothatourdataappearstoWinWedgeasfollowswiththesamedelimitercharacterseparatingeachindividualdatafield:Field1DataWidgetCoordinatesField2x=100.
7Field3xdeviation=.
50Field4y=-170.
25Field5ydeviation=.
38Field6z=110Field7zdeviation=-.
5Toperformthistranslation,select"PreInputTranslationTable"fromtheDEFINEmenuandwhenthetranslationtableappears,scrolldowninthetableuntilthe"comma"characterishi-lightedandthenclickthebuttonmarked"Translate.
.
.
".
IntheASCIIchartthatappears,scrolldowntothecarriagereturncharacter(ASCII13)andclickonthe"OK"buttonintheASCIIchartwindow.
Afteryouperformthetranslation,youcanexitfromthetranslationtablebyclickingthe"OK"buttoninthetranslationtablewindow.
Lookingatthedatanow,wecanidentifysevendistinctdata"fields",eachofwhichisdelimitedfromthenextbyacarriagereturn.
98ThenextstepistodescribethestructureofthedatatoWinWedgeandalsospecifyhowWinWedgeshouldparseandfilterthedatasothatwegettheresultsthatwewant.
Ifweexaminethedata(withcommastranslatedtocarriagereturns),weseethatwewouldliketoignorethefirst,third,fifthandseventhfieldsandwealsoneedtofilterthesecond,fourthandsixthfieldssothatonlythenumericdataissenttoourspreadsheet.
Finally,togetthedataintoourspreadsheetinthreecolumns,weneedtoaddarightarrowkeypressafterthesecondandfourthfieldandadownarrowandtwoleftarrowkeypressesafterthesixthfield.
Todothis,select"InputDataRecordStructure"fromtheDEFINEmenuandforthe"StartofRecordEvent"specify"AnyCharacterReceived".
Forthe"EndofRecordEvent",specify"CarriageReturnorReceived"andclickonthe"Continue"buttontoproceed.
Inthenextwindow,specify"MultipleDelimitedDataFields"astherecordstructureandclickonthe"Continue"button.
Thenextwindowtoappearallowsustospecifythedelimitercharacterandalsospecifythemaximumnumberofdatafieldsineachdatarecord.
Inthiscaseourdelimitercharacteristhecarriagereturn(ASCII13)andthemaximumnumberofdatafieldsineachrecordisseven.
Afterenteringtheseparameters,clickonthe"Continue"button.
Thefinalwindowtoappearallowsustospecifyafilterforeachfieldaswellasany"FieldPostambleKeystrokes"thatwewanttoaddtothedata.
Gothroughthefollowingstepstospecifytherequiredfiltersandpostamblekeystrokes:Placethecursorinthe"Filter"listboxandselect"IgnoreThisField"asthefilterforField1.
Usethe"NextField"and"PreviousField"buttonstoscrollthroughtheparametersforeachofthesevendatafieldsandselect"IgnoreThisField"asthefilterforFields1,3,5and7andselect"NumericDataOnly"asthefilterforFields2,4and6.
Clickthe"PreviousField"buttonuntilyouarebacktotheparametersforField2.
Placethecursorinthe"FieldPostambleKeystrokes"editboxandthenclickonthebuttonmarked"KeystrokeList".
Whenthekeystrokelistwindowappears,scrolldownuntiltheword"RIGHT"ishi-lightedandclickthe"OK"buttoninthekeystrokelistwindow.
Thisshouldcausetheword"{RIGHT}"toappearintheFieldPostambleKeystrokeseditbox.
Clickonthe"NextField"buttontwicetoadvancetotheparametersforField4andrepeattheprevioussteptoaddarightarrowkeypressafterField4.
Clickonthe"NextField"buttontwicetoadvancetotheparametersforField6andenterthefollowingtextintheFieldPostambleKeystrokestextbox:{DOWN}{LEFT2}ClickontheOKbuttontoreturntothemainmenu.
Finally,select"TestMode"fromtheACTIVATEmenu,openupyourspreadsheetandmovethecursortothecellwhereyouwantthefirstxvaluetoappearandstartcollectingdata.
SeeAlso:DefiningtheInputDataRecordStructure(pg.
25)CoolWedgeTricks(pg.
99)99CoolWedgeTricksDefiningLessDataFieldsThanAreActuallyReceivedIfyoudefineyourInputDataRecordStructurewithlessdatafieldsthanactuallyappearinyourdata,WinWedgewillignoreanyadditionaldatathatitreceivesafterthelastfieldthatyouhavedefinedinWinWedge.
Youcouldalsotakeadvantageofthisbehaviorbyinsituationswhereadevicetransmitsmoredatathanyouareactuallyinterestedin.
Forexamplesupposeyouhadadevicethattransmitted50commadelimiteddatafieldsfollowedbyacarriagereturnandyouwereonlyinterestedinthedatathatappearsinthefirstthreefields.
YoucoulddefinetheinputdatarecordstructurebyspecifyingtheEndOfRecordEventas"CarriageReturnorCrLfReceived"andthenspecifyingthe"RecordStructure"as"MultipleDelimitedDataFields"withacommaasthedelimiterandspecifyingthreeforthemaximumnumberofdatafields.
Theactualdatahas50datafieldsbeforethecarriagereturnsobyspecifyingthreeforthemaximumnumberoffields,youwillendupwithonlythefirstthreedatafieldsinWinWedgeandtheremaining47fieldswillbeignored.
DealingWithContinuousDataThereareafewtypesofinstrumentsthattransmitdataeithercontinuouslyorinburstswithmanydatavaluesarrivinginsuccessionoverashortperiodoftime.
Forexamplemanyolderelectronicbalancesweredesignedtotransmitcontinuousdatatoadigitaldisplaysothatyoucouldwatchtheweightreadingchangeonthedisplay.
Theytypicallytransmitupto10weightvaluespersecondanddonotprovideawaytostopthedatafromflowing.
(Mostnewerbalancesareconfigurabletotransmitdataonlyinresponsetoapromptsentthroughtheserialportorbypressinga"Print"buttononthebalance.
ThisisthebestwaytouseabalancewithWinWedge.
)Therearealsosomedevicesliketensilestrengthtestersorfrictionpeeltestersthatperformatestoverashortperiodoftimeandforthedurationofthetesttheytransmitalargenumberofdatavalues.
Althoughyoumaynotbeabletoconfigurethedevicetosendlessdata,youmaybeabletoconfigureWinWedgetoignoreenoughofthereadingssothatyouarenotoverwhelmedwithdata.
OnewaytodothisistoconfigureWinWedgetotreatmultipledatarecordsasonelongrecordcontainingmultiplefieldsandthensimplyignoremostofthefields.
Forexample,mostelectronicbalancestransmitaweightreadingfollowedbyacarriagereturnandalinefeedcharacter.
Normallyyouwoulddefinethe"InputDataRecordStructure"with"CarriageReturnorCrLfReceived"asthe"EndofRecordEvent"andthenspecify"SingleFieldDataRecords"asthe"RecordStructure"forthistypeofdata.
Ifinstead,youchose"MultipleDelimitedDataFields"asthe"RecordStructure"andchosetheCarriageReturn(ASCII13)asthedelimiterandalsospecified30forthe"MaximumNumberOfDataFields"andfinallychose"IgnoreThisField"forthefiltersforFields1through29,youwouldeffectivelyremove29outofeach30datareadingstransmittedbythebalance.
Ifthebalancesenttenreadingspersecond,WinWedgewouldonlypassasinglereadingthroughtoanotherapplicationonceeverythreeseconds.
100AnotherwaytocontrolcontinuousdataistoconfigureWinWedgesothatitisinitiallysuspendedwhenyoufirstactivateit(selectthe"ActivateInitiallySuspended"optionfromtheActivatemenu).
IfWinWedgeisActivatedbutsuspended,itwillcontinuetoinputserialdataintoitsinputbufferhoweveritwillnotpassanydatatoanotherapplicationuntilyouresumeit.
Next,youcoulddefineonehotkeythatresetsWinWedgeandthendefineanotherhotkeythatresumesWinWedgeforonedatarecord.
AfteryouactivateWinWedgeitwillnotdoanythinguntilyoupressyourtwohotkeys.
Whenyoupressthe"reset"hotkey,WinWedgewillresetitself(causingittoflushitsinputbuffer)andthenwhenyoupressthe"Resumefor1datarecord"hotkey,itwillenableitselfforonedatarecord.
Afterthenextrecordisreceived,WinWedgewillsuspenditselfagain.
Ifyouusetheabovetechnique,makesurethatyouselecta"StartofRecordEvent"thatwillreliablydeterminethebeginningofeachdatarecord(i.
e.
donotselect"AnyCharacterReceived"astheStartofRecordEvent).
Thereasonforthisisbecauseifthedeviceisinthemiddleoftransmittingadatarecordwhenyoupressyourhotkey,theresethotkeyactioncausesWinWedgetoclearoutitsinputbufferthuschoppingoffthefirsthalfofthedatarecordbeingreceived.
Ifyouhad"AnyCharacterReceived"selectedastheStartofRecordEvent,thesecondhalfofthedatarecordwouldbereceivedasifitwereacompleterecord.
Choosing"SpecialCharacterReceived"astheStartofRecordEventandusingtheLineFeed(ASCII10)asthe"SpecialCharacter"wouldbeagoodchoiceinthissituation.
Sincethedeviceistransmittingacontinualstreamofdatarecordswithacarriagereturnandalinefeedattheendofeachdatarecord,youcouldjustaseasilythinkofthelinefeedasthestartofeachrecordandthecarriagereturnastheend.
Toremovethelinefeedandthecarriagereturnfromeachrecord,youcanuseeitherthe"Pre-TransferCharacterTranslationTabletotranslatethemto"Nul"oryoucanapplya"NumericDataOnly"filtertothefield(s)inWinWedgethatcontainsthem.
SeeAlso:DefiningtheInputDataRecordStructure(pg.
25)SpecialConsiderationsRegardingDelimiterCharacters(pg.
30)DefiningHotKeysandHotKeyActions(pg.
40)ThePre-TransferCharacterTranslationTable(pg.
34)SendingDataasKeystrokestoanapplicationWhilePassingDatatoAntherProgramViaDDEAlthoughWinWedgehasanexplicit"DDEServerMode",itisactuallyaDDEServernomatterwhatmodeitisin(i.
e.
"SendKeystrokes").
ThereasonthatWinWedgehasaDDEServerModeatallissothatyoucanconfigureittosendaDDEcommandtoanotherapplicationaftereachinputandthusforcetheotherapplicationtodosomethingwiththedatathatwasjustsent.
SupposethatyouwantedtosenddataaskeystrokestooneapplicationandpassthedatatoanotherprogramviaDDEinrealtime.
YoucouldsetupWinWedgeinSendKeystrokesmodeandstillpassthedatathroughDDElinkstoanotherprogram.
TheonlyproblemthatyoumightrunintoisthatyouwillnotbeabletoconfigureWinWedgetosendaDDEcommandtotheotherprogramandthusforceittodosomethinglikerunamacroaftereachinputdatarecord.
ManyapplicationsthatsupportDDEalsoprovideawaytomonitoractiveDDElinkssothattheapplicationautomaticallyrunsamacrowhenitdetectsnewdatafromaDDEserver.
Excelforexamplehasafunctioncalled"SetLinkOnData"thatforcesittorunamacrowheneverdatafromaDDEserverchanges.
SeeAlso:DDEExamplesforExcel(pg.
64)101MakingGoodUseOfThePre-InputCharacterTranslationTableThe"Pre-InputCharacterTranslationTable"inWinWedgeallowsyoutotranslateASCIIcharacterstoothercharactersbeforebeinginputtedtoWinWedge.
Typically,thisfeatureisusedtoconvertdelimitercharacterssothattheywillallbethesamecharacterwhenWinWedgereceivesthedata.
Forexample,supposeyouhadadevicethattransmittedthefollowingdatarecord:123.
53,46.
20,03:45:21Intheabovedatarecordtherearetwodifferentdelimitercharactersbeingused,thecommaandthecolon.
Ifyoutranslatedthecolonstocommasinthe"Pre-InputCharacterTranslationTable",thenthedatarecordwouldappeartoWinWedgeas:123.
53,46.
20,03,45,21Nowthatallthedelimitersarethesame,youcoulddefinetherecordstructureinWinWedgeas"MultipleDelimitedDataFields"usingthecommaasthedelimiterwithfivefieldsineachrecord.
The"Pre-InputCharacterTranslationTable"alsoallowsyoutotranslatecharacterstoeither"Ignore"or"VoidRecord".
The"Ignore"translationremovesthecharacterfromtheinputdataasifthecharacterdidnotexist.
The"VoidRecord"translationcausesWinWedgetodisregardtheentirecurrentdatarecordifacharacterthathasbeentranslatedto"VoidRecord"appearsanywherewithintherecord.
Thisfeaturecanbeusedrejectcertaindatarecordsfromadevice.
Forexample,supposeyouhadadevicethattransmittedthefollowingdata:Device#HeightWidthLengthCrLf>1231224227138327139427138CrLf>Sinceyouareprobablynotinterestedinthefirstlineorthelinescontainingthedashes,youcouldusethe"VoidRecord"translationtoremovetheselinesbytranslatingthedashcharacterandtheuppercase"D"to"VoidRecord".
Afterthetranslations,WinWedgewouldeffectivelyreceivethedataasshownbelow:1231224227138327139427138SeeAlso:ThePre-InputCharacterTranslationTable(pg.
34)102SendingdataaskeystrokestomorethanoneapplicationatatimeOnewaytopassdatatotwoWindowsprogramsistosendthedatatothefirstapplicationandthenusewhateverkeystrokesarenecessaryinthatapplicationtocopythedatatotheclipboard,switchthefocustothesecondapplicationandfinallypastethedataintothesecondapplication.
Evenifneitheroftheapplicationsprovidesanexplicitcopyorpastefunction,youcanalwayscopytexttotheclipboardinanyWindowsprogrambyfirstselectingthetextandissuingthekeystrokeCtrl+Insert.
Ina"FieldPostambleKeystroke"macroinWinWedge,Ctrl+Insertisrepresentedby:^{INSERT}.
Likewise,youcanpastetextdatafromtheclipboardintoanyWindowsprogramusingthekeystrokesShift+Insert.
InWinWedgeShift+Insertisrepresentedby:+{INSERT}.
Toselecttextinanyprogramyoucanusuallyholddowntheshiftkeywhileusingthearrowkeys,Home,End,PageUpandPageDownkeystohighlightandselectcharacters.
WindowswillalsoswitchthefocusbetweenallrunningapplicationwhenyouholdtheAltkeydownandpresstheTabkey.
Windowsmaintainsalistofallcurrentlyrunningapplicationswiththeapplicationthatcurrentlyhastheinputfocusplacedatthetopofthelist.
Ifyouswitchtoanotherapplication,thenewapplicationmovestothetopofthelistandthepreviouslyactiveapplicationmovesdownonespotinthelist.
WhileholdingtheALTkeydown,eachtimeyoupressthetabkey,Windowsmovesdownthelistoneitemandselectstheapplicationatthatpositioninthelist.
WhenyoureleasetheAltkey,theselectedapplicationisgiventhefocusandismovedtothetopofthelistpushingallotherapplicationthatwereaboveitinthelistdownonespot.
Forexample,ifyouhadWinWedgesetuptosendkeystrokestoNotePadandyoualsowantedtosendthedatatoWordPadyoucouldusethefollowingprocedure:SetupWinWedgein"SendKeystrokes"modespecifyingtheNotePadprogramasthetargetforallkeystrokesfromWinWedge.
Next,configureWinWedgetoworkwithyourserialdeviceandthenaddthefollowingcharacterstotheendofthe"FieldPostambleKeystrokes"forthelastdatafieldthatyouhavedefinedinWinWedge:+({LEFT}{HOME})^{INSERT}{DOWN}%{TAB}+{INSERT}ActivateWinWedgeandthenlaunchtheWordPadprogramandthenlaunchtheNotePadprogram.
AtthispointNotePadhasthefocusandisthereforeatthetopoftheWindowlistwiththeWordPadprogramdirectlyunderneathit.
Whenyouinputdatafromyourdevice,itwillbesenttobothNotePadandWordPad.
Thekeystrokes:+({LEFT}{HOME})meansholdtheshiftkeywhilepressingtheleftarrowandthehomekey.
Thisselectsalltextinthecurrentline.
Thekeystrokes:^{INSERT}meansCtrl+Insertandcausesallselectedtexttobecopiedtotheclipboard.
The{DOWN}keystrokethatfollowsistheretode-selectthecurrentlyselectedtext.
Thekeystrokes:%{TAB}meansAlt-TabandcausesWindowstoswitchthefocustoWordPad.
Finally,thekeystrokes:+{INSERT}meansshift+insertandperformsthejobofpastingthedatafromtheclipboardintoWordPad.
TosendthedatatothreeWindowsprogramsatatimeyoucouldusethefollowing"FieldPostambleKeystrokes":+({LEFT}{HOME})^{INSERT}{DOWN}%{TAB}+{INSERT}%{TAB2}+{INSERT}103InvokinghotkeysinotherapplicationsAlmostallspreadsheets,databases,wordprocessorsandmostotherlargescaleapplicationprogramsallowyoutoeitherrecordmacrosorcreatesubroutinesthatcanbeinvokedwithahotkeywhileyouareworkingwithintheapplication.
ForexamplewhenyouwriteaVBAsubroutineinExcel,youcanassignthesubroutinetoa"ShortcutKey"sothatallyouhavetodotorunthesubroutineispresstheshortcutkeykeystroke.
YoucouldinvokeExcelsubroutinesfromWinWedgebyplacingtheshortcutkeykeystrokeforasubroutineineitherthe"RecordPreambleKeystrokes"orthe"FieldPostambleKeystrokes"whenyoudefineyour"InputDataRecordStructure"inWinWedge.
Youcouldalsousethe"Pre-TransferCharacterTranslationTable"totranslatespecificcharactersthatmightappearinyourserialdatatokeystrokesthatwouldinvokedifferentExcelsubroutines.
104INTRODUCTIONTOSERIALCOMMUNICATIONSMostPCsareequippedwithoneortwoserialportsandoneparallelport.
(SomenewerPCsdonotcomewithserialportsatallhoweveritisextremelyeasytoaddserialportsbypurchasingUSBtoRS232add-onadapters.
Theyareavailableatmostcomputerorofficesupplystoresforunder$25).
Aparallelportsendsandreceivesdataeightbitsatatimeover8separatewires.
Thisallowsdatatobetransferredveryquickly;however,thecablerequiredismorebulkybecauseofthenumberofindividualwiresitmustcontain.
ParallelportsaretypicallyusedtoconnectaPCtoaprinterandarerarelyusedformuchelse.
Aserialportsendsandreceivesdataonebitatatimeoveronewire.
Whileittakeseighttimesaslongtotransfereachbyteofdatathisway,onlyafewwiresarerequired.
Infact,two-way(fullduplex)communicationsispossiblewithonlythreewires-onetosend,onetoreceive,andacommonsignalgroundwire.
Bi-directionalCommunicationsTheserialportonyourPCisafull-duplexdevicemeaningthatitcansendandreceivedataatthesametime.
Inordertobeabletodothis,itusesseparatelinesfortransmittingandreceivingdata.
Sometypesofserialdevicessupportonlyone-waycommunicationsandthereforeuseonlytwowiresinthecable-thetransmitlineandthesignalground.
SynchronousAndAsynchronousCommunicationsTherearetwobasictypesofserialcommunications,synchronousandasynchronous.
Withsynchronouscommunications,thetwodevicesinitiallysynchronizethemselvestoeachother,andthencontinuallysendcharacterstostayinsync.
Evenwhendataisnotbeingsent,aconstantflowofbitsallowseachdevicetoknowwheretheotherisatanygiventime.
Thatis,eachcharacterthatissentiseitheractualdataoranidlecharacter.
Synchronouscommunicationsallowsfasterdatatransferratesthanasynchronousmethods,becauseadditionalbitstomarkthebeginningandendofeachdatabytearenotrequired.
ThestandardserialportsonallPCsareasynchronousdevicesandthereforeonlysupportasynchronousserialcommunications.
Asynchronousmeans"nosynchronization",andthusdoesnotrequiresendingandreceivingidlecharacters.
However,thebeginningandendofeachbyteofdatamustbeidentifiedbystartandstopbits.
Thestartbitindicatewhenthedatabyteisabouttobeginandthestopbitsignalswhenitends.
Therequirementtosendtheseadditionaltwobitscauseasynchronouscommunicationstobeslightlyslowerthansynchronoushoweverithastheadvantagethattheprocessordoesnothavetodealwiththeadditionalidlecharacters.
Anasynchronouslinethatisidleisidentifiedwithavalueof1,(alsocalledamarkstate).
Byusingthisvaluetoindicatethatnodataiscurrentlybeingsent,thedevicesareabletodistinguishbetweenanidlestateandadisconnectedline.
Whenacharacterisabouttobetransmitted,astartbitissent.
Astartbithasavalueof0,(alsocalledaspacestate).
Thus,whenthelineswitchesfromavalueof1toavalueof0,thereceiverisalertedthatadatacharacterisabouttocomedowntheline.
105CommunicatingByBitsOncethestartbithasbeensent,thetransmittersendstheactualdatabits.
Theremayeitherbe5,6,7,or8databits,dependingonthenumberyouhaveselected.
Bothreceiverandthetransmittermustagreeonthenumberofdatabits,aswellasthebaudrate.
Almostalldevicestransmitdatausingeither7or8databits.
Noticethatwhenonly7databitsareemployed,youcannotsendASCIIvaluesgreaterthan127.
Likewise,using5bitslimitsthehighestpossiblevalueto31.
Afterthedatahasbeentransmitted,astopbitissent.
Astopbithasavalueof1-oramarkstate-anditcanbedetectedcorrectlyevenifthepreviousdatabitalsohadavalueof1.
Thisisaccomplishedbythestopbit'sduration.
Stopbitscanbe1,1.
5,or2bitperiodsinlength.
TheParityBitBesidesthesynchronizationprovidedbytheuseofstartandstopbits,anadditionalbitcalledaparitybitmayoptionallybetransmittedalongwiththedata.
Aparitybitaffordsasmallamountoferrorchecking,tohelpdetectdatacorruptionthatmightoccurduringtransmission.
Youcanchooseeitherevenparity,oddparity,markparity,spaceparityornoneatall.
Whenevenoroddparityisbeingused,thenumberofmarks(logical1bits)ineachdatabytearecounted,andasinglebitistransmittedfollowingthedatabitstoindicatewhetherthenumberof1bitsjustsentisevenorodd.
Forexample,whenevenparityischosen,theparitybitistransmittedwithavalueof0ifthenumberofprecedingmarksisanevennumber.
Forthebinaryvalueof01100011theparitybitwouldbe0.
Ifevenparitywereineffectandthebinarynumber11010110weresent,thentheparitybitwouldbe1.
Oddparityisjusttheopposite,andtheparitybitis0whenthenumberofmarkbitsintheprecedingwordisanoddnumber.
Parityerrorcheckingisveryrudimentary.
Whileitwilltellyouifthereisasinglebiterrorinthecharacter,itdoesn'tshowwhichbitwasreceivedinerror.
Also,ifanevennumberofbitsareinerrorthentheparitybitwouldnotreflectanyerroratall.
Markparitymeansthattheparitybitisalwayssettothemarksignalconditionandlikewisespaceparityalwayssendstheparitybitinthespacesignalcondition.
Sincethesetwoparityoptionsservenousefulpurposewhatsoever,theyarealmostneverused.
BaudVersusBitsPerSecondThebaudunitisnamedafterJeanMauriceEmileBaudot,whowasanofficerintheFrenchTelegraphService.
Heiscreditedwithdevisingthefirstuniform-length5-bitcodeforcharactersofthealphabetinthelate19thcentury.
Whatbaudreallyreferstoismodulationrateorthenumberoftimespersecondthatalinechangesstate.
Thisisnotalwaysthesameasbitspersecond(BPS).
IfyouconnecttwoserialdevicestogetherusingdirectcablesthenbaudandBPSareinfactthesame.
Thus,ifyouarerunningat19200BPS,thenthelineisalsochangingstates19200timespersecond.
Butwhenconsideringmodems,thisisn'tthecase.
106Becausemodemstransfersignalsoveratelephoneline,thebaudrateisactuallylimitedtoamaximumof2400baud.
Thisisaphysicalrestrictionofthelinesprovidedbythephonecompany.
Theincreaseddatathroughputachievedwith9600orhigherbaudmodemsisaccomplishedbyusingsophisticatedphasemodulation,anddatacompressiontechniques.
RS-232CRS-232standsforRecommendStandardnumber232andCisthelatestrevisionofthestandard.
TheserialportsonmostcomputersuseasubsetoftheRS-232Cstandard.
ThefullRS-232Cstandardspecifiesa25-pin"D"connectorofwhich22pinsareused.
MostofthesepinsarenotneededfornormalPCcommunications,andindeed,mostnewPCsareequippedwithmaleDtypeconnectorshavingonly9pins.
DCEAndDTEDevicesTwotermsyoushouldbefamiliarwithareDTEandDCE.
DTEstandsforDataTerminalEquipment,andDCEstandsforDataCommunicationsEquipment.
Thesetermsareusedtoindicatethepin-outfortheconnectorsonadeviceandthedirectionofthesignalsonthepins.
YourcomputerisaDTEdevice,whilemostotherdevicesareusuallyDCEdevices.
Ifyouhavetroublekeepingthetwostraightthenreplacetheterm"DTEdevice"with"yourPC"andtheterm"DCEdevice"with"remotedevice"inthefollowingdiscussion.
TheRS-232standardstatesthatDTEdevicesusea25-pinmaleconnector,andDCEdevicesusea25-pinfemaleconnector.
YoucanthereforeconnectaDTEdevicetoaDCEusingastraightpin-for-pinconnection.
However,toconnecttwolikedevices,youmustinsteaduseanullmodemcable.
Nullmodemcablescrossthetransmitandreceivelinesinthecable,andarediscussedlaterinthischapter.
Thelistingbelowshowstheconnectionsandsignaldirectionsforboth25and9-pinconnectors.
25PinConnectoronaDTEdevice(PCconnection)PinNameDirectionofsignal1ProtectiveGround2TransmittedData(TD)OutgoingData(fromaDTEtoaDCE)3ReceivedData(RD)IncomingData(fromaDCEtoaDTE)4RequestToSend(RTS)OutgoingflowcontrolsignalcontrolledbyDTE5ClearToSend(CTS)IncomingflowcontrolsignalcontrolledbyDCE6DataSetReady(DSR)IncominghandshakingsignalcontrolledbyDCE7SignalGroundCommonreferencevoltage8CarrierDetect(CD)Incomingsignalfromamodem20DataTerminalReady(DTR)OutgoinghandshakingsignalcontrolledbyDTE22RingIndicator(RI)Incomingsignalfromamodem1079PinConnectoronaDTEdevice(PCconnection)PinNameDirectionofsignal1CarrierDetect(CD)(fromDCE)Incomingsignalfromamodem2ReceivedData(RD)IncomingDatafromaDCE3TransmittedData(TD)OutgoingDatatoaDCE4DataTerminalReady(DTR)Outgoinghandshakingsignal5SignalGroundCommonreferencevoltage6DataSetReady(DSR)Incominghandshakingsignal7RequestToSend(RTS)Outgoingflowcontrolsignal8ClearToSend(CTS)Incomingflowcontrolsignal9RingIndicator(RI)(fromDCE)IncomingsignalfromamodemTheTD(transmitdata)wireistheonethroughwhichdatafromaDTEdeviceistransmittedtoaDCEdevice.
Thisnamecanbedeceiving,becausethiswireisusedbyaDCEdevicetoreceiveitsdata.
TheTDlineiskeptinamarkconditionbytheDTEdevicewhenitisidle.
TheRD(receivedata)wireistheoneonwhichdataisreceivedbyaDTEdevice,andtheDCEdevicekeepsthislineinamarkconditionwhenidle.
RTSstandsforRequestToSend.
ThislineandtheCTSlineareusedwhen"hardwareflowcontrol"isenabledinboththeDTEandDCEdevices.
TheDTEdeviceputsthislineinamarkconditiontotelltheremotedevicethatitisreadyandabletoreceivedata.
IftheDTEdeviceisnotabletoreceivedata(typicallybecauseitsreceivebufferisalmostfull),itwillputthislineinthespaceconditionasasignaltotheDCEtostopsendingdata.
WhentheDTEdeviceisreadytoreceivemoredata(i.
e.
afterdatahasbeenremovedfromitsreceivebuffer),itwillplacethislinebackinthemarkcondition.
ThecomplementoftheRTSwireisCTS,whichstandsforClearToSend.
TheDCEdeviceputsthislineinamarkconditiontotelltheDTEdevicethatitisreadytoreceivethedata.
Likewise,iftheDCEdeviceisunabletoreceivedata,itwillplacethislineinthespacecondition.
Together,thesetwolinesmakeupwhatiscalledRTS/CTSor"hardware"flowcontrol.
WinWedgesupportsthistypeofflowcontrol,aswellasXon/XOffor"software"flowcontrol.
Softwareflowcontrolusesspecialcontrolcharacterstransmittedfromonedevicetoanothertotelltheotherdevicetostoporstartsendingdata.
WithsoftwareflowcontroltheRTSandCTSlinesarenotused.
DTRstandsforDataTerminalReady.
ItsintendedfunctionisverysimilartotheRTSline.
DSR(DataSetReady)isthecompaniontoDTRinthesamewaythatCTSistoRTS.
SomeserialdevicesuseDTRandDSRassignalstoconfirmthatadeviceisconnectedandisturnedon.
WinWedgesetsDTRtothemarkstatewhentheserialportisopenedandleavesitinthatstateuntiltheportisclosed.
TheDTRandDSRlineswereoriginallydesignedtoprovideanalternatemethodofhardwarehandshaking.
ItwouldbepointlesstousebothRTS/CTSandDTR/DSRforflowcontrolsignalsatthesametime.
Becauseofthis,DTRandDSRarerarelyusedforflowcontrol.
108CDstandsforCarrierDetect.
CarrierDetectisusedbyamodemtosignalthatithasamadeaconnectionwithanothermodem,orhasdetectedacarriertone.
ThelastremaininglineisRIorRingIndicator.
Amodemtogglesthestateofthislinewhenanincomingcallringsyourphone.
TheCarrierDetect(CD)andtheRingIndicator(RI)linesareonlyavailableinconnectionstoamodem.
BecausemostmodemstransmitstatusinformationtoaPCwheneitheracarriersignalisdetected(i.
e.
whenaconnectionismadetoanothermodem)orwhenthelineisringing,thesetwolinesarerarelyused.
CableLengthsTheRS-232Cstandardimposesacablelengthlimitof50feet.
Youcanusuallyignorethis"standard",sinceacablecanbeaslongas10000feetatbaudratesupto19200ifyouuseahighquality,wellshieldedcable.
Theexternalenvironmenthasalargeeffectonlengthsforunshieldedcables.
Inelectricallynoisyenvironments,evenveryshortcablescanpickupstraysignals.
Thefollowingchartofferssomereasonableguidelinesfor24gaugewireundertypicalconditions.
Youcangreatlyextendthecablelengthbyusingadditionaldeviceslikeopticalisolatorsandsignalboosters.
OpticalisolatorsuseLEDsandPhotoDiodestoisolateeachlineinaserialcableincludingthesignalground.
Anyelectricalnoiseaffectsalllinesintheopticallyisolatedcableequally-includingthesignalgroundline.
Thiscausesthevoltagesonthesignallinesrelativetothesignalgroundlinetoreflectthetruevoltageofthesignalandthuscancelingouttheeffectofanynoisesignals.
BaudRateShieldedCableLengthUnshieldedCableLength1105000(feet)1000(feet)30040001000120030005002400200050048005002509600250100Cables,NullModems,AndGenderChangersInaperfectworld,allserialportsoneverycomputerwouldbeDTEdeviceswith25-pinmale"D"connectors.
AllotherdevicestowouldbeDCEdeviceswith25-pinfemaleconnectors.
Thiswouldallowyoutouseacableinwhicheachpinononeendofthecableisconnectedtothesamepinontheotherend.
Unfortunately,wedon'tliveinaperfectworld.
Serialportsuseboth9and25pins,manydevicescanbeconfiguredaseitherDTEorDCE,and-asinthecaseofmanydatacollectiondevices-mayusecompletelynonstandardorproprietarypin-outs.
Becauseofthislackofstandardization,specialcablescallednullmodemcables,genderchangersandcustommadecablesareoftenrequired.
109NullModemCablesandNullModemAdaptersIfyouconnecttwoDTEdevices(ortwoDCEdevices)usingastraightRS232cable,thenthetransmitlineoneachdevicewillbeconnectedtothetransmitlineontheotherdeviceandthereceivelineswilllikewisebeconnectedtoeachother.
ANullModemcableorNullModemadaptercrossesthereceiveandtransmitlinessothatthetransmitlineononeendisconnectedtothereceivelineontheotherendandviceversa.
Inadditiontotransmitandreceive,DTR&DSR,aswellasRTS&CTSarealsocrossedinaNullmodemconnection.
Nullmodemadapterareavailableatmostcomputerandofficesupplystoresforunder$5.
9PinTo25PinAdaptersThefollowingtableshowstheconnectionsinsideastandard9pinto25pinadapter.
9-PinConnector25PinConnectorPin1DCDPin8DCDPin2RDPin3RDPin3TDPin2TDPin4DTRPin20DTRPin5GNDPin7GNDPin6DSRPin6DSRPin7RTSPin4RTSPin8CTSPin5CTSPin9RIPin22RIGenderChangersThefinalproblemyoumayencounterishavingtwoconnectorsofthesamegenderthatmustbeconnected.
Again,youcanpurchasegenderchangersatanycomputerorofficesupplystoreforunder$5.
Note:TheparallelportonaPCusesa25pinfemaleconnectorwhichsometimescausesconfusionbecauseitlooksjustlikeaserialportexceptthatithasthewronggender.
Both9and25pinserialportsonaPCwillalwayshaveamaleconnector.
110INDEXAAccess,MSAccessDDEExamples.
79AcknowledgmentString38ActivateAlways-On-Top42InitiallySuspended.
42Menu44Minimized42NormalMode44TestMode44ActivatingWinWedgeAutomatically14AnalyzingSerialData.
21,88,92ApplicationCommandLine.
10,14-16TitleBar10,14-16ASCIICharacterTranslations.
23,34-37AutomaticOutputStrings38-39BBaudRate20,105BaudVs.
BitsperSecond105BeepOnInput42,86BeforeyouBegin4,7-11Bi-DirectionalCommunications104BreakSignal,SeeAnalyzingSerialData.
21HotKeys40SerialOutputStrings.
38BufferSize,Input/Output.
20ButtonControlledOutputStrings(seeDDEalso)38-39CCableLengths108Cables,NullmodemsandGenderChangers108,109ConfigurationExamples9-11,94-98CommPorts20CommandLineArgumentstoActivateWinWedge14CommunicatingbyBits105CommunicationsParameters.
20ConfiguringWinWedge,TypicalExample7-11ContinuousData,Dealingwith.
99-100ControllingWinWedgefunctionsby:HotKeys24,40DDECommands.
58-60Colorimeter,seeDensitometerCoolWedgeTricks99Copyright2CopyrightViolations4111DDataBits20,105DataFields,Defining.
25DefiningLessDataFieldsthanareReceived.
99DataStructure,Defining.
23,25-33DataTerminalReady.
.
.
.
seeDTRDate&Time,Display42-43,52,55Stamps51DCE&DTEDevices106-108DDE,DynamicDataExchange8,15-18,56-87ApplicationName.
17,58,43,56CommandTopic.
17,58,43,56Commands,fromWinWedge.
17,58,43,56Commands,toWinWedge.
58-62Date&TimeStamps.
33,51,43,58Examples-Excel,Access,Word,FoxPro,VB63-87LinkTest,DDECommandTester61EstablishingDDELinksUsingTheClipboard.
57ServerMode15,17,58-86UnderstandingDDE56,62DDEandWinWedge.
58DDEVS.
SendingKeystrokes.
18DefineMenu23-43Defining,AutomaticSerialOutputStrings24Defining,TheRecordStructure.
25-33,96-100DelimiterCharacters29,34DelimitedDataFields.
29DiagnosingSerialCommunicationProblems88DTR,DataTerminalReadyLineAnalyzingSerialData.
21-22DisplayDTR.
43,45HotKeys40-41DynamicDataExchange.
.
.
.
SeeDDEEEditMenu46EnablingWinWedge.
.
.
.
SeeDDECommands(Suspend/Resume)58EndofRecordEvent.
25,48Example,TypicalConfiguration.
7-11Excel,MSExcel5.
0&7.
0(VBA)Examples.
64-78112FFieldLength,seealsoAnalyzingSerialData30-32Field,DefiningDataFields25-30DefiningLessDataFieldthanareActuallyReceived101Multiple,DelimitedDataFields.
29Multiple,FixedLengthDataFields30Overcoming40FieldLimit71Preamble/PostambleKeystrokes33SingleFieldDataRecords.
28FileMenu13-14Filters,defining31FixedLengthDataFields24,30,32Formatting,Date/TimeExpressions.
52-55FoxPro,MSFoxProDDEExamples82GGagePortConfigurationExample.
94-96GaugesandTypicalMeasuringInstruments,Example.
7-11GenderChangers.
109Gettingstarted4,7-11HHardwareWedge.
5HeaderRecords,Removing.
23,103Help,AccessingOn-LineHelp49HotKeys&HotKeyActions.
40HotKeys-Invokinginotherapplications103IIgnoreCharacters34-35IgnoringData32,34-35IgnoringInitializationRecord.
34-35,103InputDataParsing25-33RecordStructureDefinition25-33InputDataAsDDEServerMode.
15,17-18Keystrokesmode15,18InputRecordDefinitionEditor31InstallingandRunningWinWedge7-11Instrument,ConfigurationExamples8-11,94-96,Instruments4Internet,TALWebAddress.
7Introduction3IntroductiontoSerialCommunications.
104-109113KKeystrokeMacros33,50-51KeystrokeMode.
15-16SendingDatatoMorethanOneApplicationinKeystrokeMode102KeystrokeTranslations.
.
.
.
SeeTranslationTable.
36-37KeystrokesVsDDE18LLicenseAgreement.
2LinkTest,DDECommandTester61LoadingWinWedge7-11MMainMenu12MemoryRequirements.
4MinimizeonActivation42ModeMenu15-18ModesSendKeystrokesTo.
15-16DDEServer15,17-18,56-58MSAccess,seeAccessMSExcel,seeExcelMSWord,seeWordNNewFeaturesofv3.
0.
5NormalMode44NullCharacters.
.
.
SeeTranslationTable.
34-37NullModemAdapterorCables87,108,109OOn-LineHelp49OutputStrings24,38-41Overcoming40FieldLimit71Overview3-4,7-11PParity20,105ParsingInputData23,25-33Examples7-11,94-98,9Pinto25PinConverters109PortAnalyze21-22Menu19-22SettingsWindow20Pre-inputCharacterTranslationTable.
34,99-100Preamble/PostambleKeystrokes33ProblemsDDEcommands.
.
.
.
SeeLinkTest61DiagnosingSerialCommunications.
86Troubleshooting87UnderstandingDeviceData90-93PromptingASerialDevice38-41,58-60,63114QQuickStartGuidetoUsingWinWedge8-11QuitMenu47RRecordStructure,Defining.
23,25-33RequestingData.
.
.
.
SeeOutputStrings38-41,58-60,63Resetting&SuspendingWinWedge40-41,59-60RS232,RS485.
4RTS,HotKeys40-41RunningWinWedge.
7,14SScales&Balances.
8-11SerialCommunicationsBaudVs.
BitsperSecond105Bi-DirectionalCommunications104CableLengths.
108Cables,NullmodemsandGenderChangers108CommunicatingbyBits105DCE&DTEDevices109GenderChangers.
108,109NullModemCablesandNullModemAdapters.
109ParityBit1059Pinto25PinConverters106RS232C106Synchronous&Asynchronous104SerialData,Understanding90-93SerialDeviceAnalyzingData21-22DiagnosingProblems.
86Understandingdatafrom.
90-93SerialPortsMultiple89OutputStrings24Settings20,38-41SETUP.
EXE7StopBits20,105Synchronous&Asynchronous,SerialCommunications.
104SystemRequirements.
4115TTechTipsSendingdataaskeystrokestoanapplication16SuspendingandResettingWinWedgeautomatically.
40-41,59-60TechnicalSupportandInformation7,88TestMode44TestingAnalyzingSerialData.
21-22DDECommands,testingwithLINKTEST61DiagnosingSerialCommunicationsproblems.
86Troubleshooting87-88TimeStamps51,52,58TimedInput26-27TimerControlledOutputStrings.
24,38-39TranslationTables23,34-37TransmitString,AnalyzingSerialData.
21-22HotKeys40-41SerialOutputStrings.
24,38-39Troubleshooting87-88TypicalConfigurationExample.
7-11UUnderstandingtheDatafromyourSerialDevice.
90-93Users,shortlist.
6VVirtualInstrumentMode.
48VisualBasic,DDEExamples85VisualFoxPro,DDEExamples82-84VoidingRecords.
34-35,103WWedge5WeighScale7-11WordMSWordDDEExamples81XX-RiteDensitometer,similartoGagePort94-96

随风云-内蒙古三线BGP 2-2 5M 25/月 ,香港CN2 25/月 ,美国CERA 25/月 所有云服务器均支持5天无理由退款

公司成立于2021年,专注为用户提供低价高性能云计算产品,致力于云计算应用的易用性开发,面向全球客户提供基于云计算的IT解决方案与客户服务,拥有丰富的国内BGP、三线高防、香港等优质的IDC资源。公司一直秉承”以人为本、客户为尊、永续创新”的价值观,坚持”以微笑收获友善, 以尊重收获理解,以责任收获支持,以谦卑收获成长”的行为观向客户提供全面优质的互...

RAKsmart 黑色星期五云服务器七折优惠 站群服务器首月半价

一年一度的黑色星期五和网络星期一活动陆续到来,看到各大服务商都有发布促销活动。同时RAKsmart商家我们也是比较熟悉的,这次是继双十一活动之后的促销活动。在活动产品中基本上沿袭双11的活动策略,比如有提供云服务器七折优惠,站群服务器首月半价、还有新人赠送红包等活动。如果我们有需要RAKsmart商家VPS、云服务器、独立服务器等产品的可以看看他们家的活动。这次活动截止到11月30日。第一、限时限...

Hostodo(年付12美元),美西斯波坎机房Linux VPS主机66折

Hostodo 商家是比较小众的国外VPS主机商,这不看到商家有推送促销优惠在美国西岸的斯波坎机房还有少部分库存准备通过低价格促销,年付低至12美元Linux VPS主机,且如果是1GB内存方案的可以享受六六折优惠,均是采用KVM架构,且可以支付宝付款。第一、商家优惠码优惠码:spokanessd 1GB+内存方案才可以用到优惠码,其他都是固定的优惠低至年12美元。第二、商家促销这里,我们可以看到...

38mmm.com为你推荐
酒店回应名媛拼单名媛一天到晚都做什么?商标注册流程及费用我想注册商标一般需要什么流程和费用?同ip站点同IP做同类站好吗?www.522av.com跪求 我的三个母亲高清在线观看地址 我的三个母亲高清QVOD下载播放地址 我的三个母亲高清迅雷高速下载地址m.kan84.net电视剧海派甜心全集海派甜心在线观看海派甜心全集高清dvd快播迅雷下载sesehu.com68lolita com是真的吗ww.66bobo.com谁知道11qqq com被换成哪个网站5566.com5566网址大全机器蜘蛛尼尔机械纪元机械蜘蛛怎么过 机械蜘蛛打法攻略解析45gtv.comLETSCOM是什么牌子?
3322动态域名注册 江西服务器租用 免费试用vps 80vps 空间打开慢 iis安装教程 lighttpd 北京主机 免费ftp站点 电子邮件服务器 帽子云 免费个人空间 电信主机 爱奇艺会员免费试用 卡巴斯基免费试用版 免费私人服务器 根服务器 申请网站 智能dns解析 石家庄服务器托管 更多