XPS-Q8
Tcl Manual
# Set output of GPIO1 to 0
set
code [
catch
"
GPIODigitalSet
$socketID $output
255
0
"]
if
{$code !=
0
} {
DisplayErrorAndClose
$socketID $code "GPIODigitalSet" $telnetOut
return
}
# Get value of output of GPIO1 and store it in OB
set
code [
catch
"
GPIODigitalGet
$socketID $output OB"]
if
{$code !=
0
} {
DisplayErrorAndClose
$socketID $code "GPIODigitalGet" $telnetOut
return
}
else
{
puts
$telnetOut "OB = $OB"
# Force transfer to channel’s output buffer
flush
$telnetOut
}
# Set output of GPIO1 to 63 (mask value)
set
code [
catch
"
GPIODigitalSet
$socketID $output
63
255
"]
if
{$code !=
0
} {
DisplayErrorAndClose
$socketID $code "GPIODigitalSet" $telnetOut
return
}
# Get value of output of GPIO1 and store it in OC
set
code [
catch
"
GPIODigitalGet
$socketID $output OC"]
if
{$code !=
0
} {
DisplayErrorAndClose
$socketID $code "GPIODigitalGet" $telnetOut
return
}
else
{
puts
$telnetOut "OC = $OC"
# Force transfer to channel’s output buffer
flush
$telnetOut
}
# Test if OA = 255 and OB = 0
if
{$OA ==
255
& $OB ==
0
} {
puts
$telnetOut "Digital outputs OK"
# Force transfer to channel’s output buffer
flush
$telnetOut
# Test if OC = 63
if
{$OC ==
63
} {
puts
$telnetOut "Mask OK"
# Force transfer to channel’s output buffer
flush
$telnetOut
}
else
{
puts
$telnetOut "Problem with Mask"
# Force transfer to channel’s output buffer
flush
$telnetOut
}
}
else
{
puts
$telnetOut "Problem with digital outputs"
# Force transfer to channel’s output buffer
flush
$telnetOut
}
# Close socket
TCP_CloseSocket $socketID
EDH0307En1041 — 10/17
30