| |
General
xBase++
is the modern successor of the database languages of the very first PC time
(Clipper, dBase) and is used all the time. You can get it via Alaska Software
(actual Version 1.9).
Rene Nooteboom now has created some xBase sources and objects to connect
fischertechnik Computing with a database language. Supported are the
fischertechnik Interfaces 30 520 Universal, 30 402 Intelligent and the
Interfaces of the ROBO series. In addition the Knobloch Multiface.
Components
The main component is (specific for each Interface type) the wrapper library
(ft30520.obj - ft30402.obj - ftroboii.obj - mface.obj). The base on umFish30.DLL
/ umFish40.DLL / inpout32.DLL. In Addition some more files (.ch, .prg).
Console Example : Interface-Diagnose
Structure of the console application using a ROBO Interface :
- ftriTest.xpj : project
- ftriTest.arc : resources
- ftriTest.ch : header
- ftriTest.prg : the application
- -- and include files --
- noot.ch : common functions
- ft.ch : fischertechnik constants
- umFish40.ch / prg : Load umFish40.DLL
- ftroboii.obj (ftroboii.ch / prg) : the wrapper object
FUNCTION main()
LOCAL nSelectedMotor:=M1,nkey:=0,i
Initialize()
Set Cursor off
Do WHILE !(LastKey() == K_ESC)
@ 3,60 SAY nSelectedMotor PICTURE "9"
FOR i := E1 TO E8
@ i+2,5 SAY LTOC(FtRSensor(iPortHandle,i))
Next i
@ 19,5 SAY FtRAD(iPortHandle,EX) PICTURE "99999999"
@ 20,5 SAY FtRAD(iPortHandle,EY) PICTURE "99999999"
DO CASE
CASE nkey == asc("1")
nSelectedMotor := M1
CASE nkey == asc("2")
nSelectedMotor := M2
CASE nkey == asc("3")
nSelectedMotor := M3
CASE nkey == asc("4")
nSelectedMotor := M4
Otherwise
EndCase
Do Case
CASE Upper(Chr(nkey)) == "R"
FtRMotor(iPortHandle,nSelectedMotor,MCW)
@ nSelectedMotor+3,44 SAY "MCW "
CASE Upper(Chr(nkey)) == "L"
FtRMotor(iPortHandle,nSelectedMotor,MCCW)
@ nSelectedMotor+3,44 SAY "MCCW"
CASE Upper(Chr(nkey)) == "O"
FtRMotor(iPortHandle,nSelectedMotor,MOFF)
@ nSelectedMotor+3,44 SAY "MOFF"
OTHERWISE
EndCase
UpdateLoops()
nkey := Inkey(0.01) // wait 0.01s
EndDo
CloseApplication()
RETURN NIL |
Some details of the application (.PRG) : The rfroboii functions correspondent
to tham of umFish40.DLL, threfore the umFish40 documentation can be used.
Windows Example : TrafficLights
Procedure StartTrafficLight()
LOCAL nPhase:=0,nEvent:=xbe_None,mp1,mp2,oXbp,
LightPhases_,lPushed:=FALSE
LoadColorBitMaps()
ReadData()
DisableDialogs()
oPB_Stop:enable()
// get the traffic light phases-array
LightPhases_ := CreatePhases()
If lAutomatic // change lights continuously and automatic
// second event loop for controlling traffic lights
Do While TRUE
nEvent := AppEvent(@mp1,@mp2,@oXbp,1)
If nEvent <> xbe_None .AND. !(oXbp == NIL)
oXbp:handleEvent(nEvent,mp1,mp2)
EndIf
Do Case
Case nEvent == xbeP_Quit
CloseApplication()
Case nEvent == xbeP_Close
CloseApplication()
Case lStop
Exit
END // endcase
If nPhase <= 0
nPhase := 1
StartStopWatch()
FtROutput(iHandle,LightPhases_[nPhase][IOUTPUTBYTE])
Else
If ElapsedTime() > LightPhases_[nPhase][ITIME]
If ++nPhase > Len(LightPhases_)
nPhase := 1
EndIf
StartStopWatch()
FtROutput(iHandle,LightPhases_[nPhase][IOUTPUTBYTE])
EndIf
EndIf
EndDo
......... |
The source is more complicated (of course). the windows code is generated
from th xBase IDE. It can be modified manual. The code for controlling the
interface is highlighted to be found.
Downloads
umFish_xBase.ZIP : XBase++ sources
und objects
umFish_xBase.PDF :
documentation of the needed files (contained in the ZIP too).
TrafficLight.PDF : documentation of the
TrafficLights (source and pdf are part of the ZIP).
and
umFish41.ZIP / umFish30.ZIP
: umFish__.DLL documentation is included
Author
Rene Nooteboom, eMail : r.nooteboom2(a)chello.nl
Last updated : 04.09.2006
|