EasyManua.ls Logo

XITRON XT2640 - Computer Control of the Xt2640; RS232 (Serial) Interface; Using the Xt2640 from an Interface 1

Default Icon
187 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
XT2640OperatingManual 13July2016 Page131of187
24 USINGTHEXT2640FROMANINTERFACE
24.1 COMPUTERCONTROLOFTHEXT2640
Thereareagreatmanysoftwarelanguages,compilersanddevelopmentplatforms.Itisbeyondthescopeofthisdocumentto
attempttoprovideyouwithcompleteassistanceregardingwritingsoftwaretocontroltheXT2640,soitisdescribedingeneralform.
Examples,wheregiven,usetheMicrosoftVisualStudioExpress2012developmentplatformandtheVB.NETlanguage.Theexamples
areportionsofcodeandinpracticeyoumaywishtoprovidehandlersforrecoveringfromtimeouterrors.
TheprotocolusedforcommunicationsisentirelyASCIIbased,usingthecommonlyusedcommandanddatafieldsapproach,andis
thesameprotocolforallinterfaces.
Note:
UseoftheXT2640viaaninterfaceisnotdependentontheXT2640frontpanelbeingsettoanyspecificscreen.
24.1.1 RS232 (SERIAL)INTERFACE
BaudRate 9600,19200,57600or115200
Handshake Bi‐directional,hardware(RTS/CTS)
DataBits 8
Parity None
Start/StopBits 1
Connector 9‐pinMaleDsub
InterfacePinoutType DTE(sameasPCcomputer)
Cablerequired 9‐wirefemale‐femalenullmodemcable,fullywired
CableLength <50ft(perstandard,inpracticeconsiderablylongercablelengthsareoftenusedwithoutproblems)
24.1.1.1 CONNECTINGTOTHERS232IN TERFACE 
TheRS232connectorlocatedontherearpaneloftheXT2640mustbeconnectedtothecomputer.ForastandardPCtypecomputer
thisrequiresa9‐pinfemale‐femalenullmodemcable,thepinoutontheXT2640connectorisidenticaltothatonastandardPC,so
thedataandhandshakelinesmustcross‐overinthecable.SuitablecablesareavailablefromXiTRONinaselectionoflengths.
Note:
Thiscablemustaccommodatenotonlythedatasignalsandground,butalsotheRTS,CTSandDTRsignalsasaminimum.
24.1.1.2 USINGAUSBTORS232CONVERTOR
ManycomputersdonothaveaRS232interfaceavailable;inthesecasesyoumayneedtouseaUSB‐to‐RS232convertor(sometimes
calleda‘dongle’)toprovidetheRS232interface.Manysuchconvertorsareavailablebutmanydonothaveadequateperformance;
XiTRONoffersafullytestedconvertorwhichisrecommended.
AlthoughtheuseofaconvertormaynotappeartorequirethealterationofsoftwarewrittenbyyouforadirectRS232port,the
majorityofUSB‐to‐RS232convertorshaveafairlyseverelatencydelay(typically10msormore)foreachtransmittedandreceived
stringofcharacters.Inhighspeedapplicationsthismayseverelyrestricttheoverallspeed.Also,manyconvertorshavebuffersfor
transmittedandreceivedcharacterswithintheconvertoritself.Experiencehasshownthatthestateofthebufferforcharacters
transmittedfromthecomputertotheXT2640isnotproperlymanagedinsomeconvertorswhichcanresultinbufferoverrun.This
cancausecharacterlosswhenperforminghigh‐speedtransfersofcommandstotheXT2640.Ifusingsuchaconvertorandtheuser
isexperiencingdataloss(usuallyseenasrandomlyoccurringcommanderrorsattheXT2640)thenthefollowingisrecommended
basedonourexperience–
Useadifferentconvertor.XiTRONoffersafullytestedconvertor.
Ensureyouareusingthelatestdriverfortheconvertorinyourcomputer.Ifchangingbetweenconvertorsthenitis
recommendedtouninstallallpreviousUSB‐to‐RS232convertordriversafterremovingthepresentUSB‐to‐RS232
convertorandthenrebootingthecomputerpriortoinstallingadifferentconvertor.Manydifferentmanufacturersof
convertorsuseasimilarchipsetandaredetectedascompatibledevicesandmayerroneouslyre‐usetheexistingdriver.
Limitalltransmitteddatatoamaximumof64charactersandratelimiteachpackettransmittedbyusingpausesinyour
software.Inextremecasesthis64characterlimitmayneedtobelowered.Experiencehasshownthatsomeconvertors
areonlyreliablewhensinglecharactersaretransmitted.Theratelimitingtimedelaybetweenpacketsshouldbegreater
thantheUSBframerateof1ms.
SomeconvertorsrelyonthemechanicalgroundconnectionfromtheRS232endtotheconvertor.Althoughaconvertor
mayappeartobeoperatingcorrectly,ifthescrewsmountingaRS232cabletotheconvertorarenotinstalledthenthe
convertorbecomesverysensitivetointerference.Thistypicallygivesasimilarissuetothebuffermanagementissuenoted
above,butmostoftenyieldscharacterlossinbothtransmittedandreceiveddata.
24.1.1.3 USEOFTHERS232CONTROLSIGNALS
Thissectionusesthesignalsnamesastheyarepresentatthecomputerendofthecable.
TheDTRsignal(outputfromthecomputer)isusedbytheXT2640todetectthatacontrollerispresentontheRS232portsomustbe
assertedforanyinterfaceactivitytoberecognized.Thecableused,anycableconvertorused,thecomputer,andthesoftwaremust
allsupporttheDTRsignal.IfnotincludedinthecableadisconnectedDTRsignalisseenbytheXT2640astheabsenceofacomputer
andanycharactersreceivedwillbetakenasinterferenceanddiscarded.IfthecorrectDTRsignalcannotbeprovidedthenaspecial
cablecanbeconstructedwhichtiestheDSRandDTRsignalstogether,inthismannertheXT2640itselfprovidestheDTRsignal.

Table of Contents