I have generated the following code for a compass and I want to be able to display it on a java GUI .
---------------------------------------------------------------
dirsc =%00001111 'should declare all port c as inputs
SYMBOL NORTH = pin7
SYMBOL EAST = pin6
SYMBOL SOUTH = pin5
SYMBOL WEST = pin4
main:
if North=0 and South=1 and East=1 and West=1 then label_11 ' North
if North=0 and South=1 and East=0 and West=1 then label_12 ' North East
if North=1 and South=1 and East=0 and West=1 then label_13 ' East
if North=1 and South=0 and East=0 and West=1 then label_14 ' South East
if North=1 and South=0 and East=1 and West=1 then label_15 ' South
if North=1 and South=0 and East=1 and West=0 then label_16 ' South West
if North=1 and South=1 and East=1 and West=0 then label_17 ' West
if North=0 and South=1 and East=1 and West=0 then label_18 ' North West
goto main ; *****
label_11: let pins = %10000000 ' LED1 on
sertxd (1,0)
pause 500
goto main
label_12: let pins = %01000000 ' LED2 on
sertxd (2,0)
pause 500
goto main
label_13: let pins = %00100000 ' LED3 on
sertxd (3,0)
pause 500
goto main
label_14: let pins = %00010000 ' LED4 on
sertxd (4,0)
pause 500
goto main
label_15: let pins = %00001000 ' LED5 on
sertxd (5,0)
pause 500
goto main
label_16: let pins = %00000100 ' LED6 on
sertxd (6,0)
pause 500
goto main
label_17: let pins = %00000010 ' LED7 on
sertxd (7,0)
pause 500
goto main
label_18: let pins = %00000001 ' LED8 on
sertxd (8,0)
goto main
-------------------------------------------------------------
I want to display each direction on the PC as I turn the compass but I'm not sure how to use the sertxd command to do that.
Any help would be appreciated.
---------------------------------------------------------------
dirsc =%00001111 'should declare all port c as inputs
SYMBOL NORTH = pin7
SYMBOL EAST = pin6
SYMBOL SOUTH = pin5
SYMBOL WEST = pin4
main:
if North=0 and South=1 and East=1 and West=1 then label_11 ' North
if North=0 and South=1 and East=0 and West=1 then label_12 ' North East
if North=1 and South=1 and East=0 and West=1 then label_13 ' East
if North=1 and South=0 and East=0 and West=1 then label_14 ' South East
if North=1 and South=0 and East=1 and West=1 then label_15 ' South
if North=1 and South=0 and East=1 and West=0 then label_16 ' South West
if North=1 and South=1 and East=1 and West=0 then label_17 ' West
if North=0 and South=1 and East=1 and West=0 then label_18 ' North West
goto main ; *****
label_11: let pins = %10000000 ' LED1 on
sertxd (1,0)
pause 500
goto main
label_12: let pins = %01000000 ' LED2 on
sertxd (2,0)
pause 500
goto main
label_13: let pins = %00100000 ' LED3 on
sertxd (3,0)
pause 500
goto main
label_14: let pins = %00010000 ' LED4 on
sertxd (4,0)
pause 500
goto main
label_15: let pins = %00001000 ' LED5 on
sertxd (5,0)
pause 500
goto main
label_16: let pins = %00000100 ' LED6 on
sertxd (6,0)
pause 500
goto main
label_17: let pins = %00000010 ' LED7 on
sertxd (7,0)
pause 500
goto main
label_18: let pins = %00000001 ' LED8 on
sertxd (8,0)
goto main
-------------------------------------------------------------
I want to display each direction on the PC as I turn the compass but I'm not sure how to use the sertxd command to do that.
Any help would be appreciated.