Справочник Пользователя для Advanced Wireless Solutions EMO-500

Скачать
Страница из 40
AW Company 8809 Industrial Drive, Franksville, WI 53126  à web: www.awcompany.com 
 Tel:  262-884-9800  Fax:  262-884-9810 | Email: aw@awcompany.com          
REV. 4                                          10/05                                      EMO-500 Manual.DOC
 
 
30
WARNING --- IMPORTANT --- WARNING --- IMPORTANT --- WARNING    
 The communication port does not discriminate any addresses. This means that any address can be 
written to as well as read from.  Writing to certain addresses will change the operation of the EMO 500 
drastically.  Caution is a must !!!  Double Check Addresses and Variables Before Writing to the EMO 
500.   
                                                                  
   WARNING --- IMPORTANT --- WARNING --- IMPORTANT --- WARNING   
 
ADDRESS INFORMATION
 
    
 IMPORTANT
 
     When writing to the EMO 500 there are always two locations to be changed for a 
permanent entry into the memory.  This is because there are locations for data running 
currently in the RAM and there are locations for data that will be battery backed.  If the 
information has been written to the running locations alone it will be lost when the 
EMO 500 is turned off.
      
 
Below is a QBASIC program that will allow the user to communicate with the 
EMO 500 by initiating serial port #1 and prompting for read and write strings.  The 
strings must use the OPTO 22 protocol format described on page 18. 
 
DEFINT A-Z 
'* Serial Communication Test Program for OPTOMUX Code 
'* For use with AW Company's EMO Series Flow Computers 
 
'* Open serial port #1 to 9600 baud 
OPEN "COM1:9600,N,8,1,RS,CS,DS,CD" FOR RANDOM AS #1 
'* set up loop for transmitting several strings 
CLS 
DO 
     PRINT "Enter String to send. (Press ENTER alone to END)" 
     INPUT "Transmitting String: >", Transm$ 
     IF LEN(Transm$) = 0 THEN END 
          '* Calculate Chksum 
     Chk = 0 
     FOR Char = 1 TO LEN(Transm$) 
          Chk = Chk + ASC(MID$(Transm$, Char, 1)) 
     NEXT 
     Chk$ = HEX$(Chk) 
          '* Must be 2 characters, 1 byte 
     IF LEN(Chk$) < 2 THEN Chk$ = "0" + Chk$ 
          '* Add the recognition character plus checksum 
          '* use only the last byte of checksum 
     Transm$ = ">" + Transm$ + RIGHT$(Chk$, 2) 
          '* Send it to the EMO 
     PRINT #1, ; Transm$; CHR$(13); 
          '* Read what the EMO sending back 
     LINE INPUT #1, Receive$ 
     PRINT "Received: "; Receive$ 
     PRINT 
LOOP