| |
|
|
GDL | Hi,
knows of you someone, How one with Profan on The Handshake lines(CTS would long) grab or. the value settle can ?
Hello Georg |
|
|
| |
|
|
|
Ragnar Rehbein | yes: CompileMarkSeparationdef createfile(7) !"kernel32.dll","CreateFileA"
def getlasterror(0) !"kernel32.dll","GetLastError"
def FormatMessage(7) !"Kernel32.dll","FormatMessageA"
def EscapeCommFunction(2) !"kernel32.dll","EscapeCommFunction"
def GetCommModemStatus(2) !"kernel32.dll","GetCommModemStatus"
def &clrbreak 0
def &clrdtr 6
def &clrrts 4
def &setbreak 8
def &setdtr 5
def &setrts 3
def &setxoff 1
def &setxon 2
def &cts_on $10
def &dsr_on $20
def &ring_on $40
def &rlsd_on $80
declare hport& porthandle
declare modemstatus& Modemstatus
declare ret&, message#
Proc lasterrorstring nur um den Text des letzten Fehlers von GetLastError zu bekommen
dim message#,1029
declare buffer&, flags&,source&,language&,arguments&, errorstring$
buffer& = 1024
flags& = $1000
language& = 0 ~lang_neutral
clear message#
FormatMessage((flags&),addr(source&),GetLastError(),(language&),message#,addr(buffer&),addr(arguments&))
errorstring$ = trim$(string$(message#,0))
dispose message#
return errorstring$
endproc
hport& = createfile("COM1",0,0,0,3,0,0)opencom("COM1",1024,1024)
print "Porthandle :",hport&
print
ret& = EscapeCommFunction(hport&,&setdtr)
print "DTR setzen"
case ret& = 0 : print "Fehler"
print lasterrorstring()
-----am besten einen Schalter zwischen DTR und z.B. CTS setzen
ret& = GetCommModemStatus(hport&,addr(modemstatus&))
print
print "Status der Eingänge ermitteln"
case ret& = 0 : print "Fehler"
print lasterrorstring()
-----Maskierung um an die einzelnen Bits zu kommen
if ret&
casenot modemstatus& & $FF : print "alles auf LOW"
case modemstatus& & &cts_on : print "CTS ON"
case modemstatus& & &dsr_on : print "DSR ON"
case modemstatus& & &ring_on : print "Ring ON"
case modemstatus& & &rlsd_on : print "RLSD ON"
endif
waitinput
print "Start"
declare zeit&,stop&,count&
zeit& = &gettickcount
whilenot stop&
whileloop 10
ret& = GetCommModemStatus(hport&,addr(modemstatus&))
print modemstatus&,"";
inc count&
endwhile
sleep 1
case &gettickcount - zeit& > 50 : stop& = 1
endwhile
print ""
print &gettickcount - zeit&
print "durchläufe :",count&
closecom(hport&) waitinput
was only time so one testprogramm circa altogether 4 switch seriell abzufragen. Please not so critically his
r.r. |
|
|
| |
|
|
|
GDL | Hello Ragnar (hope)
many Thanks.so paradox this sound likes, but I must The CTS pipeline as Sendeleitung missbrauchen, there with DCCNMRA only nobodies transfer go.
0 bit lasts 58 ms 1 bit lasts 109 ms Trennbit lasts 230 ms.
The reason: so one The Lokomotiven on the track turn can is no Highbit Auswertung possible. so one too without I/O ticket rad can, this ploy.
Hello Georg |
|
|
| |
|
|
|
Ragnar Rehbein | Hello georg !
i see not integrally How one CTS as sendeleitung using can. CTS is still only one entry and can itself to my knowledge not umprogrammieren.
but independent of it .. having you my zeilen help can ? or had You the already ?
ragnar |
|
|
| |
|
|
|
GDL | Hello Ragnar,
your code helps on any Cases moreover.
CTS has too The RS232 as exit circa one modem communicating to,whether The interface empafangsbereit is.
How before described, go only Low states ausgewertet.
the heist. CTS becomes on standardmäßig on High staid. with one zero bit becomes The pipeline for 58 ms on Low staid. with one Highbit for 109 ms etc. Startbit is a Präambel from 10 zero Bits one after another.
The actual RS232 Lines and irgendeine Baudrate go NOT using.it'll solely a pipeline needed.
Why: the Ausgangssignal and Computermasse go one Booster zugeführt.The power from it +18 and -18 Volt rectangle. now have I on the track on the a Anschluss The Rechteckspannung and on the others The volume.
with normalen RS 232 and Minimodem in the Lok could The Lok only in a direction the track staid go, there otherwise Yes The Empfangsleitung the Lok(abgenommen over The Räder) on volume läge. accordingly scheidet the normal RS232 lane from. Solution: in the Lok operates one Microcontroler the The abfallende and steigende centre pass in the Spannungversorgung recognize and the Time between both misst.
usually gives one The signals through 8255 I/O ticket from.there most normalen computer(no Industrierechner) no ISA Slots More and have PCI cards extreme valuable are,make I this lane over The RS232,Centronics and USB interface.where only More The RS232 abging.
Hello Georg |
|
|
| |
|
|
|
GDL | Hello Ragnar,
have your code adjusted. must but yet after a settimer Anpassung search,there settimer 1 not unterschiedlichen Taktfrequenzen exakt 1 ms is.
get this but certainly there.
Hello and over again thanks Georg |
|
|
| |
|
|
|
Ragnar Rehbein | minimale timerzyklen lying between 10 - 20 ms, according to betriebssystem. settimer 1 becomes always zyklen > 1 ms produce. CompileMarkSeparation so can too smaller ones zeitabstände Is it Unikode. becomes but from older boards not supported.
r.r. |
|
|
| |
|
|
|
GDL | Hello Ragnar,
have now so experimented, get but my Frequenzperioden of 0.056 ms 0,128 ms and 0,230 ms +/- max. 3% Fluctuation not there.
Nutze momentarily The RS232 normal with nem Atmel Microcontroler in the Verbindungs- pipeline.(should but only Notlösung his).
Hello Georg |
|
|
| |
|
|
|
Ragnar Rehbein | these accuracy is with XProfan well you don't say so his. through the interpretermodus (too one kompiliertes prg becomes interprets) is the abarbeitung in profane too slow. evtl. would it possible Profan2C++ To benefit. otherwise remaining only assambler.
r.r. |
|
|
| |
|
|