Lionheart008
30-01-2010, 11:41
good morning,
possible to check this "byte" code I have made ?
perhaps I am not awaken, it's possible to get a result for these two functions ?
in my cases it's both "0", that's ok ? I thought it should be "1" ?
a)
PrintL "function 2 does not work? " + byteLocal(99)
b)
PrintL "function 1 does not work? " + SendByte(77)
may be I have done something wrong, don't know.
' Empty GUI script created on 01-30-2010 09:48:04 by (ThinAIR)
'-------------------- test bytes by franko ------------------------------
Uses "console"
' Simple assignment ---------------------------------
Dim b,c As Byte
Dim by? As Byte
b = 255 : PrintL "-> 255: " + b
by? = 101 : PrintL "-> by?: " + by?
PrintL
' Math -----------------------------
b = b + 10 : PrintL "-> b+10: " + b
c = b * 20 : PrintL "-> b*20: " + c
b = 0*81
PrintL "-> 0*81: " + b ' Positive 129
b = -127
PrintL "-> b = -127: " + b
PrintL
' UDT Assignment -----------------------------
Type ByteType
x As Byte
y As Byte
End Type
Dim bt As ByteType
bt.x = 3
bt.y = 8
PrintL "bt.x: " + bt.x
PrintL "bt.y: " + bt.y
PrintL
' Copy UDT ---------------------------------
Dim btCopy As ByteType
btCopy = bt
PrintL "btCopy.x: " + btCopy.x
PrintL "btCopy.y: " + btCopy.y
PrintL
' Array Assignment ---------------------------
Dim ByteArray(4) As Byte
ByteArray(1) = b
ByteArray(2) = 2
ByteArray(3) = 3
ByteArray(4) = 4
PrintL "ByteArray(1): " + ByteArray(1)
PrintL "ByteArray(2): " + ByteArray(2)
PrintL "ByteArray(3): " + ByteArray(3)
PrintL "ByteArray(4): " + ByteArray(4)
PrintL
' Copy Array ------------------------------------
Dim ByteArrayCopy(4) As Byte
ByteArrayCopy(1) = ByteArray(1)
ByteArrayCopy(2) = ByteArray(2)
ByteArrayCopy(3) = ByteArray(3)
ByteArrayCopy(4) = ByteArray(4)
printl ByteArrayCopy(1)
printl ByteArrayCopy(2)
printl ByteArrayCopy(3)
printl ByteArrayCopy(4)
PrintL
' Function: Return a byte ------------------------
Function ReturnByte() As Byte
Local result As Long
Result = 42
Function = result
End Function
PrintL "returnByte: " + ReturnByte()
PrintL
' Subroutine: Send a byte -------------------------
Sub SendByte(ByVal ch As Byte)
ch = ch + 1
PrintL "ch + 1: " + ch
End Sub
PrintL "function 1 does not work? " + SendByte(77)
PrintL
' Function: Local variable ------------------------
Function ByteLocal(ByVal ch As Byte) As Byte
Dim chwork As Byte
Local result As Long
chwork = ch + 1
PrintL "chwork = ch + 1 " + chwork
Result = -1
End Function
PrintL "function 2 does not work? " + byteLocal(99)
PrintL
WaitKey
nice winterday, frank
possible to check this "byte" code I have made ?
perhaps I am not awaken, it's possible to get a result for these two functions ?
in my cases it's both "0", that's ok ? I thought it should be "1" ?
a)
PrintL "function 2 does not work? " + byteLocal(99)
b)
PrintL "function 1 does not work? " + SendByte(77)
may be I have done something wrong, don't know.
' Empty GUI script created on 01-30-2010 09:48:04 by (ThinAIR)
'-------------------- test bytes by franko ------------------------------
Uses "console"
' Simple assignment ---------------------------------
Dim b,c As Byte
Dim by? As Byte
b = 255 : PrintL "-> 255: " + b
by? = 101 : PrintL "-> by?: " + by?
PrintL
' Math -----------------------------
b = b + 10 : PrintL "-> b+10: " + b
c = b * 20 : PrintL "-> b*20: " + c
b = 0*81
PrintL "-> 0*81: " + b ' Positive 129
b = -127
PrintL "-> b = -127: " + b
PrintL
' UDT Assignment -----------------------------
Type ByteType
x As Byte
y As Byte
End Type
Dim bt As ByteType
bt.x = 3
bt.y = 8
PrintL "bt.x: " + bt.x
PrintL "bt.y: " + bt.y
PrintL
' Copy UDT ---------------------------------
Dim btCopy As ByteType
btCopy = bt
PrintL "btCopy.x: " + btCopy.x
PrintL "btCopy.y: " + btCopy.y
PrintL
' Array Assignment ---------------------------
Dim ByteArray(4) As Byte
ByteArray(1) = b
ByteArray(2) = 2
ByteArray(3) = 3
ByteArray(4) = 4
PrintL "ByteArray(1): " + ByteArray(1)
PrintL "ByteArray(2): " + ByteArray(2)
PrintL "ByteArray(3): " + ByteArray(3)
PrintL "ByteArray(4): " + ByteArray(4)
PrintL
' Copy Array ------------------------------------
Dim ByteArrayCopy(4) As Byte
ByteArrayCopy(1) = ByteArray(1)
ByteArrayCopy(2) = ByteArray(2)
ByteArrayCopy(3) = ByteArray(3)
ByteArrayCopy(4) = ByteArray(4)
printl ByteArrayCopy(1)
printl ByteArrayCopy(2)
printl ByteArrayCopy(3)
printl ByteArrayCopy(4)
PrintL
' Function: Return a byte ------------------------
Function ReturnByte() As Byte
Local result As Long
Result = 42
Function = result
End Function
PrintL "returnByte: " + ReturnByte()
PrintL
' Subroutine: Send a byte -------------------------
Sub SendByte(ByVal ch As Byte)
ch = ch + 1
PrintL "ch + 1: " + ch
End Sub
PrintL "function 1 does not work? " + SendByte(77)
PrintL
' Function: Local variable ------------------------
Function ByteLocal(ByVal ch As Byte) As Byte
Dim chwork As Byte
Local result As Long
chwork = ch + 1
PrintL "chwork = ch + 1 " + chwork
Result = -1
End Function
PrintL "function 2 does not work? " + byteLocal(99)
PrintL
WaitKey
nice winterday, frank