Jump to content

MasT3r-A

Members
  • Gesamte Inhalte

    15
  • Benutzer seit

  • Letzter Besuch

MasT3r-A's Achievements

Newbie

Newbie (1/14)

0

Reputation in der Community

  1. Guten Morgen Tinker Unity! Hat sich schon irgendwas in der Richtung getan? Ich selbst wäre stark interessiert mir eine CNC Fräse zu bauen.. Und mit dem TinkerSystem wäre das nen Heidenspaß.. Grüße
  2. Hey borg! Danke für die Info! Genau das wollte ich hören! Werde mich dann um eine andere Lösung kümmern. Grüße Artur
  3. Hallo Tinker Freunde! Ich hätte da eine Frage zum IO-4. Kann man die Standarteinstellungen des IO-4 ändern, sodass z.B. beim Bestromen des MasterBricks nicht alle IO-4 Ports als INPUTS/HIGH eingestellt sind? In meinem C# Programm parametriere ich diese ja auch wie ich Sie brauche. Doch bräuchte ich zwei Ports als Ausgänge (auch wenn der MasterBrick noch keinen Input erhalten hat vom C# Programm). Grüße Artur
  4. ich muss noch dazu sagen das an den PINs 0 und 1 zwei Endschalter hängen. Ich überprüfe die Values und den Status des Motors. Funktionieren tut dies soweit ganz gut .. nur wenn ich den Pin 2 des IO-4 als OUTPUT setze dann ändert sich ja mein valueBinary.. =( private void InterruptCB(BrickletIO4 sender, byte interruptMask, byte valueMask) { if (io4 != null) { string interruptBinary = System.Convert.ToString(interruptMask, 2); string valueBinary = System.Convert.ToString(valueMask, 2); SetTextBoxRef0(interruptBinary); SetTextBoxRef1(valueBinary); if ( ((valueBinary == "1110") || (valueBinary == "1100")) && ((y_new_state == "BESCHLEUNIGUNG")||(y_new_state == "FAHREN")) )//Endschalter (Y-Achse) { Y_Achse.Stop(); y_stop_nach_endschalter = true; } if (((valueBinary == "1101") || (valueBinary == "1100")) && ((x_new_state == "BESCHLEUNIGUNG") || (x_new_state == "FAHREN"))) //Endschalter (X-Achse) { X_Achse.Stop(); x_stop_nach_endschalter = true; } if (x_stop_nach_endschalter == true && y_stop_nach_endschalter == true) { Interrupt(); } } } Ich würde aber gerne diese Funktion behalten und nur einen Pin als Ausgang nutzen.. der aber komplett unabhängig vom anderen sein soll.. oder soll ich lieber einen zweiten io-4 anbringen und den dann für meinen Ausgang nutzen?!
  5. Hallo TinkerUnity! Besteht die Möglichkeit das IO-4 Bricklet so zu nutzen das zwei Pins als EINGÄNGE und 1 (oder auch zwei) Pins als AUSGÄNGE genutzt werden können?! Ich nutze PIN 0 und 1 als Eingänge und würde gerne PIN 3 bzw. 4 als Ausgang nutzen.. Ich programmiere in C#. Im Moment hab ich nur io4.SetInterrupt(3 << 0); um den Interrupt zu aktivieren für die PINs 0 und 1. Würde mich über Antworten freuen. Vielen Dank im Voraus Grüße Artur
  6. Sooo es hat geklappt ..Danke Nic für den Denkanstoß mein InterruptCB sieht nun so aus: private void InterruptCB(BrickletIO4 sender, byte interruptMask, byte valueMask) { if (io4 != null) { string interruptBinary = System.Convert.ToString(interruptMask, 2); string valueBinary = System.Convert.ToString(valueMask, 2); SetTextBoxRef0(interruptBinary); SetTextBoxRef1(valueBinary); if ( ((valueBinary == "1110") || (valueBinary == "1100")) && ((y_new_state == "BESCHLEUNIGUNG")||(y_new_state == "FAHREN")) )//Endschalter (Y-Achse) { Y_Achse.Stop(); y_stop_nach_endschalter = true; } if (((valueBinary == "1101") || (valueBinary == "1100")) && ((x_new_state == "BESCHLEUNIGUNG") || (x_new_state == "FAHREN"))) //Endschalter (X-Achse) { X_Achse.Stop(); x_stop_nach_endschalter = true; } if (x_stop_nach_endschalter == true && y_stop_nach_endschalter == true) { Interrupt(); } } } und meine NewState für X und Y so: private void NewStateX(BrickStepper sender, byte stateNew, byte statePrevious) { State_x_previous_Label(Convert.ToString(statePrevious)); State_x_new_Label(Convert.ToString(stateNew)); // x_State_previous if (statePrevious == 1) { x_prev_state = "STOP"; } if (statePrevious == 2) { x_prev_state = "BESCHLEUNIGUNG"; } if (statePrevious == 3) { x_prev_state = "FAHREN"; } if (statePrevious == 4) { x_prev_state = "VERZOEGERUNG"; } // x_State_new if (stateNew == 1) { x_new_state = "STOP"; } if (stateNew == 2) { x_new_state = "BESCHLEUNIGUNG"; } if (stateNew == 3) { x_new_state = "FAHREN"; } if (stateNew == 4) { x_new_state = "VERZOEGERUNG"; } } private void NewStateY(BrickStepper sender, byte stateNew, byte statePrevious) { State_y_previous_Label(Convert.ToString(statePrevious)); State_y_new_Label(Convert.ToString(stateNew)); // y_State_previous if (statePrevious == 1) { y_prev_state = "STOP"; } if (statePrevious == 2) { y_prev_state = "BESCHLEUNIGUNG"; } if (statePrevious == 3) { y_prev_state = "FAHREN"; } if (statePrevious == 4) { y_prev_state = "VERZOEGERUNG"; } // y_State_new if (stateNew == 1) { y_new_state = "STOP"; } if (stateNew == 2) { y_new_state = "BESCHLEUNIGUNG"; } if (stateNew == 3) { y_new_state = "FAHREN"; } if (stateNew == 4) { y_new_state = "VERZOEGERUNG"; } } Grüße
  7. Hey Nic - danke das werde ich morgen auf jeden Fall testen.. Grüße Artur
  8. Hallo Tinkerfreunde! Ich weiß es gibt hier im Forum schon einige ähnliche Beiträge, doch hilft mir das nicht ganz weiter! Ich möchte zwei Endschalter an meinem Kreuztisch anbringen um die Referenzfahrt zu ermöglichen. Dabei verfahre ich beide Achsen X und Y langsam in die gewünschten Ecken und beim Überfahren des Endschalters möchte ich das die Motoren stehen bleiben .. dann 50 Steps wieder vorfahren so das die Motoren vom Endschalter wegfahren. UND dann die Aktuelle Position '0' setzen. Mein Problem ist halt der Interrupt des Endschalters (beide am IO-4). Wenn ich ein LOW auf dem Pin erhalte soll er ja stehen bleiben.. dann komm ich aber nicht wieder raus aus der Ecke. Mein Enumeration sieht so aus: // Enumeration is for IO-4 Bricklet if (deviceIdentifier == BrickletIO4.DEVICE_IDENTIFIER) { io4 = new BrickletIO4(UID, ipcon); io4.Interrupt += InterruptCB; // Enable interrupt io4.SetInterrupt(15 << 0); } und mein InterruptCB so: private void InterruptCB(BrickletIO4 sender, byte interruptMask, byte valueMask) { if (io4 != null) { string interruptBinary = System.Convert.ToString(interruptMask, 2); string valueBinary = System.Convert.ToString(valueMask, 2); SetTextBoxRef0(interruptBinary); SetTextBoxRef1(valueBinary); if (interruptBinary == "1" & valueBinary == "1110") //Endschalter (Y-Achse) { Y_Achse.Stop(); io4.SetInterrupt(14 << 0); InterruptY(); } else if (interruptBinary == "10" & valueBinary == "1101") //Endschalter (X-Achse) { X_Achse.Stop(); io4.SetInterrupt(13 << 0); InterruptX(); } } } InterruptX() sieht so aus: private void InterruptX() { X_Achse.Stop(); Thread.Sleep(100); X_Achse.SetSteps(50); if (pos_reached_x == 1) { Thread.Sleep(100); X_Achse.SetCurrentPosition(0); pos_reached_x = 0; io4.SetInterrupt(15 << 0); } } Ich habe versucht den Interrupt für diesen Pin an der Stelle abzuschalten. Doch leider funktioniert das nicht. Hat jemand ne Idee wie ich den Interrupt für den Pin abschalten kann für die Zeit bis der Motor aus der Endlage herausgefahren ist.?? Grüße Artur
  9. Das mit '1' und '2' hab ich probiert .. hab irgendwie nicht funktioniert.. habs nur so gemacht.. und siehe da Alldata wird für beide Achsen alle 500ms angezeigt.. if (deviceIdentifier == BrickStepper.DEVICE_IDENTIFIER) { if (UID == "69imVq") { X_Achse = new BrickStepper(UID, ipcon); X_Achse.AllData += AllDataX; X_Achse.SetAllDataPeriod(500); } else if (UID == "6dLjnF") { Y_Achse = new BrickStepper(UID, ipcon); Y_Achse.AllData += AllDataY; Y_Achse.SetAllDataPeriod(500); } }
  10. ok .... hab das nu mit der abfrage der UID gemacht.. und jetzt klappt es .. unglaublich... hmm großes Dankeschön! Grüße
  11. Ist dieser Teil überhaupt richtig so? // Callback handles device connections and configures possibly lost // configuration of lcd and temperature callbacks, backlight etc. private void EnumerateCB(IPConnection sender, string UID, string connectedUID, char position, short[] hardwareVersion, short[] firmwareVersion, int deviceIdentifier, short enumerationType) { if (enumerationType == IPConnection.ENUMERATION_TYPE_CONNECTED || enumerationType == IPConnection.ENUMERATION_TYPE_AVAILABLE) { if (deviceIdentifier == BrickStepper.DEVICE_IDENTIFIER) { if (position == 1) { X_Achse = new BrickStepper(UID, ipcon); X_Achse.AllData += AllDataX; } else if (position == 2) { Y_Achse = new BrickStepper(UID, ipcon); Y_Achse.AllData += AllDataY; } } } }
  12. Also mein Sourcecode ist nicht geheim.. namespace CrazyStuff { public partial class Form1 : Form { private static string HOST = "localhost"; private static int PORT = 4223; private static IPConnection ipcon = null; private static BrickStepper X_Achse = null; private static BrickStepper Y_Achse = null; private delegate void SetuidTextBoxCallback(string value); private delegate void SetconnectedUIDTextBoxCallback(string value); private delegate void SetpositionTextBoxCallback(string value); private delegate void SetdeviceidentifierTextBoxCallback(string value); private delegate void GetStackVoltageLabelCallback(string value); private delegate void GetRemainingStepsLabelCallback(string value); private delegate void GetActualPositionLabelCallback(string value); private delegate void GetCurrentConsumptionLabelCallback(string value); public Form1() { InitializeComponent(); // Create IP Connection ipcon = new IPConnection(); // Register IP Connection callbacks ipcon.EnumerateCallback += EnumerateCB; ipcon.Connected += ConnectedCB; // Connect to brickd, will trigger cb_connected ipcon.Connect(HOST, PORT); ipcon.Enumerate(); } // Callback handles device connections and configures possibly lost // configuration of lcd and temperature callbacks, backlight etc. private void EnumerateCB(IPConnection sender, string UID, string connectedUID, char position, short[] hardwareVersion, short[] firmwareVersion, int deviceIdentifier, short enumerationType) { if (enumerationType == IPConnection.ENUMERATION_TYPE_CONNECTED || enumerationType == IPConnection.ENUMERATION_TYPE_AVAILABLE) { SetdeviceidentifierTextBox(Convert.ToString(deviceIdentifier)); SetpositionTextBox(Convert.ToString(position)); SetconnectedUIDTextBox(Convert.ToString(connectedUID)); SetuidTextBox(Convert.ToString(UID)); if (deviceIdentifier == BrickStepper.DEVICE_IDENTIFIER) { if (position == 1) { X_Achse = new BrickStepper(UID, ipcon); X_Achse.AllData += AllDataX; } else if (position == 2) { Y_Achse = new BrickStepper(UID, ipcon); //Y_Achse.AllData += AllDataY; noch nicht programmiert } } } } private void AllDataX(BrickStepper sender, int currentVelocity, int currentPosition, int remainingSteps, int stackVoltage, int externalVoltage, int currentConsumption) { GetStackVoltageLabel(Convert.ToString(externalVoltage / 1000) + "V"); GetRemainingStepsLabel(Convert.ToString(remainingSteps)); GetActualPositionLabel(Convert.ToString(currentPosition)); GetCurrentConsumptionLabel(Convert.ToString(currentConsumption) + "mA"); } //############################################################################################################ Callback handles reconnection of IP Connection private void ConnectedCB(IPConnection sender, short connectReason) { // Enumerate devices again. If we reconnected, the Bricks/Bricklets // may have been offline and the configuration may be lost. // In this case we don't care for the reason of the connection ipcon.Enumerate(); } //############################################################################################# private void SetdeviceidentifierTextBox(string value) { // Invoke nötig? if (deviceIdentifier.InvokeRequired) { // Invoke nötig deviceIdentifier.Invoke((MethodInvoker)delegate { deviceIdentifier.Text = value; }); } else { // Kein Invoke nötig - Vorgang sicher durchführbar deviceIdentifier.Text = value; } } //############################################################################################# private void SetpositionTextBox(string value) { // Invoke nötig? if (position.InvokeRequired) { // Invoke nötig position.Invoke((MethodInvoker)delegate { position.Text = value; }); } else { // Kein Invoke nötig - Vorgang sicher durchführbar position.Text = value; } } //############################################################################################# private void SetconnectedUIDTextBox(string value) { // Invoke nötig? if (connected_uid.InvokeRequired) { // Invoke nötig connected_uid.Invoke((MethodInvoker)delegate { connected_uid.Text = value; }); } else { // Kein Invoke nötig - Vorgang sicher durchführbar connected_uid.Text = value; } } //############################################################################################# private void SetuidTextBox(string value) { // Invoke nötig? if (uid.InvokeRequired) { // Invoke nötig uid.Invoke((MethodInvoker)delegate { uid.Text = value; }); } else { // Kein Invoke nötig - Vorgang sicher durchführbar uid.Text = value; } } //############################################################################################# private void GetCurrentConsumptionLabel(string value) { // Invoke nötig? if (lbl_current_consumption.InvokeRequired) { // Invoke nötig lbl_current_consumption.Invoke((MethodInvoker)delegate { lbl_current_consumption.Text = value; }); } else { // Kein Invoke nötig - Vorgang sicher durchführbar lbl_current_consumption.Text = value; } } //############################################################################################# private void GetActualPositionLabel(string value) { // Invoke nötig? if (lbl_akt_position.InvokeRequired) { // Invoke nötig lbl_akt_position.Invoke((MethodInvoker)delegate { lbl_akt_position.Text = value; }); } else { // Kein Invoke nötig - Vorgang sicher durchführbar lbl_akt_position.Text = value; } } //############################################################################################# private void GetRemainingStepsLabel(string value) { // Invoke nötig? if (lbl_rem_steps.InvokeRequired) { // Invoke nötig lbl_rem_steps.Invoke((MethodInvoker)delegate { lbl_rem_steps.Text = value; }); } else { // Kein Invoke nötig - Vorgang sicher durchführbar lbl_rem_steps.Text = value; } } //############################################################################################# private void GetStackVoltageLabel(string value) { // Invoke nötig? if (lbl_ext_voltage.InvokeRequired) { // Invoke nötig lbl_ext_voltage.Invoke((MethodInvoker)delegate { lbl_ext_voltage.Text = value; }); } else { // Kein Invoke nötig - Vorgang sicher durchführbar lbl_ext_voltage.Text = value; } } } } Also wenn ich das Programm starte dann wird in meiner Windows Form in den Invoked-Textboxen angezeigt: Connected_UID UID Position deviceIdentifier Mein Problem ist einfach (denke ich) das ich die Position nicht korrekt abfrage und dann den Stepper nicht richtig zuweise. Danke schonmal für eure Mühe.
  13. Also die StepperBricks funktionieren einzeln wunderbar.. Achsen verfahren. Der Aufbau ist nicht das Problem! Stromversorgung auch nicht. Ich habe nach dem Robusten Ansatz programmiert mit der [EnumerateCB]-Funktion. Die Schwierigkeiten sind aufgetreten als ich dann auf einmal 2xStepperbricks am Master habe. Die Zuordnung kann dann ja nur über die Abfrage der Position im Stack stattfinden.. dies habe aber noch nicht im Griff .. ich denke da liegt auch das Problem! =(
  14. Hallo Tinkerfreunde! Entweder bin ich zu doof oder ich bekomme es einfach nicht hin. Leider habe ich auch noch keinen Eintrag dazu gefunden. Ich möchte einen Kreuztisch mit 2 Achsen (X und Y) aufbauen. Dafür habe ich einen Master und 2x den StepperBrick. Meine Problem ist, ich bekomme es nicht hin es so zu programmieren (C#) das ich beide Stepper separat ansteuern kann. Irgendwas mache ich falsch bzw. hab keine Ahnung wie ich es richtig machen soll. StepperBrick 1 hängt an Position 1 und StepperBrick 2 hängt an Position 2 im Stack (Pos. 0 ist der Master) Kann mir jemand weiterhelfen? Würde mich über jeden Beitrag freuen! Danke Artur
  15. Ist es denn möglich mit einem IO-4 oder einem IO-16 eine DUALE H-Brücke [http://www.ebay.de/itm/like/400555353115?lpid=106&_configDebug=ViewItemDictionary.ENABLE_PAYMENTS_IN_HLP:true&hlpht=true&ops=true&viphx=1] (an der 1-2DCs angeschlossen sind) anzusteuern?? Grüße A.R.
×
×
  • Neu erstellen...