| |
|
|
Pedro Miguel | Hallo,
Bis jetzt habe ich mit der serielle schnittstelle Texte empfangen. Habe nun ein neues Projekt in der ich von eine elektronische Platine binäre Daten empfangen und sofort auswerten muss. Die Auswertung sieht folgendes Masse aus. Es werden von der Platine kontienurlich 12 bis 16 Bytes gesendet. Auf der Xprofan seite muss ich die Bytes empfangen und sofort die einzelnen Bits durch TestBit auswerten um damit Led Graphiken als ON OFF anzuzeigen. Die baurate ist 38400, 8 Bits, None, 1 Stopbit
Weiss jemand ob das mit Xprofan zu machen ist?
Danke für jede Unterstützung
Gruss Pedro |
|
|
| |
|
|
|
| there XProfans Strings binärsicher are Gibts none Difference between Text or
Binärdaten read by ReadCom$ -
simply ReadCom$ use. whom Bytewert one (Ansi-) Zeichens a
XProfan-String simply z.B. by byte(addr$(string$),num&) read. CompileMarkSeparation After ähnlichem take action read I The data mobiler Barcode-Scanner from. |
|
|
| |
|
|
|
Pedro Miguel | Hello iF,
thanks, will be it on the weekend testing
from the Platine becomes z.b gesendet.
master = 254 destiny = 18 txcoma = 7 utterly = 1234
printbin master,destiny,utterly,txcoma
The Bytes and Words go without jeglichen Trenzeichen gesendet
After whom testing give I Feedback and come again hereon back
greeting Pedro |
|
|
| |
|
|
|
GDL | Hallöle,
Although purer Anfängercode, but it goes by me on all my facilities and Rechnern.
The problem is, that You 2 Protokolle have. One log over the gültige characters and a log over The string. by me form three 255 and a 0 in row whom Beginn one Datenprotokoll. CompileMarkSeparation
proc einlesen'BMelder Stellpulttaster
'COM Schnittstelle auslesen
'Schnittstelle wird am Proganfang geöffnet und erst am Progende geschlossen
declare sync%,lb%
settext _text&[12],"Einlesestatus : aktiv "+time$(0)+" "+left$(time$(1),5)\
+" Zeitwechsel ist ein Einlesevorgang."
'Schnittstelle auslesen 3mal 255 und 1mal 0 hintereinander ist Sync
'Empfangsprotokoll 255 255 255 0 Bahnhof Punkt Lok Auswahl Fehlerbyte
'Auswahl
'254 = Stellpult
'253 = Geschwindigkeit
'252 = Standardgeschwindigkeit bei Umschalten auf Grün anfordern
'ja
clear cstart%
clear sync%
clear lb%
comwert$=@ReadCom$(comi1&,1)
@ComError(comi1&)
case str$(ord(comwert$))="255":inc sync%
whilenot comwert$=""
comwert$=@ReadCom$(comi1&,1)
@ComError(comi1&)
case str$(ord(comwert$))="255":inc sync%
If str$(ord(comwert$))="0"'Beginn des Datenprotokolls
' Hat hier nichts mit Start,Stopbit zu tun, sondern ersetzt das Handshaking
if sync%=3
lb%=1' Die drei 255 Startbyte wurden beim folgendem Nullbyte erkannt
else
clear sync%
clear cstart%
clear lb%
endif
endif
if lb% =1
inc cstart%
_inhalt%[cstart%]=ord(comwert$)
endif
if cstart% = 5
clear cstart%
clear sync%
clear lb%
'Fehlerbyte erzeugen
'Fehlerbyte vergleichen
'Bei Fehler _inhalt%[5]=0
if _inhalt%[5]=253
settext _text&[8],"Lok : "+right$("00"+str$(_inhalt%[4]),3)
auswerten1
'Falls dieser BMelder etwas auslöst
tasterbahnhof%=_inhalt%[2]
tasterwert%=_inhalt%[3]
tasterwert%=tasterwert%+(tasterbahnhof%*256)-256'Punkte gehen hier von 1 bis 999
bm_auswerten
elseif _inhalt%[5]=254
settext _text&[8],"Taster : "+right$("00"+str$(_inhalt%[3]),3)
settext _text&[9],"Stellwerk : "+right$("00"+str$(_inhalt%[2]),3)
tasterbahnhof%=_inhalt%[2]
tasterwert%=_inhalt%[3]
auswerten
elseif _inhalt%[5]=252
settext _text&[8],"Lok : "+right$("00"+str$(_inhalt%[4]),3)
real_speed
endif
wend
Perhaps can you you what abguggen. As I said, the whole would one Profi certainly differently solve. |
|
|
| |
|
|