Datenkonvertierung Motorola(Big Endian) zu Intel(Little endian)

More
8 years 1 week ago #119200 by andrax
Hallo,

ich bekomme Positionsdaten im Motorola Format (Big Endian)
Die sehen in Hex so aus:0x 02 01 04 03
Ich brauch die aber in Linuxcnc im Intelformat (Little Endian), damit sie korrekt angezeigt und verarbeitet werden können.
Also so: 0x 01 02 03 04

Gibt es eine Funktion in der Hal mit der ich die Daten entsprechend konvertieren kann,
bzw. eine Möglichkeit die Bytes aufzudröseln und entsprechend wieder zusammenzusetzen?


Besten Dank in Vorraus

Andre

Please Log in to join the conversation.

More
8 years 1 week ago #119265 by andypugh
The tidy way way:
linuxcnc.org/docs/2.7/html/hal/comp.html

I thought about doing it with bitslice and weighted-sum but weighted-sum only processes 16 bits of data.

UNTESTED!
Code:
component endian "swap endian-ness of a 32 bit integer"; pin in unsigned in; pin out unsigned out; license "GPL2+"; author "andypugh"; function _; ;; FUNCTION(_){ int temp1, temp2; temp1 = in & 0xFFFF0000 >> 16; temp2 = in & 0x0000FFFF << 16; out = temp1 | temp2; }

Please Log in to join the conversation.

More
8 years 1 week ago #119330 by andrax
Das ist eine super Idee.
Hätt ich selber drauf kommen können

Vielen Dank

Andre

Please Log in to join the conversation.

More
8 years 5 days ago #119456 by andrax
Hallo,

ich habe mir die Funktion erstellt.
Ich benutze Linuxcnc 2.6.13
Die funktion habe ich "Conv_Intel_Motorola.comp" benannt.

Ich habe sie Compiliert ind installiert.
Code:
comp --compile Conv_Intel_Motorola.comp
Code:
comp --install Conv_Intel_Motorola.comp

In der .hal habe ich
loadrt Conv_Intel_Motorola --> OK
addf Conv_Intel_Motorola servo-thread

Hier bekomme ich HAL: ERROR: funktion 'Conv_Intel_Motorola' not found

Danach habe ich es mit

addf Conv_Intel_Motorola.0 servo-thread

probiert und bekomme ebenfalls

HAL: ERROR: funktion 'Conv_Intel_Motorola.0' not found

was ist falsch?

Please Log in to join the conversation.

More
8 years 4 days ago #119465 by andypugh
Welches Version LinuxCNC? Heute ist "comp" "halcompile"

Filename und "component "name";" muss genau übereinstimmen

Please Log in to join the conversation.

More
8 years 4 days ago #119470 by andrax
OK,

bin einen Schritt weiter.
Aus irgend einen Grund läd er mein Modul als Conv-Intel-Motorola.0

Also muss ich die Funktion folgendermaßen aufrufen

addf Conv-Intel-Motorola.0 servo-thread

Aber wie Kann ich die Funktion benutzen?
Conv-Intel-Motorola.0 lcec.0.3.ist_pos_data Istposition >>> funktioniert nicht.
Wie ist die richtige Syntax ?

Gruß

Andre

Please Log in to join the conversation.

More
8 years 4 days ago #119472 by andypugh
Code:
net a-signal-name-of-your-choice lcec.0.3.ist_pos_data => Conv-Intel-Motorola.0.in net another-signal-name Conv-Intel-Motorola.0.out => destination pin

Please Log in to join the conversation.

More
8 years 4 days ago #119475 by andrax

Please Log in to join the conversation.

More
8 years 2 days ago #119584 by andrax
Hallo,

jetzt stellt sich mir doch noch eine Frage.
Kann ich meine Funktion instanzieren?
Das ist jetzt so gemeint, ob ich die selbe Funktion für unterschiedliche Aufgaben (Pins und Achsen) benutzen kann.
Oder muss ich für jeden Pin/Achse eine eigene Funktion erstellen, bzw. meine Funktion um entsprechende in/out erweitern.

Vielen Dank im Voraus

Gruß

Andre

Please Log in to join the conversation.

More
8 years 1 day ago #119640 by andypugh
Code:
loadrt Conv-Intel-Motorola count=6

oder
Code:
loadrt Conv-Intel-Motorola names=conv-x,conv-y,conv-z
(keine Leerzeichen)

Please Log in to join the conversation.

Time to create page: 0.113 seconds
Powered by Kunena Forum