LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

USING INTERRRUPTS

Hi,
    I m currently working on a code to acquire data from a head tracking system(ascension technologies) connected via the serial port using labwindows. I have used functions provided by ascension technologies in source code file in C to do the same. The source file has functions like serial isr,read data from headtracker to retrieve data from the serial port. this code runs on borland c. i have modified parts of the code to run it on labwindows.
My questions are
- Can we use interrupts (IRQ4,IRQ3) in labwindows the same way we use in C programming?
If not how should they be used.
- I understand that win 2k machines do not recognise dos.h so how should i call interrupts.
- On compiling i have errors in statements like
1)void interrupt far (*oldserialintvect)(void); /* old serial interrupt vector */ 
2)void interrupt far serialisr(void);
3)setvect(COM1INTERRUPT-comport,serialisr);
 
 the error reads missing prototype.
 
how do i go ahead with this. would u advice me to use the polled mode instead of the interrupt mode.  i have attached a copy of my project. pls do have a look at the same.
 
also can i simply use the serial.prj provided as a sample project to retrieve data from the headtracker.
 
pls do help me with this one,
thanking you
Kunal Chaniary
 
 
0 Kudos
Message 1 of 3
(3,377 Views)

I'm not familiar with interrupt programming on x86 machines, but I looked at the code you attached and I seemed to catch a sort of polling mechanism between the tracker and the computer: the computer sends a command to the tracker ('Y' ??) and waits for the instrument to respond. This mechanism is then encapsulate in a interrupt-driven method.

If this is true, you surely can initially use serial.prj to test if the communication can be established and flows regularly between the PC and the instrument. After this has been done, you could see if some of the native CVI instructions in RS232 library can help you to optimize the protocol. In case the answer from the instrument have some regular element (something like a message terminator or a fixed lenght) you could try exploring the possibility of integrating a ComCallback into your code.

Have you searched Ascension Technologies site for an example on integrating their instrumentation into Win32 environments?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,360 Views)

Roberto is correct, you might want to look for something a little more windows oriented.  The code you have is for DOS system which allows direct access to the low level hardware I/O.  On windows systems, a serial port driver already exists, you access the serail port through that driver.  You do not install interrupt handlers directly from the software.  That said, the CVI RS232 library and windows serial driver has already done all the ISR hooking for you so you dont need to deal with that from your program.

You could probably port this code into CVI without too much trouble.  You don't need any of the install/deinstall interrupt handler stuff.  You would simple open and close the serial port using the CVI OpenCom() and CloseCom() routines in the RS232 library.  Elsewhere in the code you would replace the read and write sections with the equivalent CVI routines.  The code to access the device will be significantly smaller under CVI than in the file you posted.

If mS timing is not an issue the port should be relatively trouble free, if you have any specific questions, post them here.

Good Luck! 

0 Kudos
Message 3 of 3
(3,337 Views)