Quantcast
Channel: LabWindows/CVI topics
Viewing all 5339 articles
Browse latest View live

ARDUINO/LABWINDOWS CVI 2017

$
0
0

Heloo!  I want to talk to a microcontroller to tell him when to control an engine (support that carries a camera) using the ARDUINO card under LABWINDOWS; However, I have never done this task and I am new in using this software. I am curious to know if there are some precautions to take into account to choose features that are advantageous for LabWindows as interface / function , manipulation ..,. Are there any developers with this type of experience who could have ideas and who could help me ??? thks


XOR encryption and string conversion

$
0
0

I implemented the simplest form of XOR encryption. The XOR operation with the clrea text and the key resulst in non-ascii characters, that is an issue when sending the encrypted text. I chose to convert the unsigned char string into a HEXADECIMAL character string, only 0-9 A-F characters there and they play nice. For concersion I used the sprinf function, and the output seems to be correct.

However when decrypt the HEXADECIMAL string, I need to convert the two byte Hexadecimal "characters back into unsigned char values, and that is when I fail to find a solution, the sscanf function keep generating General protection failure at the very first instance of the conversion (I, j=0).  I tried various formatting parameters "0x", "02X", "02hhx", all fail. I am out of ideas.

I looked up the formatting string and either I miss something or the datatype are wrong but it compiles with no error.

 

/*XOR encrypts message with the key (an MD5 hash) and returns the pointer to the allocated encrypted hexadecimal string*/
unsigned char *  XorEncode (const  char * message, char * key) {
int i=0,j=0;  
size_t messagelen=0;
unsigned char *hexstringbuffer;
messagelen = strlen(message);
 

if(messagelen<=1|| strlen(key)<1) return NULL;//Error in parameters
hexstringbuffer=malloc(((messagelen*2)+1));
 memset(hexstringbuffer,'\0',2*messagelen+2);

 

 //convert the encrypted buffer to hexadecimal string
 for(i = 0,j=0; i < messagelen; i++,j+=2) {
      sprintf(&hexstringbuffer[j],"%02x", message[i] ^ key[i % (sizeof(key)/sizeof(char))]);// works well with or without sprinf conversion 
 }
 hexstringbuffer[j-2]='\0';  //for j incremented before exiing the loop
 return hexstringbuffer; //user must free the encrypted buffer, do not want to store it when out of scope
}
//decryptes the message of a hex stringn eeds the same key as the excription

//need to convert back the hexadecimal (ascii) array to unsigned char array

// fgor this reason I need separate decode function;

//all works if the hexadecimal conversion is omitted

 

unsigned char * XorDecode(const  char * encryptedmessage, char * key) {
int i,j;
 size_t messagelen=0;
 unsigned int bytebuffer='0';
 messagelen=strlen(encryptedmessage);
 char *decrypted=malloc (sizeof(char)*(messagelen/2)+1); 
 
  for(i=0,j=0; i < messagelen; i++,j+=2) {
         sscanf(encryptedmessage[j],"%02x",&bytebuffer);    // I GET A GENERAL PROTECTION FAULT HERE
         decrypted[i]=bytebuffer ^ key[i % (sizeof(key) / sizeof(char))];
  }
 decrypted[i]='\0';
 return decrypted; //the user must free the decrypted buffer
}

Using IVI with CVI

$
0
0

Hello all,

I'm trying to use an IVI device with CVI for the 1st time but some things don't add up.

I have an Agilent 34410A, which is very similar to what is used in the tutorial here: http://www.ni.com/tutorial/3377/en/

 

I downloaded the driver from here: http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=014E7F05D12C6F8BE0440003BA7CCD71 but inside there's mostly .vi files. There's nothing to 'install' that I know of (no .exe or .msi or .inf). Note: I do note have LV installed, only CVI, but I do have the LV runtime.

 

When I connect the device, I see it show up properly in the device manager. But when I go in MAX according to the above tutorial, the [Goto] button stays greyed out.

 

What am I missing ? Thanks.

Controls that handle multitouch events

$
0
0

Does CVI offer some controls that handle multitouch actions and events?

 

Multitouch is an input method using two or more fingers on a touchscreen at the same time.

Windows Taskbar Stealing Focus from Panel?

$
0
0

I have a situation where we run through several startup applications on our system and then eventually one of our applications calls system(main_gui.exe) to load a panel that is full screen. The taskbar is set to hidden on Windows 10.  Once the main GUI is loaded, I would expect that a keyboard press would operate a button on the panel, but it does not do that until the panel is clicked (anywhere on the panel, does not have to be a button).  It seems as if the panel is not in focus.

 

I've tried adding MakeApplicationActive(), ProcessSystemEvents(), and SetActivePanel() in various combinations and orders after the DisplayPanel() call.  Nothing works. 

 

We originally wrote the program for NT/XP on an embedded system many many years ago using CVI 5.0.  We finally have upgraded to CVI 2015 SP1 and Windows 10 and I'm now experiencing this issue.

 

I believe the way Windows 10 tries to notify the user that the application launched (pops up the taskbar and blinks the icon) steals focus from CVI's panel until you either click on the panel or the taskbar icon. 

 

I'm getting ready to try modifying ForegroundFlashCount to see if this might help the issue.  I'm hoping that I don't have to modify ForegroundLockTimeout as I have no idea how this may impact applications written by other companies that run on our system.

 

Additional Info:

  • Windows 10 with CVI 2015 SP1
  • Panel size is set to screen resolution.
  • Panel has no menu bar, no scroll bar, close control is None, set to Auto center on load.
  • Everything is left unchecked in "Other Attributes" (Sizable, movable, can maximize, can minimize, title bar visible, has taskbar button, conform to system colors, use windows visual styles for controls, scale contents on resize)
  • Panel is set to float always.
  • Switching to a visible taskbar or making the panel float to never does not help.
  • The buttons do not use callback functions, after the DisplayPanel() is called the app a while loop runs with GetUserEvent() to determine what key has been pressed.

 

how to change text of button during execution?

$
0
0

hello everyone, i am new in labwindows... i will change the button background color, but it doesn't support, therefore i will change the text of the button during running the program. i have made a ring to choose which color, but it doesn't happen any change???!!! i have used:

GetCtrlVal (panelHandle, PANEL_RING, &color);
SetCtrlAttribute (panelHandle, PANEL_COMMANDBUTTON, ATTR_LABEL_COLOR, color);

the color has integer values from 0-18 for VAL_RED until VAL_LT_GRAY. when i choose a color and press the button, nothing is changed???!!! can anyone help me out? thanks

 

file operation

$
0
0

i need a program for accepting file through fileselectpopup and converting the file data(.txt) into .bin format and storing it into new file in same location. anyone please help out.

File operation using file select popup and creating output file.

$
0
0

Please help for File operation, I've to select a text file through file select popup and convert it into binary file and store it in new file in same location please help me to write a program for it. Please anyone help me.


VISION ASSISTANT PROCESSING IMAGE

$
0
0

Hello friends
here I am trying to calibrate an image and read the code QR code underneath it and as I am new in this software I am looking for examples or exercises in the support but I can not find if you could help thank you to you


have a good day

Do I need to call DeAllocateLStrHandleArray?

$
0
0

Posted this in the LabVIEW forum and was told this forum could be a better place, so copying pasting here.

 

Compiled a VI as a DLL. One of the outputs is an array of LabVIEW strings. Interface defines the call as:

int32_t __cdecl function(..., LStrHandleArray *X, ...);

and gives me three managing functions

LStrHandleArray __cdecl AllocateLStrHandleArray (int32 elmtCount);
MgErr __cdecl ResizeLStrHandleArray (LStrHandleArray *hdlPtr, int32 elmtCount);
MgErr __cdecl DeAllocateLStrHandleArray (LStrHandleArray *hdlPtr);

 I allocate a LStrHandArray to pass to my function and call the function as

  LStrHandleArray X = AllocateLStrHandleArray(0);
  MgErr error = function(..., &X, ...);

Everything works fine.  Do I need to call?

MgErr error DeAllocateLStrHandleArray (&X);

If I do it returns an error (18438).  Not too worried about not calling it, as the code exits a couple of lines below, but just wondering what it is and how to convert that to an error message.

Connecting to a database

$
0
0

I want to connect to a data base that i ve created using mysql but the examples provided in sql toolkit in CVI uses DBConnect("DSN=CVI Samples"). I understood the what the DBConnect and DSN does but not "CVI samples". What should i do to connect to a separate database other than the example databases in CVI. In my case the database name is db1.

Acquisition and image processing on reel time

$
0
0

Hello

I am on a project acquisition and image processing using labwindowsCVI and VISION ASSISTANT, I manage to make the acquisition of one  image using vision assistant and then generate the code under labwindows but after for the use in real time mean  with the camera that is moving and aqcuisition images I do not know how it proceeded thanks for your help
ps : I am new to this software

have nice day Smiley Happy

problem debug

$
0
0

Hello

im new on labwindows traying to excute this code but i have problem debuging i dont now why , help pleas thks

code :

#include "niimaq.h"
#include "nivision.h"
main ()
 {
 //declare variables
 INTERFACE_ID iid;
 SESSION_ID sid;
 Int8* ImaqBuffer=NULL; //NI-IMAQ image
 Image* myImage = NULL; //IMAQ Vision image
 //Initialize interface and session
 imgInterfaceOpen ("img0", &iid);
 imgSessionOpen (iid, &sid);
imgSnap (sid, (void **)&ImaqBuffer); //NI-IMAQ function
myImage = imaqSnap (sid, myImage, IMAQ_NO_RECT); //IMAQ Vision function
 }

 

 

Reserva dinamica de memoria en una estructura

$
0
0

Buenas tardes,

 

Estoy programando una aplicación en Labwindows/CVI y tengo el siguiente problema. Necesitaría guardar una serie de números en variables, ahora mismo mi aplicación solo me deja guardar 4 números pero en un futuro esos "4" números serán variables (a veces 1, 3 o 10). Para ello he pensado en hacer una reserva dinámica de memoria pero no se como programarlo. Ahora mismo mi código es así.

 

/* Tengo una estructura de la siguiente forma */

typedef struct{
        char numero_1[20]; 
        char numero_2[20]; 
        char numero_3[20];  
        char numero_4[20];  
} Valores;

 

/*En el main.c tengo lo siguiente*/

        strcpy (Valores.numero_1, aux[0]);
        strcpy (Valores.numero_2, aux[1]);
        strcpy (Valores.numero_3, aux[2]);
        strcpy (Valores.numero_4, aux[3]);

 

Muchas gracias.

Un saludo.

SQLDriverConnect para OpenOffice

$
0
0

Buenas tardes,

 

Estoy programando una aplicación en Labwindows y me gustaría saber como programar la función SQLDriverConnect para abrir una base de datos .mdb con OpenOffice.

 

 

Muchas gracias.

 


bar graph first data point problem

$
0
0

I've got a problem with a graph control and plotting with vertical bar style for displaying data histograms.

 

My big goal here is to plot the data points successively as they arrive via the serial port.  These points take a while, a little over a second each.

 

I didn't find a better way of doing this with the limitations of a graph control, so here's how I did it:

1) have a timer collect the data (up to you to use asynch, multi-thread, etc)

2) when we get a new data point, pack into a local array (x and y values)

3) delete previous plots and display all data points up to this index as a new plot

 

So this works well enough, except on the very first data point.  My x values happen to be integers (but they may not be), and my first point should be 1, but the graph shows 20 something. 

 

bad first pointbad first pointall points after first are goodall points after first are good

I've attached the project if you want to observe...

 

malloc/free, DLL, memory leaks

$
0
0

Hello,

 

I'm investigating memory leaks in my program. And I'd like to investigate one thing.

 

I have already read on this forum that CVI has its own free() and malloc() functions, and that free() calls don't really free the memory.

So, if I use a DLL built using CodeBlocks (which uses mingw compiler) will CVI "substitute" the free() and malloc() functions with its own function at link time ?

 

For your information, I link against this DLL using an import library. My CVI version is 2017.

 

Moreover, if CVI can substitute the functions, would it be different if I don't link using an import library but use LoadLibrary() instead ?

 

 

If I ask those questions, this is because I don't have memory leaks if I don't use the DLL.

So, either the problem is in the DLL (or in the way I use the DLL) or the problem is related to CVI through my suggested mechanism.

 

Thanks in advance.

 

Numerous Instruments On Single Function Panel

$
0
0

Looking for some direction and hopefully an example or two. I want to create a .dll in CVI which I can execute to manually open/close relays, change levels for power supplies, and measure voltages/resistances on the DMM. I want to do this as a manual way of troubleshooting and for development prior to integrating TestStand sequences. Is it possible to put all this on a single function panel? My level at CVI development is at the novice level.  Your collective thoughts?

 

Tony

GetUserEvents

$
0
0

Hello,

 

I am running Lab Windows CVI getting 10 channel data and displaying it on the screen.

I have a few buttons on the same screen and am using the GetUserEvents to see which button is pushed. If I stop reading and displaying data then everything is ok. But when the data is read and displayed then GetUserEvents does not see the button pushed all the time. It works most of the time but 30% of the time it does not see the button pushed.

I have to keep pushing any of the buttons for a response. I am using the "ProcessSystemEvents". But it did not make any difference.

Any ideas?

 

Thansk

SQL varbinary to bmp

$
0
0

Hi!!

I want to read image from SQL Server

I used these functions,but the picture is not displayed.

 

hstmt= DBActivateSQL (hdbc,"SELECT * FROM TABLE WHERE IMAGE_ID=30");
fromDBBits = malloc (BitsSize);

DBBindColBinary (hstmt, 4, BitsSize, fromDBBits,&bitsStatus); 

   

DBFetchNext(hstmt);     

NewBitmapEx (7776, 24,2592 ,1944, 0,fromDBBits,NULL,NULL,&bm );
SetCtrlBitmap (panelHandle,PANEL_PICTURE,0,bm);

 

please help me, thank you.

 


          

Viewing all 5339 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>