Page 1 of 1
USB reading/writing as Com port
Posted: Wed Feb 07, 2024 10:23 pm
by Marc Venken
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 ?
Re: USB reading/writing as Com port
Posted: Thu Feb 08, 2024 12:41 am
by cmsoft
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.
Re: USB reading/writing as Com port
Posted: Thu Feb 08, 2024 8:39 am
by Marc Venken
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 )) !!
Re: USB reading/writing as Com port
Posted: Thu Feb 08, 2024 4:16 pm
by karinha
Look,
Code: Select all | Expand
#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.