English
Forum

Serielle interface binäre data receive

 

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
 
10/30/12  
 



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
'{$cleq}
cls
var s$="HALLO"
print byte(addr(s$),1),"= 65"
waitinput
en

After ähnlichem take action read I The data mobiler Barcode-Scanner from.
 
10/30/12  
 




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
 
10/30/12  
 




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.
 
Windows7 Xprofan 8,9,10 [...]  [...] 
11/10/12  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.890 Views

Untitledvor 0 min.
H.Brill09/26/24
Langer01/04/23
Walter02/08/18
Pedro Miguel08/10/15
More...

Themeninformationen

this Topic has 3 subscriber:

Pedro Miguel (2x)
GDL (1x)
iF (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie