USB reading/writing as Com port

USB reading/writing as Com port

Postby Marc Venken » Wed Feb 07, 2024 10:23 pm

I spend the every looking and testing samples to read the USB port from FW

I did not succeed.

I can read/write arduino serial data from the Node-Red application from USB port 5. So it is possible to collect data from a Arduino true a USB port. How to read this data from it ?
Maybe it is important to have a usb to com hardware in FW ? But other programs seems to manage them from the USB port.

Any Help ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: USB reading/writing as Com port

Postby cmsoft » Thu Feb 08, 2024 12:41 am

Generally, when it is necessary to manage a device that connects via the USB port but responds to a serial structure, there are serial port emulators.
Here in Argentina, there are fiscal drivers that use that functionality, and they can be managed with Fivewin's COM port management functions.
User avatar
cmsoft
 
Posts: 1290
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: USB reading/writing as Com port

Postby Marc Venken » Thu Feb 08, 2024 8:39 am

Thanks, So i looked and find a program link CoolTerm, Free, Small and doing what you say. I have to test it this evening.

But it is software, so mayby FiveWin has also a Lib for this ? If I plugin my handscanner, FW can read this and it is also on a USB, but I suppose that this is not the same.

So If Coolterm is needed, I will have a txt/csv file that is updated very fast in realtime, and I can put my Arduino data into the file.

How will FW capture the data from that file (this is updated) and show result in a FW dialog. Just Open if with a fOpen function ? FW will be fast enough ?

My goal is to manage my Arduino RobotArm with FW design Dashboard. FW on Top )) !!
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: USB reading/writing as Com port

Postby karinha » Thu Feb 08, 2024 4:16 pm

Look,

Code: Select all  Expand view

#include "FiveWin.ch"

/*
Reconocer puerta USB


Local   aUnidades:=aDrives()
      FOR xI=1 TO LEN( aUnidades )
            IF GetDriveType( aUnidades[xI] )=2
              ?"USB"
           ELSEIF GetDriveType( aUnidades[xI] )=3
              ?"HDISK"
           ELSEIF GetDriveType( aUnidades[xI] )=5
              ?"CDROOM"
           ENDif
       NEXT

*/


FUNCTION Integrar()

   LOCAL aUnidades := aDrives(), Pendrive := '', uni := 0, XI

   FOR xI = 1 TO Len( aUnidades )

      IF GetDriveType( aUnidades[ xI ] ) = 2

         Uni :=  GetDriveType( aUnidades[ xI ] )

         Pendrive := aUnidades[ xI, 1 ] + ':'

      ENDIF

      ? Pendrive

      // ELSEIF GetDriveType( aUnidades[xI] )=3
      // ?"HDISK"
      // ELSEIF GetDriveType( aUnidades[xI] )=5
      // ?"CDROOM"

   NEXT

   IF uni == 2

      IF File( PenDrive + 'Evs.txt' )

         COPYFILE( 'Bak.rar', PenDrive + 'Bak.rar', .F. )

      ELSE

         // el correcto es MsgYesno()
         IF MsgInfo( OemToAnsi( 'Este nÆo e o PenDrive de Backup' ), + CRLF + ;
               'Deseja copiar mesmo assim?', OemToAnsi( 'Aten‡Æo' ) )

            COPYFILE( 'Bak.rar', PenDrive + 'Bak.rar', .F. )

         ENDIF

      ENDIF

   ELSE

      MsgStop( 'Insira o PenDrive na entrada USB e tente novamente' )

   ENDIF

RETURN( Pendrive )

// fin / end
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 75 guests