'Super Com Z" Com Support Routines "Port parameter
-
- Posts: 193
- Joined: 25 January 2006, 19:56 PM
'Super Com Z" Com Support Routines "Port parameter
These "beta" routines should work for general serial communications using 1 to 4 serial I/O ports. Due to the complex nature of these routines they are subject to change on the minute!
- Attachments
-
- ComSupport_R4.bas
- Com Support routines for the "Super Comm Z" with 4 serial ports.
- (28.49 KiB) Downloaded 4169 times
I would suggest the alternate implementations below. Something similar could be used for outputting Single values unless the required format can't be produced by CStr() or Fmt().
Except for the use of the second parameter on the Asc() function and the syntax for defining the bounded string, the same coding would work for BasicX. An alternate method for fetching string characters in BasicX is:
Code: Select all
Public Sub PutStr(ByVal port as Byte, ByRef Tx as STRING)
' Outputs a STRING type to serial port n.
Dim Length as Integer
Dim I as Integer
Length = Len(Tx)
For I = 1 To Length
Call PutByte(port, Asc(Tx, I))
Next I
End Sub
Public Sub PutL(ByVal port as Byte, ByVal Operand as Long)
Dim s as BoundedString(11)
s = CStr(Operand)
Call PutStr(port, s)
End Sub
Public Sub PutUL(ByVal port as Byte, ByVal Operand as UnsignedLong)
Dim s as BoundedString(10)
s = CStr(Operand)
Call PutStr(port, s)
End Sub
Code: Select all
Call PutByte(port, RamPeek(MemAddress(Tx) + I + 1))
- Don Kinzer
Code: Select all
Public Sub PutL(ByVal port as Byte, ByVal Operand as Long)
Dim s as BoundedString(11)
s = CStr(Operand)
Call PutStr(port, s)
End Sub
call PutStr(port, CStr(number)) // dynamic string allocation in ZBasic
which with the VM, is probably not significantly different, esp. considering that it uses less call/return/parameter passing stack.
Code: Select all
Call PutStr(port, CStr(number))
- Don Kinzer