- MultiPlus Wechselrichter Insel und Nulleinspeisung Conrad         
Seite 5 von 7 ErsteErste ... 34567 LetzteLetzte
Ergebnis 41 bis 50 von 63

Thema: javax.comm runterladen - wo?

  1. #41
    Erfahrener Benutzer Robotik Einstein
    Registriert seit
    01.11.2003
    Ort
    Freiburg im Breisgau
    Alter
    36
    Beiträge
    2.624
    Anzeige

    Powerstation Test
    Also bisher bin ich froh, dass ich durch die Schule gezwungen bin Java zu lernen, es bringt mir wirklich viel! :o)
    Auch, wenn bei mir die Javax.comm noch nicht richtig funktionert (irgendwie erkennt die Software die Dateien nicht).
    Ich muss mich damit aber irgendwann nochmal mehr beschäftigen! ;o)

    Wenn ich so an meine kläglichen Versuche, C++ zu programmieren, zurückdenke, da bin ich froh, dass ich Java habe!
    Nungut, da war ich auch 13 Jahre alt, aber trotzdem ... ;o)

  2. #42
    Erfahrener Benutzer Roboter-Spezialist
    Registriert seit
    11.11.2005
    Beiträge
    321
    Und komm mir jetzt nicht von wegen Java sei langsam...


    für die zeitkritischen routinen....he...he...schnarrch...he....für das arbeiten mit der gameboycam am AVR zu langsam in der pixelübertragung.

  3. #43
    Erfahrener Benutzer Roboter-Spezialist
    Registriert seit
    11.11.2005
    Beiträge
    321
    .....Aber Achtung: Ich finde das nicht ohne, dass SprinterSB diese Pakete einfach so hochlädt. Das wiederspricht je jeglichem Recht, da man in diesem Fall ja keine Lizenz abnicken muss,....

    du bist ein spinner....he.....

  4. #44
    Erfahrener Benutzer Roboter Genie
    Registriert seit
    21.10.2005
    Ort
    Erde
    Alter
    58
    Beiträge
    1.195
    Ähm, was soll da langsam sein? Zeitkritische Routinen? super_castle, ich weiss nicht wie Du die Pixel überträgst, bei mir zumindest ist der AVR der bottleneck, da der MAX232 nur 115kbd kann. Und mein PC ist mittlerweile 5Jahre alt, also nicht der Schnellste.

    Die Javacomm kapselt per JNI nur ein paar Aufrufe an eine C-lib (die wincomm32.dll nach der hier so viele gefragt haben) - wie RXTX eben auch. Da ist nichts langsamer als bei VB oder C oder Delphi. Was an Mehraufwand entsteht ist ein Funktionsaufruf. Der Rest ist vom JIT eh schon in Maschinencode übersetzt.

    castle, poste doch mal Deinen Code, vielleicht können wir Dir bei Deinem Perfomanceproblem ja weiter helfen.

  5. #45
    Erfahrener Benutzer Roboter Genie
    Registriert seit
    29.05.2005
    Beiträge
    1.018
    Ich bleibe bei C, da es zu meinem Alter passt.
    Falls super_castle tatsächlich Code posten sollte, müssen wir hier wahrscheinlich mit Lochkarten rechnen.
    Lieber Asuro programieren als arbeiten gehen.

  6. #46
    Erfahrener Benutzer Roboter-Spezialist
    Registriert seit
    11.11.2005
    Beiträge
    321
    aus einem bild 128x128pixel im picturefenster muss ein bestimmter grauton herausgesucht werden von dem gameboycambild für den robbyweg der gegangen werden soll ohne ein hindernisse anzusteuern und diese Suche der pixel ist in java zu langsam. weiterhin muss mit videocapture das übertragene funkcambild(farbe) noch dargestellt werden im javafenster (18bilder pro sekunde), die kommunikation über RS232 zur steuerung des robby vom pc aus (steuerelemente müssen im javafenster sein) muss auch noch aufrechterhalten werden. weiterhin werden mir die daten von der cmucam2 auf dem robby über funk an die serielle schnittstelle mitgeteilt und als auswertebalken iim fenster dargestellt

    hatte ich ganz vergessen, über den pda und purebasic habe ich auch noch eine verbindung zum robby. am pda ist ein AVR8 mit einem Funkmodul der die daten zum usbfunkmodul(rs232) des pc sendet.

    das alles kann ich zur zeit nur mit purebasic machen und es funktioniert reibungslos.

    vielleicht könnt ihr mir hier unter die arme greifen mit java wenn es geht.

    he... he... mit lochkarten geht das nicht...he...he..
    zur zeit laufen alle meine Sensoren (funk/bild/ton/ir/ultra/compassmodul, insgesamt 16 sensoren) in winavr-c auf dem robby.

    ein teil der programme :

    Code:
    gameboycam :
    
    IncludeFile "game-pebi-inc.pb"
    
    #BufferIn = 1024*16
    #BufferOut = 1024*16
    
    Global HCom.l 
    Global Chaine.s 
    Declare bild()
    
    Procedure pebi()
      los.s = "los"+Chr(13)
      ComSendByte(HCom,@los,Len(los))
      Buffer.b = 0
        
      StartDrawing( WindowOutput() )
      Delay(200)
        
      For y=20 To 127+20
        For x=200 To 127+200
          ComReadByte(HCom,@Buffer,1)           
          Plot(x,y,RGB(buffer,buffer,buffer))
        Next x
      Next y
         
      StopDrawing()
    EndProcedure
    
    Chaine="COM1:19200,N,8,1"
    
    Open_Window_0()
    
    Repeat ; Start of the event loop
      
      Event = WaitWindowEvent() ; This line waits until an event is received from Windows
      
      WindowID = EventWindowID() ; The Window where the event is generated, can be used in the gadget procedures
      
      GadgetID = EventGadgetID() ; Is it a gadget event?
      
      EventType = EventType() ; The event type
      
      ;You can place code here, and use the result as parameters for the procedures
      
      If Event = #PB_EventGadget
        
        If GadgetID = #Button_0
          If HCom <> 0                             
            MessageRequester("Message","Comport ist offen !",#MB_ICONEXCLAMATION)
          Else 
            HCom = ComOpen(Chaine,0 ,#BufferIn,#BufferOut)
          EndIf
          
        ElseIf GadgetID = #Button_1
          If HCom <> 0
            If ComClose(HCom)
              HCom = 0
            EndIf
          EndIf 
          
        ElseIf GadgetID = #Button_2
          If HCom <> 0
            pebi()      
          Else
            MessageRequester("Message","Comport nicht geöffnet !",#MB_ICONEXCLAMATION)
          EndIf
          
        EndIf
        
      EndIf
      
    Until Event = #PB_Event_CloseWindow ; End of the event loop
    
    If HCom <> 0
      If ComClose(HCom)
        HCom = 0
      EndIf
    EndIf 
    
    CloseWindow(0)
    
    End
    ;
    
    
    videocapture:
    
    IncludeFile "inc.pb"
    
    #WM_CAP_START = #WM_USER
    #WM_CAP_SET_CALLBACK_ERROR = #WM_CAP_START + 2
    #WM_CAP_SET_CALLBACK_STATUS = #WM_CAP_START + 3
    #WM_CAP_SET_CALLBACK_YIELD = #WM_CAP_START + 4
    #WM_CAP_SET_CALLBACK_FRAME = #WM_CAP_START + 5
    #WM_CAP_SET_CALLBACK_VIDEOSTREAM = #WM_CAP_START + 6
    #WM_CAP_SET_CALLBACK_WAVESTREAM = #WM_CAP_START + 7
    #WM_CAP_DRIVER_CONNECT = #WM_CAP_START + 10
    #WM_CAP_DRIVER_DISCONNECT = #WM_CAP_START + 11
    #WM_CAP_DRIVER_GET_CAPS = #WM_CAP_START + 14
    #WM_CAP_DLG_VIDEOFORMAT = #WM_CAP_START + 41
    #WM_CAP_DLG_VIDEOSOURCE = #WM_CAP_START + 42
    #WM_CAP_DLG_VIDEODISPLAY = #WM_CAP_START + 43
    #WM_CAP_SET_PREVIEW = #WM_CAP_START + 50
    #WM_CAP_SET_PREVIEWRATE = #WM_CAP_START + 52
    #WM_CAP_GET_STATUS = #WM_CAP_START + 54
    #WM_CAP_FILE_SAVEDIB = #WM_CAP_START + 25
    #WM_CAP_SET_SCALE = #WM_CAP_START + 53
    #WM_CAP_SET_CALLBACK_CAPCONTROL = #WM_CAP_START + 85
    #WM_CAP_EDIT_COPY = #WM_CAP_START + 30
    #WM_CAP_GRAB_FRAME = #WM_CAP_START+60
    
    Open_Window_0()
    OpenLibrary(0, "AVICAP32.DLL")
    
    hRobby = CallFunction(0, "capCreateCaptureWindowA", "Test", #WS_VISIBLE + #WS_CHILD, 120, 30, 300, 300, hWnd, 0)
    SendMessage_(hRobby, #WM_CAP_DRIVER_CONNECT, 0 , 0) 
    SendMessage_(hRobby, #WM_CAP_SET_SCALE , 1 , 0)
    SendMessage_(hRobby, #WM_CAP_SET_PREVIEWRATE, 50, 0)
    SendMessage_(hRobby, #WM_CAP_SET_PREVIEW, 1 , 0)
    
    Repeat ; Start of the event loop
      
      Event = WaitWindowEvent() ; This line waits until an event is received from Windows
      
      WindowID = EventWindowID() ; The Window where the event is generated, can be used in the gadget procedures
      
      GadgetID = EventGadgetID() ; Is it a gadget event?
      
      EventType = EventType() ; The event type
      
      ;You can place code here, and use the result as parameters for the procedures
      
      If Event = #PB_EventGadget
        
        If GadgetID = #Button_0
          If Link <> 0 
            StartDrawing( WindowOutput() )
            DrawImage(Link, 440,30,300, 300) 
            StopDrawing()
          EndIf
        EndIf
        
      EndIf
      
      SendMessage_(hRobby, #WM_CAP_GRAB_FRAME, 0 , 0)
      SendMessage_(hRobby, #WM_CAP_EDIT_COPY, 0 , 0)
      Link = GetClipboardData(#PB_ClipboardImage)
      
      Delay(1)
      
    Until Event = #PB_Event_CloseWindow ; End of the event loop
    
    SendMessage_(hRobby, #WM_CAP_SET_PREVIEW, 0, 0)
    SendMessage_(hRobby, #WM_CAP_DRIVER_DISCONNECT, "Test", 0)
    CloseWindow(0)
    CloseLibrary(0)
    
    End
    ;
    
    
    cmucamdaten:
    
    ; PureBasic Visual Designer v3.92 build 1460
    
    IncludeFile "cmu-pebi-inc.pb"
    
    #BufferIn = 1024*32
    #BufferOut = 1024*32
    
    Global HCom.l 
    Global Chaine.s 
    Global Buffer.b
    Global Buffer1.b
    Global Buffer2.b
    Global x.w
    Global y.w
    Global zaehler.l
    Global durch.w
    
    Dim cmudaten.b(40000)
    
    
    Procedure pebi()
    
      ComOpen(Chaine,0 ,#BufferIn,#BufferOut)
      
      los.s = "sf"+Chr(13)
      ComSendByte(HCom,@los,Len(los))
      
      Delay(500)
      
      zaehler=-1
      Repeat
        zaehler=zaehler+1
        ComReadByte(HCom,@Buffer,1)
        cmudaten(zaehler)=Buffer
      Until Buffer=3    
      
      StartDrawing( WindowOutput() )
      durch=0 
      zaehler=3
      x=120
      y=10
      Repeat
        durch=durch+1
        For z=0 To 86
          zaehler=zaehler+1
          Buffer=cmudaten(zaehler)
          zaehler=zaehler+1
          Buffer1=cmudaten(zaehler)
          zaehler=zaehler+1
          Buffer2=cmudaten(zaehler)     
          Plot(x,y,RGB(Buffer,Buffer1,Buffer2))
          x=x+1 
          Plot(x,y,RGB(Buffer,Buffer1,Buffer2))
          x=x+1 
        Next z
        zaehler=zaehler+1
        x=120
        y=y+1
      Until durch= 144
      ComClose(HCom)
      StopDrawing()
    EndProcedure
    
    Chaine="COM1:19200,N,8,1"
    
    Open_Window_0()
    
    Repeat ; Start of the event loop
      
      Event = WaitWindowEvent() ; This line waits until an event is received from Windows
      
      WindowID = EventWindowID() ; The Window where the event is generated, can be used in the gadget procedures
      
      GadgetID = EventGadgetID() ; Is it a gadget event?
      
      EventType = EventType() ; The event type
      
      ;You can place code here, and use the result as parameters for the procedures
      
      If Event = #PB_EventGadget
        
        If GadgetID = #Button_0
          If HCom <> 0                             
            MessageRequester("Message","Comport ist offen !",#MB_ICONEXCLAMATION)
          Else 
            HCom = ComOpen(Chaine,0 ,#BufferIn,#BufferOut)
          EndIf
          
        ElseIf GadgetID = #Button_1
          If HCom <> 0
            If ComClose(HCom)
              HCom = 0
            EndIf
          EndIf 
          
        ElseIf GadgetID = #Button_2
          If HCom <> 0
            pebi()      
          Else
            MessageRequester("Message","Comport nicht geöffnet !",#MB_ICONEXCLAMATION)
          EndIf
          
        EndIf
        
      EndIf
      
    Until Event = #PB_Event_CloseWindow ; End of the event loop
    
    If HCom <> 0
      If ComClose(HCom)
        HCom = 0
      EndIf
    EndIf 
    
    CloseWindow(0)
    
    End
    ;
    
    
    robbysteuerung über RS232 :
    
    ; PureBasic Visual Designer v3.92 build 1460
    
    IncludeFile "robo-inc.pb"
    
    #BufferIn = 1024
    #BufferOut = 1024
    
    Global HCom.l 
    Global Chaine.s 
    
    Chaine="COM1:19200,N,8,1"
    
    Open_Window_0()
    
    HCom = ComOpen(Chaine,0 ,#BufferIn,#BufferOut)     
    
    Repeat ; Start of the event loop
      
      Event = WaitWindowEvent() ; This line waits until an event is received from Windows
      
      WindowID = EventWindowID() ; The Window where the event is generated, can be used in the gadget procedures
      
      GadgetID = EventGadgetID() ; Is it a gadget event?
      
      EventType = EventType() ; The event type
      
      ; ButtonGadget(#Button_0, 170, 150, 60, 20, "rea")
      ; ButtonGadget(#Button_2, 40, 120, 60, 20, "lii")
      ; ButtonGadget(#Button_4, 40, 150, 60, 20, "lia")
      ; ButtonGadget(#Button_6, 150, 50, 60, 20, "reo")
      ; ButtonGadget(#Button_7, 80, 50, 60, 20, "lio")
      ; ButtonGadget(#Button_8, 170, 120, 60, 20, "rei")
      ; ButtonGadget(#Button_9, 150, 80, 60, 20, "reu")
      ; ButtonGadget(#Button_11, 80, 80, 60, 20, "liu")  
      
      If Event = #PB_EventGadget
        
        If GadgetID = #Button_0
          los.s ="130"+Chr(13)
          ComSendByte(HCom,@los,Len(los))
          
        ElseIf GadgetID = #Button_2
           los.s = "141"+Chr(13)
           ComSendByte(HCom,@los,Len(los))
           
        ElseIf GadgetID = #Button_4
           los.s = "138"+Chr(13)
           ComSendByte(HCom,@los,Len(los))
           
        ElseIf GadgetID = #Button_6
           los.s = "129"+Chr(13)
           ComSendByte(HCom,@los,Len(los))
           
        ElseIf GadgetID = #Button_7
           los.s = "137"+Chr(13)
           ComSendByte(HCom,@los,Len(los))
           
        ElseIf GadgetID = #Button_8
           los.s = "133"+Chr(13)
           ComSendByte(HCom,@los,Len(los))
           
        ElseIf GadgetID = #Button_9
           los.s = "132"+Chr(13)
           ComSendByte(HCom,@los,Len(los))
          
        ElseIf GadgetID = #Button_11
           los.s = "140"+Chr(13)
           ComSendByte(HCom,@los,Len(los))
          
        EndIf
        
      EndIf
      
    Until Event = #PB_Event_CloseWindow ; End of the event loop
    
    If HCom <> 0
      If ComClose(HCom)
        HCom = 0
      EndIf
    EndIf 
    
    End
    ;

  7. #47
    Erfahrener Benutzer Roboter Genie
    Registriert seit
    21.10.2005
    Ort
    Erde
    Alter
    58
    Beiträge
    1.195
    pebi^H^H^H^Hsuper_castle, ich weiss nicht, wo Du immer Deine Behauptungen her nimmst. Zeig doch bitte mal den java-code, der zu langsam sein soll! Den nehme ich mir dann her und messe mal wie schnell das geht (Am besten noch eine entsprechende Purebasic.exe dabei zum vergleichen).

    Vielleicht hast Du ja bei java die Nutzung von DirectDraw ausgeschaltet?

  8. #48
    Erfahrener Benutzer Roboter-Spezialist
    Registriert seit
    11.11.2005
    Beiträge
    321
    setzt mir die videocapturedatei oben so um, das ich aus der ablage ein fotoschnappschuss von videocapture mit einem button-druck in ein picturefenster setze, welches neben der laufenden vidocapturedarstellung (18bilder/sec) dargestellt wird und ich dann auswerten kann. wenn du das kannst, dann nehme ich dich ernst und wir können auf einem level reden.

    ich warte.

    ps: in purebasic harmoniert alles, so wie ich es möchte. mein ziel ist erreicht.
    wenn du mich mit java überzeugen kannst (die aufgabe oben), hast du ein pluspunkt.

    und wenn du mir ganz auf die schnelle sagen kannst, wie ich mit der javacomm die seriellen pins : RTS, DTR, CTS, DSR abfragen bzw ansprechen kann, hast du mir auch schon geholfen. diese pins brauche ich zum kommunizieren.

  9. #49
    Erfahrener Benutzer Roboter Genie
    Registriert seit
    21.10.2005
    Ort
    Erde
    Alter
    58
    Beiträge
    1.195
    Unten stehendes direkt kopiert aus der Dokumentation zur javacomm. Die Software dazu musst Du Dir schon selbst schreiben (werde aber mal ein paar benchmarks zur java2D Geschwindigkeit machen) Ernst nehmen musst Du mich deswegen natürlich nicht. Schneller gings auch nicht, war essen.

    o isCD()
    Gets the state of the CD (Carrier Detect) bit in the UART.
    o isCTS()
    Gets the state of the CTS (Clear To Send) bit in the UART.
    o isDSR()
    Gets the state of the DSR (Data Set Ready) bit in the UART.
    o isDTR()
    Gets the state of the DTR (Data Terminal Ready) bit in the UART.
    o isRI()
    Gets the state of the RI (Ring Indicator) bit in the UART.
    o isRTS()
    notifyOnCTS(boolean)
    Expresses interest in receiving notification when the CTS (Clear To Send) bit changes.
    o notifyOnDataAvailable(boolean)
    Expresses interest in receiving notification when input data is available.
    o notifyOnDSR(boolean)
    Expresses interest in receiving notification when the DSR (Data Set Ready) bit changes.
    o notifyOnFramingError(boolean)
    Expresses interest in receiving notification when there is a framing error.
    o notifyOnOutputEmpty(boolean)
    Expresses interest in receiving notification when the output buffer is empty.
    o notifyOnOverrunError(boolean)
    Expresses interest in receiving notification when there is an overrun error.
    o notifyOnParityError(boolean)
    Expresses interest in receiving notification when there is a parity error.
    o notifyOnRingIndicator(boolean)
    Expresses interest in receiving notification when the RI (Ring Indicator) bit changes.
    sendBreak(int)
    Sends a break of millis milliseconds duration.
    o setDTR(boolean)
    Sets or clears the DTR (Data Terminal Ready) bit in the UART.
    o setFlowControlMode(int)
    Sets the flow control mode.
    o setRcvFifoTrigger(int)
    Set the Receive Fifo trigger level If the UART has a FIFO and if it can have programmable trigger levels, then this method will cause the UART to raise an interrupt after trigger bytes have been received. Deprecated.
    o setRTS(boolean)
    Sets or clears the RTS (Request To Send) bit in the UART.
    o setSerialPortParams(int, int, int, int)
    Sets serial port parameters.

  10. #50
    Erfahrener Benutzer Roboter Genie
    Registriert seit
    21.10.2005
    Ort
    Erde
    Alter
    58
    Beiträge
    1.195
    Also kleiner Benchmark mit der Darstellung bei mir:

    128x128 Pixel von der GBCam, mit Faktor 2 in x- und y- Richtung skalieren.

    Damit ich vernünftige Messwerte bekomme habe ich das Bild 100 mal zeichnen lassen. Ergebnis: 3.8ms/Bild, macht 263 Bilder/sek, auf einem Centrino 1.2GHz Laptop mit Mobility Radeon 9000. Auf dem alten Athlon muss ich den Benchmark erst noch machen, kommt dann als edit...

    Also mir reicht das eigentlich an Geschwindigkeit und wenn mich meine mathematischen Kenntnisse nicht verlassen haben ist 263>18=true!

    Hier ist noch der Auszug aus dem Code mit dem ich den Benchmark gemacht habe:
    Code:
        public static final int rows = 128;
        public static final int columns = 128;
        public static final float stretch = 2.0;
        public int[][] image = new int[rows][columns];
    
        protected void paintComponent( Graphics g )
        {
            Graphics2D g2 = (Graphics2D) g;
            g.setColor( new Color( 0, 0, 0) );
            g.fillRect(0, 0, getWidth(), getHeight()); // just to delete old stuff
    
            g2.scale(stretch, stretch); //attach scaling transform to renderer
            long start = System.currentTimeMillis();
            // draw the image 100 times in order to get useful values for timing
            for (int i = 0; i<100; i++)
            {
                for (int y = 0; y < _rows; y++)
                {
                    for (int x = 0; x < _columns; x++)
                    {
                        // get the RGB value from the image array (where the data
                        // from the serial port has been written to.
                        img.setRGB(y, x, image[y][x]);
                    }
                }
                // render the image using only predefined affine transforms
                // (no additional tranform or filtering required
                g2.drawImage(img, null, 0, 0);
            }
            double used = System.currentTimeMillis() - start;
            System.out.println("used " + used + " ms");
        }
    Um es also mal zusammen zu fassen:
    1. Aussage: "javacomm geht nicht, macht fehler, ..." Das haben wir ja mittlerweile widerlegt
    2. Aussage: "java ist zu langsam in der Bilddarstellung und schafft keine 18 fps - Nun ja für 128x128 Pixel die noch dazu in x und y Richtung skaliert werden, stimmt das schon mal nicht.

    Vielleicht bekomme ich ja jetzt einen pluspunkt. Ich bebe vor freudiger Erwartung

    BTW, Atmel bringt mit dem AVR32 einen Kern, der direkt Java Bytecode ausführen kann.

Seite 5 von 7 ErsteErste ... 34567 LetzteLetzte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

Labornetzteil AliExpress