Campbell Hausfeld SDM-CAN Manual Do Utilizador

Página de 74
SDM-CAN CAN-Bus Interface User Guide 
3.5.2  Simple CAN Data Transmission 
The following example transmits a 16 bit temperature value to a CAN network 
running at 500K baud. 
;{CR10X} 
*Table 1 Program 
  01: 1         Execution Interval (seconds) 
 
;When Flag 1 is high set SDM-CAN switches to transmit mode 
 
1:  If Flag/Port (P91) 
 1: 11       Do if Flag 1 is High 
 2: 30       Then Do 
 
;Load input location with value for switches  
 
     6:  Z=F (P30) 
      1: 0003     F 
      2: 0        Exponent of 10 
      3: 3        Z Loc [ Switches  ] 
 
;Send switch settings to SDM-CAN 
 
     7:  SDM-CAN (P118) 
      1: 0        SDM Address 
      2: 2        Time Quanta 
      3: 5        Tseg1 
      4: 2        Tseg2 
      5: 1        ID Bits 0..10 
      6: 0        ID Bits 11..23 
      7: 0        ID Bits 24..28 
      8: 32       Set switches 
      9: 00       Start Bit No. 
     10: 00       No. of Bits 
     11: 00       No. of Values 
     12: 3        Loc [ Switches  ] 
     13: 1.0      Mult 
     14: 0.0      Offset 
 
;Set flag 1 low after sending switch settings 
     8:  Do (P86) 
      1: 21       Set Flag 1 Low 
 
 
9:  End (P95) 
10:  Batt Voltage (P10) 
 1: 4        Loc [ Battery   ] 
 
11:  Internal Temperature (P17) 
 1: 5        Loc [ Int_Temp  ] 
 
12:  Thermocouple Temp (DIFF) (P14) 
 1: 6        Reps 
 2: 1        2.5 mV Slow Range 
 3: 1        DIFF Channel 
 4: 1        Type T (Copper-Constantan) 
  
5: 5        Ref Temp (Deg. C) Loc [ Int_Temp  ] 
3-18