LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1097 error with OpenComConfig !

Solved!
Go to solution

Hello all,

 

I know that the 1097 error is a very common one, and it has been reviewed in this forum many times, but i couldn't find the solution to my problem .. Even KnowledgeBase didn't help.

 

I've written a simple code just to open a session with the serial port :

 

receive.c :

-----------

 

#include <ansi_c.h>
#include <cvirte.h>
#include <userint.h>
#include <rs232.h>
#include <utility.h>
#include <formatio.h>
#include <string.h>
#include "stdio.h" 
#include "stdlib.h"
#include "receive.h"

int RS232Error;

int receive()
{
        RS232Error = OpenComConfig (1, "COM1", 9600, 0,
                                        8, 1, 4500, 4500);
       
        if (RS232Error == 0)
        {
            SetXMode(1, 0);
            SetCTSMode(1, 0);
            SetComTime(1, 5);
        }
       
        return RS232Error;
}
 

receive.h :

-----------

int receive();    

 

 

 

 

I created the dll for that function, and the 1st time I run it , i get a 1097 error .. The 2nd time and on, i get a return of -7 (Cannot Open Port).

And if you're wondering why my portnumber is 1 and the device name is "COM1" although I'm using a PC, it's because when I use 0 as port number I get a return of -2 (Invalid Port Number).

 

Would anyone, Puh-leaaase, help ?

 

Thanks

 

 

0 Kudos
Message 1 of 10
(3,460 Views)
Did you try operating via hyper terminal?
0 Kudos
Message 2 of 10
(3,458 Views)

No i haven't, coz it wouldn't be much of a help in my case.

0 Kudos
Message 3 of 10
(3,452 Views)

More tests were done, and the thing is that everything is perfect when i generate a "Full Run-Time Engine" DLL and test it.

But when the DLL's Run-Time support is "Real-Time Only" , I'm getting these errors !

 

Medic !!! Please !!

0 Kudos
Message 4 of 10
(3,441 Views)

Hi 0033.

 

Have you find any solution? Did you do more tests?

Regards.

0 Kudos
Message 5 of 10
(3,408 Views)

Hey R_Duval,

 

I'm out of tests .. Since that little code functions well on the PC, but doesn't function at all on a real-time machine !

I contacted National Instruments for that, and still no answer from their side !

0 Kudos
Message 6 of 10
(3,399 Views)

HI

 

Do you have any feedback from NI?

Could you share the information?

 

Thanks.

0 Kudos
Message 7 of 10
(3,380 Views)

I just got a call from National Instrument's costumer serivce, and they told me that the library "RS232.h" isn't supported in Real Time mode !

Such an inconvenient !

Honestly, I'm not very convince, but they said they'll get back to me with a solution ..

 

I'll keep u guys updated

0 Kudos
Message 8 of 10
(3,372 Views)
Solution
Accepted by topic author 0033

Problem Resolved !

I had to install the RT Serial Module !

 

Cheers

Message Edited by 0033 on 06-26-2009 04:34 AM
0 Kudos
Message 9 of 10
(3,358 Views)

Hi.

 

Very thanks for your feedback here. It should be helpfull for others.

Have a nice day and a great weekend.

Regards.

 

0 Kudos
Message 10 of 10
(3,349 Views)