Campbell-scientific CR800 and CR850 Measurement and Control Systems Manual de usuario Pagina 241

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 566
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 240
Section 7. Installation
241
7.8.13.7 Formatting Strings
Table 43. Formatting Strings Examples
Expression Result
Str(1)=123e4
Str(2)=FormatFloat(123e4,"%12.2f")
Str(3)=FormatFloat(Values(2)," The battery is %.3g Volts ")
Str(4)=Strings(3,1,InStr(1,Strings(3),"The battery is ",4))
Str(5)=Strings(3,1,InStr(1,Strings(3),"is ",2) + 3)
Str(6)=Replace("The battery is 12.4 Volts"," is "," = ")
Str(7)=LTrim("The battery is 12.4 Volts")
Str(8)=RTrim("The battery is 12.4 Volts")
Str(9)=Trim("The battery is 12.4 Volts")
Str(10)=UpperCase("The battery is 12.4 Volts")
Str(12)=Left("The battery is 12.4 Volts",5)
Str(13)=Right("The battery is 12.4 Volts",7)
1230000
1230000.00
“The battery is 12.4 Volts”
12.4 Volts
12.4 Volts
The battery = 12.4 Volts
The battery is 12.4 Volts
The battery is 12.4 Volts
The battery is 12.4 Volts
THE BATTERY IS 12.4 VOLTS
The b
Volts
CRBasicExample49. FormattingStrings
Objective:
Format the string "The battery is 12.4 Volts"
Use CRBasic expression:
StringVar(11) = Mid("The battery is 12.4 Volts", _
InStr(1,"The battery is 12.4 Volts"," is ",2)+3,Len("The battery is 12.4 Volts"))
Result:
12.4 Volts
7.8.13.8 Formatting String Hexadecimal Variables
Table 44. Formatting Hexadecimal Variables - Examples
Expression Comment Result
CRLFNumeric(1) = &H0d0a
Add leading zero to hex step 1
3338
StringVar(20) = "0" & Hex(CRLFNumeric)
Add leading zero to hex step 2
0D0A
CRLFNumeric(2) = HexToDec(Strings(20))
Convert Hex string to Float
3338.00
7.8.14 Data Tables
CRBasicExample50. TwoDataIntervalsinOneDataTable
'CRBasic program to write to a single table with two different time intervals.
'Note: this is a conditional table, check the table fill times in the Status table.
'For programs with conditional tables AND other time driven tables, it is generally
'wise to NOT auto allocate the conditional table; set a specific number of records.
'Declare Public Variables
Public PTemp, batt_volt, airtempC, deltaT
Public int_fast As Boolean
Public int_slow As Boolean
Public counter(4) As Long
Vista de pagina 240
1 2 ... 236 237 238 239 240 241 242 243 244 245 246 ... 565 566

Comentarios a estos manuales

Sin comentarios