Print

Short notation for Uartn.Print
This description is also valid for SoftUart.Print
Print is on of the the most comprehensive output functions. Use Print to write data to a serial port:

  • individual variables of any type
  • complete Array contents
  • Strings
  • Constants
  • Return values of Functions or Objects

Values are separated by the Semicolon and then printed in their order from left to right:

If the last character is a semicolon, then the automatic new line function ASCII 13 and ASCII 10 (CRLF) is suppressed.

Print will print an empty new line:

  • Print

This expression will print nothing:

  • Print ;

Every expression is interpreted for itself and then the results are printed one after the other:

This will print the result of a mathematical expression and the string „Hello“ and stringVar (no extra memory required). Dabei ist zu beachten, dass die ergebnisse der mathematischen Ausdrücke bei Addition und Multiplikation den nächst größeren Datentyp ergeben. Möchte man also aus einer Berechnung den binären Byte-Wert ausgeben statt eines Word, teilt man dies dem Compiler durch explizite Anweisung über eine Typkonvertierung mit:

Print Variable or indexed Array elements:

  • Print numVar - prints the content of Variable „numVar“
  • Print numVar(1) - prints the content of Array element „numVar(1)“
  • Print stringVar - prints the content of Variable „stringVar“

Constants print their typed values :

  • Print 22 (output 22 as a Byte value)
  • Print 1234 (output 1234 as a Word value)
  • Print -1234 (output -1234 as a Integer value)
  • Print 12.34 (output 12.34 as a Single value)
  • Print 1234567 (output 1234567 as a Long value)
  • Print „text“ (gibt die Zeichenkette „text“ aus)

Print the return value of (Objekt/Interface-) Methods or properties:

  • Print function1(parameter1, parameter2, ..)
  • Print PortB
  • Print Timer1.Value
  • Print str(numVar)

Example:

  dim var,c(4),a,b as byte
  var=97 ' ASCII-character "a"
  c(0)=asc("H")
  c(1)=asc("e")
  c(2)=asc("l")
  c(3)=asc("l")
  c(4)=asc("o")
  a=100
  b=5
  Print "Hello World ";str(12345)  ' output: "Hello World 12345"
  Print "Hello World ";65          ' output: "Hello World A"
  Print "Hello World ";Str(65)     ' output: "Hello World 65"
  Print "Hello World ";c(4)        ' output: "Hello World o"
  Print "Hello World ";str(a/b)    ' output: "Hello World 20"
  Print var                        ' output: "a"