[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> MSWLogo interface library for Lego Dacta



Here is the MSWLogo version of the interface to Lego Dacta.

I'd also appreciate anyone being able to test this.

to LegoInit
localmake "choice selectbox [Choose Port] [LPT1(0x378) LPT2(0x278) LPT3(0x3BC)]
if :choice = 1 [make "LegoPortAddr 888]
if :choice = 2 [make "LegoPortAddr 632]
if :choice = 3 [make "LegoPortAddr 956]
make "LegoOutputState 0
LegoUpdateOutput
buryname "LegoPortAddr
buryname "LegoOutputAddr
repeat 8 [(Print "Sensor repcount-1 "Status LegoStatus repcount-1)]
MessageBox [Lego] [~
LegoStart <Motor 0-6>\
LegoStop <Motor 0-6>\
LegoToggle <Motor 0-6>\
LegoStatus <Sensor 0-7>\
LegoDirection <Direction 0-1>]
end

to LegoDirection :Direction
make "LegoOutputState BITOR :LegoOutputState (ashift :direction 7)
LegoUpdateOutput
end

to LegoStart :Motor
make "LegoOutputState BITOR :LegoOutputState (ashift 1 :motor)
LegoUpdateOutput
end

to LegoStatus :Sensor
outportb :LegoPortAddr+2 12
localmake "hi BITAND (inportb :LegoPortAddr+1) 248
localmake "lo BITAND (inportb :LegoPortAddr+2) 7
localmake "byte (BITOR :lo :hi)
localmake "byte BITXOR (BITOR :lo :hi) 131
output equalp 0 (BITAND :byte (ashift 1 :Sensor))
end

to LegoStop :Motor
make "LegoOutputState BITAND :LegoOutputState BITNOT (ashift 1 :motor)
LegoUpdateOutput
end

to LegoToggle :Motor
make "LegoOutputState BITXOR :LegoOutputState (ashift 1 :motor)
LegoUpdateOutput
end

to LegoUpdateOutput
outportb :LegoPortAddr :LegoOutputState
end

Make "startup [LegoInit]

--
===============================================================
George Mills (mills@softronix.com)
http://www.softronix.com/
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home