Forum | | | | funkheld | Hello, with the Processen runs it now wonderful. I have here example with data to that Process over Settext/Gettext$, means without Filmap etc.
One Mainwindow for robot, where The distances The it over WLan mail of XProfan displayed go. The WLan-data go over 1 Process receive and gesendet. 1 Process have I a serial Datenübertragung and 1 Process go Pixel outputted.
means one crazy thing with the Processen, wonderful. I wanted to time the behaviour Verify.
when becomes the Hauptprogramm time in that holpern come with the many Processen?
greeting
{$cle}
{$PUSHKEYWORD pExec}
declare b_vor&,b_zur&,zielfenster&
declare b_links&,b_hlinks&,b_mitte&,b_hrechts&,b_rechts&
declare b_v0&,b_v1&,b_v2&
declare b_ser0&,b_ser1&,b_sharp&,b_ton&,b_cls&
declare ende&,Text$,bpic&,bpich&,wert&,hw&,ht&,hx&,hy&,p&,p1&,p2&,htext&,hd1&
declare x!,y!,wtest&,color&
windowtitle "send"
Window 20,20-700,650
color&=rgb(160,160,160)
cls color&
bpic& = create("hNewPic", 400,400,rgb(255,255,255))
bpich& = create("hNewPic", 400,400,rgb(255,255,255))
b_vor& = Create("Button",%HWnd,"vor", 10, 20, 80, 24)
b_zur& = Create("Button",%HWnd,"zurück", 10, 45, 80, 24)
b_links& = Create("Button",%HWnd,"links", 10, 70, 80, 24)
b_hlinks& = Create("Button",%HWnd,"hlinks", 10, 95, 80, 24)
b_mitte& = Create("Button",%HWnd,"mitte", 10, 120, 80, 24)
b_hrechts& = Create("Button",%HWnd,"hrechts", 10, 145, 80, 24)
b_rechts& = Create("Button",%HWnd,"rechts", 10, 170, 80, 24)
b_v0& = Create("Button",%HWnd,"v0", 10, 195, 80, 24)
b_v1& = Create("Button",%HWnd,"v1", 10, 220, 80, 24)
b_v2& = Create("Button",%HWnd,"v2", 10, 245, 80, 24)
b_ser0& = Create("Button",%HWnd,"ser0", 10, 270, 80, 24)
b_ser1& = Create("Button",%HWnd,"ser1", 10, 295, 80, 24)
b_sharp& = Create("Button",%HWnd,"sharp", 10, 320, 80, 24)
b_ton& = Create("Button",%HWnd,"ton", 10, 345, 80, 24)
b_cls& = Create("Button",%HWnd,"cls", 120, 20, 40, 24)
hw& = create("Edit", %HWnd, "", 100,500,60,20)
ht& = create("Edit", %HWnd, "", 100,525,60,20)
hx& = create("Edit", %HWnd, "", 100,550,90,20)
hy& = create("Edit", %HWnd, "",100,575,90,20)
htext& = create("Edit", %HWnd, "",0,0,0,0)
hd1& = create("Edit", %HWnd, "",300,500,90,20)
startpaint bpic&
USEP 0,1,$ff0000
EndPaint
startpaint %HWnd
drawpic bpic&,200,20;0
DrawText 20, 500, "Entfernung"
DrawText 20, 525, "Status"
DrawText 20, 550, "XPosition"
DrawText 20, 575, "YPosition"
DrawText 245, 500, "seriell"
EndPaint
p& = pExec("|Prozess",hw&,ht&,hx&,hy&,htext&)
sleep 200
p1&=pExec("|Prozess1",%HWnd, hd1&)
sleep 200
p2&=pExec("|Prozess2")
sleep 200
ZielFenster& = FindWindow("roboter")
ende&=1
While ende&
WaitInput
If Clicked(b_vor&)
Text$="1,0,vor"
WriteStr(text $)
elseIf Clicked(b_zur&)
Text$="1,0,zur"
WriteStr(text $)
elseIf Clicked(b_links&)
Text$="1,0,links"
WriteStr(text $)
elseIf Clicked(b_hlinks&)
Text$="1,0,hlinks"
WriteStr(text $)
elseIf Clicked(b_mitte&)
Text$="1,0,mitte"
WriteStr(text $)
elseIf Clicked(b_hrechts&)
Text$="1,0,hrechts"
WriteStr(text $)
elseIf Clicked(b_rechts&)
Text$="1,0,rechts"
WriteStr(text $)
elseIf Clicked(b_v0&)
Text$="1,0,v0"
WriteStr(text $)
elseIf Clicked(b_v1&)
Text$="1,0,v1"
WriteStr(text $)
elseIf Clicked(b_v2&)
Text$="1,0,v2"
WriteStr(text $)
elseIf Clicked(b_ser0&)
Text$="1,0,ser0"
WriteStr(text $)
elseIf Clicked(b_ser1&)
Text$="1,1,ser1"
WriteStr(text $)
elseIf Clicked(b_sharp&)
Text$="1,2,sharp"
WriteStr(text $)
elseIf Clicked(b_ton&)
Text$="1,0,ton"
WriteStr(text $)
EndIf
If Clicked(b_cls&)
startpaint bpic&
drawpic bpich&,0,0;0
EndPaint
startpaint %HWnd
drawpic bpic&,200,20;0
EndPaint
EndIf
wtest&=val(gettext$(ht&))
x!=val(gettext$(hx&))
y!=val(gettext$(hy&))
if wtest& = 1
startpaint bpic&
USEP 0,1,$0000ff
Line 200,200-200+x!,200+y!
EndPaint
startpaint %HWnd
drawpic bpic&,200,20;0
EndPaint
endif
if wtest& = 2
startpaint bpic&
USEP 0,1,$ff00
Line 200,200-200+x!,200+y!
EndPaint
startpaint %HWnd
drawpic bpic&,200,20;0
EndPaint
endif
endwhile
end
Proc WriteStr
Parameters Text$
settext htext&,Text$
PostMessage(ZielFenster&, $1000, 0, 0)
ENDPROC
Proc Process
Parameters hw&,ht&,hx&,hy&,htext&
Declare ende&,Text$,test&,Test1&,wtest&,wert&,x!,y!,winkel!,urlpart$
Declare HandleMap&, ViewPointer&, Buffer#
windowtitle "roboter"
window 720,20 - 200, 200
Ende& = 0
User Messages $1000
WhileNot ende&
waitinput 100
If %UMessage = $1000
Text$ = gettext$(htext&)
Test1&=val(substr$(Text$,1,","))
if Test1& > 0
test&=1
wtest&=val(substr$(Text$,2,","))
urlpart$=substr$(Text$,3,",")
print Text$
Text$=""
endif
endif
if test&=1
downloadfile("https://192.168.2.101/?pin="+urlpart$)
test&=0
else
downloadfile("https://192.168.2.101/?pin=leer")
endif
while %Loading
sleep 10
endwhile
wert&=st$(ord($download))
if wtest&=1
winkel!=winkel!+1.6
if winkel! > 180.0
wtest&=0
winkel!=0
endif
x!=Sin(winkel!*0.0174532925199433)*wert&
y!=Cos(winkel!*0.0174532925199433)*wert&
endif
if wtest&=2
winkel!=winkel!+1.6
if winkel! > 180.0
wtest&=0
winkel!=0
endif
x!=Sin((winkel!+180)*0.0174532925199433)*wert&
y!=Cos((winkel!+180)*0.0174532925199433)*wert&
endif
setText hw&,st$(wert&)
setText ht&,st$(wtest&)
setText hx&,st$(x!)
setText hy&,st$(y!)
EndWhile
endProc
Proc Process1
parameters win&,hd1&
declare ende&,f&,wert&
declare Text$
f& = OpenCom("COM1",1024,1024)
SetCom("COM1:19200,n,8,1")
windowtitle "seriell"
window 920,20 - 200,200
print "Process Seriell"
ende& = 0
whilenot ende&
Case GetText$(win&) = "" : ende& = 1
GetComInput f&
endwhile
Proc GetComInput
Text$ = ReadCom$(f&,128,128)
wert&=Ord(text $)
if wert& > 0
setText hd1&, st$(wert&)
endif
ENDPROC
endproc
Proc Process2
declare ende&,bild&
windowtitle "pixel"
Window 1120,20-200,200
erzeugebild()
ende&=1
WHILE ende&
waitkey
ENDWHILE
proc erzeugebild()
Declare x&,y&
whileloop 1,199
y&=&loop
WhileLoop 1,199
startpaint %HWnd
x&=&loop
sleep 1
SetPixel x&,y&,rgb(255,0,0)
EndWhile
EndWhile
endproc
endproc
|
| | | | |
| | | funkheld (17.04.2016)
when becomes the Hauptprogramm time in that holpern come with the many Processen?
The Abarbeitung: shining I do not konsistent since the User Messages asynchron einflattern and this Time htext& "längst" new described go could. The each others Process ought to active on one Gegenzeichen Waiting. |
| | | | |
| | H.Brill | The others Parameter wparam and lparam with SendMessage / Postmessage can you Yes too yet benefit. so can you z.B. signalisieren, whether in the Hauptprogramm something changed has.
The Process, the The Message counts, can then over &uwParam or &ulParam the discern and properly react. |
| | | Benutze XPROFAN X3 + FREEPROFAN Wir sind die XProfaner. Sie werden von uns assimiliert. Widerstand ist zwecklos! Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.
Was die Borg können, können wir schon lange. | 04/17/16 ▲ |
| |
| | funkheld | thanks for Answer.
How can these testimony then Please umsetzen in a Process: ......The each others Process ought to active on one Gegenzeichen Waiting....
greeting |
| | | | |
| | H.Brill | what power because your Program very ?
How I the see, receiving Process The WLAN-data, Process1 receiving what over The serial interface and Process2 malt with SetPixel what aufs Window.
what IF probably means, is, that the processes Messages send, if what ready/is done.
means, if the Datenpaket over WLAN gesendet and the data accounts get, informed Process whom Process2, that it malen can. For this can wonderful The Parameter wParam and lParam of SendMessage using, circa with 0 or 1 view, that Process is done and Process2 begin can.
What the serial interface now power, have I not yet rausbekommen.
what me yet auffiel : i'd The Procs not absolutely ineinander nest, means a Proc in a others Proc.
the likes Perhaps always gutgehen, but leave would I there not. |
| | | Benutze XPROFAN X3 + FREEPROFAN Wir sind die XProfaner. Sie werden von uns assimiliert. Widerstand ist zwecklos! Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.
Was die Borg können, können wir schon lange. | 04/18/16 ▲ |
| |
| | funkheld | Yes thanks for Info.
The RS232 is first only to that Test in pursued and is then for data zuständig The parallel receive go for the Hauptprogramm of a Steuerplatine (Arduino). to that Hauptprogramm should any DatenFäden walk and then comes a action hereon.
means : - Process-WLan to that Hauptprogramm - Process-serial data to that Hauptprogramm - zuständige data to that Process Grafikfenster
so place I me the to.
Thank you. greeting |
| | | | |
|
AnswerThemeninformationenthis Topic has 3 subscriber: |