Newsgroup: it.comp.lang.visual-basic
Titolo: Acquisizione dati da porta seriale

Ciao a tutti,
ho un piccolo problemino. Devo acquisire dati da una porta seriale
sincrona (quatech MPAP100) usando VB6. 
Per fare ciņ la societą poduttrice ha fornito tutti i comandi e le
strutture in C.
Non conoscendo il C, mi risulta complesso tradurre in VB6 tutti questi
comandi.
Qualcuno puņ darmi qualche dritta per riuscire ad utilizzare in VB6,
semplicemente, questa schedina seriale? 
Ciao e grazie a tutti
Peter
-- 
questo articolo e` stato inviato via web dal servizio gratuito 
http://www.newsland.it/news
 segnala gli abusi ad 
ab...@newsland.it

 ha scritto nel messaggio 
news:e3eu28$m33$1...@news.newsland.it...


 leggi la guida.
Ho provato a cercare sulla guida ma non ho trovato nulla ....
Mi potresti dare una indicazione più precisa?
Ciao e grazie
--  
Postato da Virgilio Newsgroup: scopri i nuovi gruppi 
Eros, foto e video a 
http://newsgroup.eros.virgilio.it

semplicemente, questa schedina seriale? 
In VB6 puoi utilizzare MsComm per comunicare attraverso la seriale.
Però se gli algoritmi sono scritti in C potresti crearti un DLL e interfacciarla
con il VB, ma non è una cosa semplicissima se non hai dimestichezza con il C e
le DLL.
Se non conosci il C invece di convertire da C a VB gli algoritmi potresti
semplicemente riscriverli daccapo usando il manuale di istruzioni, alla fine ci
metti meno tempo e lavori con uno strumento che conosci.
--
ciao
  Stefano

 ha scritto nel messaggio 
news:e3eu28$m33$1...@news.newsland.it...


Enzo (scusa se ti do del tu) io dovrei comunicare con una porta seriale
rs232, ma da un palmare con Windows CE e con .NET 2005
se ti va di contattarmi via mail puoi darmi qualche dritta?
grazie

 ha scritto nel messaggio 
news:1146824709.8...@e56g2000cwe.googlegroups.com...


Considera che la porta seriale con cui ho a che fare è una 
scheda sincrona PCMCI, quindi non è la RS232 classica del PC.
Sono da impostare tutta una serie di strutture e di comandi 
presenti all'inderno di una dll; come ad esempio:
"Esempio di struttura"
typedef struct tagMPA_CONFIG
{
ULONG structLen;
union
{
struct
{
// Set the following bits to indicate which parameter(s) are to 
be set.
// Parameter value(s) with corresponding bits set to zero are not
// changed.
// Tx does not require buffers since pending I/O requests 
provide buffers.
UCHAR FrameBufferSizeRx : 1;
UCHAR NumFrameBuffersRx : 1;
UCHAR BaudRate : 1;
UCHAR ClockRate : 1;
UCHAR ClockMode : 1;
UCHAR InternalLoopback : 1;
UCHAR RxClockSource : 1;
UCHAR TxClockSource : 1;
UCHAR TRXCOutput : 1;
UCHAR Encoding : 1;
UCHAR DPLLClockSource : 1;
UCHAR DPLLMode : 1;
UCHAR AutoRTSDeact : 1;
UCHAR CRCPreset : 1;
UCHAR IdleLineControl : 1;
ULONG pad : (8*sizeof(ULONG) - 13);
} bits;
ULONG all; // Used to clear/set all bits at once.
} set;
ULONG FrameBufferSizeRx; // In bytes.
ULONG NumFrameBuffersRx;
ULONG BaudRate;
ULONG ClockRate;
ULONG ClockMode;
BOOLEAN InternalLoopback;
CLOCK_SOURCE RxClockSource;
CLOCK_SOURCE TxClockSource;
TRXC_OUTPUT TRXCOutput;
ENCODING Encoding;
DPLL_CLOCK_SOURCE DPLL ClockSource;
DPLL_MODE DPLLMode;
BOOLEAN AutoRTSDeact;
BOOLEAN CRCPreset;
IDLE_LINE_CONTROL IdleLineControl;
} MPA_CONFIG, *PMPA_CONFIG;
"Fine esempio di struttura"
"Esempio comandi"
MPA_GetConfig ()  Gets configuration
Syntax:
MPADLL_API MPA_ERROR_CODE MPA_GetConfig
(
IN const PMPA_HANDLE pHandle,
OUT PMPA_CONFIG pConfigOut
);
Description: Gets the current configuration in a MPA_CONFIG 
structure. The bits in
the set union are undefined (used for setting configuration 
only).
Return:
ERR_NO_ERROR Configuration retrieved successfully.
ERR_BAD_
RETURN_SIZE
The configuration length returned did not match expected value.
Quatech Syncdrive Plus User s Manual Syncdrive Plus application 
programming interface
Rev 01 (2/6/2003) Page 18
MPA_GetConfig () Continued
Return, cont.:
ERR_DEVICE_
NOT_OPENED
Device was not opened with MPA_Open().
ERR_INVALID_
STRUCT_SIZE
The structure size in structLen did not match size in driver.
ERR_IOCTL_
ERROR
Communication error occurred between DLL and SYS.
Parameters:
pHandle Handle to the open device obtained from MPA_Open().
pConfigOut The current configuration in a caller-supplied 
MPA_CONFIG structure.
StructLen should be filled out before calling MPA_GetConfig().
Example:
MPA_CONFIG config;
config.structLen = sizeof(MPA_CONFIG);
MPA_GetConfig(&handle, &config);
MPA_GetData() Receive a frame of data
Syntax:
MPADLL_API MPA_ERROR_CODE MPA_GetData
(
IN const PMPA_HANDLE pHandle,
OUT UCHAR *pBuffer,
IN ULONG bufferLen,
OUT ULONG *pBytesRead,
IN LPOVERLAPPED lpOverlapped
);
Description: Used to receive a frame of data. Read requests can 
be queued up in
anticipation of received frames. For non-overlapped I/O, a 
single request
can be sent and it will return when a frame is received. For 
overlapped
I/O, only system resources limit the number of requests that can 
be
queued.
Return:
ERR_NO_ERROR Frame received completely and successfully.
ERR_DATA_CRC A CRC error occurred during transfer. In overlapped 
mode, you would
typically call MPA_GetTransferStatus to determine availability 
of the
frame before making this call. If MPA_GetData returns a bad 
frame, no
part of the frame is returned.
ERR_DATA_
OVERRUN
A data overrun occurred. This happens when the caller buffer is 
too small
for the frame received. In overlapped mode, you would typically 
call
MPA_GetTransferStatus to determine availability of the frame 
before
making this call. If MPA_GetData returns a bad frame, no part of 
the
frame is returned.
ERR_DEVICE_NOT_
OPENED
Device was not opened with MPA_Open().
ERR_ERROR_
READING_DATA
Error receiving frame occurred. In overlapped mode, you would 
typically
call MPA_GetTransferStatus to determine availability of the 
frame before
making this call. If MPA_GetData returns a bad frame, no part of 
the
frame is returned.
Quatech Syncdrive Plus User s Manual Syncdrive Plus application 
programming interface
MPA_GetData() Continued
Return, cont.:
ERR_INCORRECT_
NUM_BYTES_READ
For non-overlapped I/O only. Bytes received differ from 
requested. Not
necessarily an error if a larger buffer was allocated than 
required.
ERR_INVALID_
PARAMETERS_
PASSED
Device opened as overlapped but storage for an overlapped 
structure not
passed in lpOverlapped.
ERR_INVALID_
STRUCT_SIZE
The structure size in structLen did not match size in driver.
ERR_READ_
PENDING
Receiving frame in the background since device opened as 
overlapped.
Parameters:
pHandle Handle to the open device obtained from MPA_Open().
pBuffer Pointer to a caller-supplied buffer to receive data. 
Each call to
MPA_GetData() provides a buffer to receive a complete frame of 
data.
bufferLen The length of the buffer in bytes.
pBytesWritten The number of bytes received. For overlapped I/O, 
this can be less than
bufferLen since the transfer is occurring in the background.
lpOverlapped Caller-supplied storage for an overlapped structure 
if device was opened
for overlapped I/O. Should be NULL if device was opened for 
nonoverlapped
I/O.
"Fine esempio comando"
Grazie dell'aiuto
Alba71


 guarda che vb puo' implementare codice in c senza problemi....
Eh ? =8-O
Bye, G. 

dove posso trovare tool/informazioni? hai qualche link specifico?

 ha scritto nel messaggio 
news:1147676799....@j73g2000cwa.googlegroups.com...
