11-28-2025 07:29 AM
Bonjour,
J’utilise un code en C qui scanne les ressources VISA de type "ASRL[0-9]*::?*INSTR". Ce code fonctionne correctement sur plusieurs ordinateurs, mais sur certains, une erreur survient :
Erreur VISA dans viFindRsrc : VI_ERROR_RSRC_NFOUND (Ressource non trouvée, vérifiez la chaîne de recherche).
Pourtant, dans NI MAX, la ressource est bien détectée et fonctionne normalement.
Un comportement étrange se produit : si j’ajoute une nouvelle ressource VISA (par exemple, un autre port série), la première ressource commence à être détectée par mon code, mais pas la seconde.
En mode debug, la fonction viFindRsrc(hRM, "ASRL[0-9]*::?*INSTR", &findList, &numInstruments, desc); trouve bien la ressource. Cependant, lors de l’appel à viFindNext(findList, desc);, une erreur se produit avec le code -1073807343
cordialement
Frédéric BLANC LAAS-CNRS
Hello,
I am using a C code that scans VISA resources of type "ASRL[0-9]*::?*INSTR". This code works correctly on several computers, but on some, an error occurs:
VISA error in viFindRsrc: VI_ERROR_RSRC_NFOUND (Resource not found, check the search string).
However, in NI MAX, the resource is properly detected and works normally.
A strange behavior occurs: if I add a new VISA resource (for example, another serial port), the first resource starts being detected by my code, but not the second one.
In debug mode, the function viFindRsrc(hRM, "ASRL[0-9]*::?*INSTR", &findList, &numInstruments, desc); correctly finds the resource. However, when calling viFindNext(findList, desc);, an error occurs with the code -1073807343.
Best regards,
Frédéric BLANC LAAS-CNRS
int scan_port_VISA(void)
{
ViStatus status;
ViSession hRM, vi;
ViFindList findList;
ViUInt32 numInstruments;
ViChar desc[VI_FIND_BUFLEN];
char message_LOG[SERIAL_BUFFER];
char TXbuffer[SERIAL_BUFFER] = {0};
char RXbuffer[SERIAL_BUFFER] = {0};
status = viOpenDefaultRM(&hRM);
if (status != VI_SUCCESS)
{
save_LOG("Error opening default session");
return 1;
}
status = viFindRsrc (hRM, "ASRL[0-9]*::?*INSTR", &findList, &numInstruments, desc);
if (status != VI_SUCCESS)
{
save_LOG("Error creating search list");
viClose(hRM);
return 1;
}
Ctrl.com_count=0;
int exit=0;
while (!exit)
{
status = viFindNext(findList, desc);
switch (status)
....
12-02-2025 11:43 PM
Good morning
I am not using visa to detect which coms (ASRL) are available.
instead i am using more simple fast & direct method that till this day always work
#include <windows.h>
int com_no ;
char str[128] ;
HANDLE hcom ;
12-03-2025 02:16 AM
bonjour
j'ai résolut mon problème, cela venais d'un problème électrique.
Avec un hub USB alimenté cela marche.
cordialement
Frédéric BLANC
Hello
I solved my problem, it came from an electrical problem.
With a powered USB hub it works.