LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming labwindows to connect to BK precision 8500

Has anyone had any success linking labwindows/cvi with the BK Precision 8500?

 

i have opened comms link but when i send the hex commands to turn on remote mode nothing happening and the not getting a response?

0 Kudos
Message 1 of 11
(6,779 Views)

Hi,

 

Is it possible for you to send that piece of your code?

 

I've checked the programming manual of the instrument and it seems a bit tricky.

If we have your source code, we may get to the problem faster.

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 11
(6,762 Views)

i have actually got it working with a bit of head scratching here is my code. the code is setting the 8500 unit into remote mode.

 

#include <utility.h>
#include <rs232.h>
#include "toolbox.h"
#include "E-L Comms.h"

static int panelHandle;
int CloseLink = 0;

/*data string to set 8500 to remote mode*/
char PCMode[26]={0xAA,0x00,0x20,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0xCB};


//***************************************************************
//**** MAIN FUNCTION Definitions *************
//***************************************************************
int main (int argc, char *argv[])
{
 if ((panelHandle = LoadPanel (0, "E-L Comms.uir", PANEL)) < 0)
  return -1;
 DisplayPanel (panelHandle);
 RunUserInterface();

return 0;
}

int ElecLoadComms()
{
 int a = 0;
 int strLen;
 
 unsigned char Recevied[27] = {0};
 
 OpenComConfig (1, "", 19200, 0, 8, 1, 512, 512);
 CloseLink = 0;
 
 do
 {   FlushInQ (1); /* Flushing input buffer */
  FlushOutQ (1); /* Flushing output buffer */
  a=0;
  do
  {
   Recevied[a]=0x00;
   a=a+1;
  }while (a<27);
  
  ComWrt (1,PCMode , 26); /* writing 26 bytes to comm port */
  Delay (0.5);

   
 strLen = GetInQLen(1); /* get the lenght of string from buffer */
 ComRd (1, Recevied, strLen); /*  Read the characters from the port */
 
 ProcessSystemEvents();
  
 }while (CloseLink == 0);
 
 return 0;
}

/* Opening comms link */
int CVICALLBACK COMMANDBUTTON (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
  {
  case EVENT_COMMIT:
     ElecLoadComms();
    
   break;
  }
 return 0;
}

/* Close Comms link */
int CVICALLBACK COMMANDBUTTON_2 (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
  {
  case EVENT_COMMIT:
     CloseLink = 1;
     CloseCom (1);
    
    
   break;
  }
 return 0;
}

 

hope this code helps anyone else using BK Precision 8500.

0 Kudos
Message 3 of 11
(6,749 Views)

MrDude,

 

Could you please include the "E-L Comms.h" code.  I would like to try to talk to the bk8500 with LabWindows. 

 

Thx,

 

acni 

CK301
0 Kudos
Message 4 of 11
(6,634 Views)

here is the file, its the file generated by labwindows for the UIR.

0 Kudos
Message 5 of 11
(6,601 Views)

Hi MrDude,

 

Thanks for the file! 

 

I tried running your code with CVI 8.5, but I couldn't get it to communicate correctly.  I was able to set the remote on (the LINK indicator lights up on the display) but it only stayed on for a few seconds ... I wasn't able to set the CC mode, nor setting the Current for the CC mode.  Do you know why the LINK indicator only lights up for a few seconds?  Could you please send me your working code or show me how I can set up the CC mode and Current (e.g. 1.1A) correctly. 

 

Thanks in advance,

 

-acni     

CK301
0 Kudos
Message 6 of 11
(6,580 Views)

acni,

 

I ran into this thread while searching for suggestions on another problem. By now you've probably found your answers, but I'll post anyway. I'm using a BK 8510.  My present version of CVI is 9.1.1, but I think I started using the BK load at 8.5 or 9.0.

 

For some reason I had a mind-block while trying to understand the BK protocol. Once I got it in my head that the 26 characters are 26 ascii codes in a 26 character string then I was ok. You'll need to change the format to be able to visually read the serial packet (such as convert to an integer array to display on a panel for viewing). Actually, I do it the other way around by building an array of integer values and then converting to an ascii string to send. Similarly, you'll want to convert the reply to be able to visually read it.

 

My experience is that when the LINK lights up it means that there is activity on the com line. If nothing else happens then the protocol is incorrect and the BK load cannot identify the packet and therefore ignores it.

 

Note that you should always get a reply string back from the BK load for every command you send. It will either be specific to the sent command with requested data or it will be the generic 0x12 Return Data reply stating success or failure. Also, some comands will only work with the BK load in remote mode - such as setting CC or CW modes or the CC setpoint or remote sensing or the ever popular etc.

 

I've attached a zip file with a standalone program to communicate with the BK 8510 for you entertainment.  I made this program as a precursor to imbeding the code in an automated application. It will unzip into a folder with all the files needed to run it. Maybe it will give you some ideas. I tried a new tactic (new for me) of throwing a bunch of controls on the panel and enabling them or making them invisible depending upon which serial command is being selected to send to the BK load. The bulk of the program deals with this stuff and not the serial communications. Also, you'll note that I am not an efficient programmer. I am also not very pleased with how the program has ended up with "stuff all over the place."  Oh, well, learn and live.

 

Cheers

0 Kudos
Message 7 of 11
(6,489 Views)

Hello for everyone!

 

I have the same problem, but in LabVIEW.

I am trying to communicate with BK Precision 8510 electrical load with my PC by using LabVIEW.

I have downloaded the actual  driver fro LabVIEW, and it offers a lot of kind of examples.

I have tried all of them, but non of them are communicating with LabVIEW.

I have checked the Baud Rate - 9600

There is no parity and 1 stop bit.

 

I don't know how to solve that, please help my!

 

Many thanks

 

István

0 Kudos
Message 8 of 11
(6,019 Views)

Hi Istvan,

 

There's a few things to try, first we need to make sure the computer is receiving serial communication, then we need to make sure LabVIEW is sending the commands correctly.

 

I've had a look at the manual (http://www.bkprecision.com/downloads/manuals/en/85xx_manual.pdf), it is a useful reference if you haven't looked at it.

 

Have you made sure the serial settings are correct on the instrument? These can be changed through the menus (manual page 11)

These will obviously have to match the settings you are trying to read.

Make sure you have NI-VISA installed. This is a requirement for the driver (download the latest version from ni.com/drivers)

 

You can do some further debugging in Measurement and Automation Explorer. If you expand the software tree, you can see if you have the VISA driver and what version it is (the BK driver was built when 4.0 was the current version, but it should still work with the latest version of NI-VISA)

 

Here you can also access and test the serial ports. Expand the Devices and Interfaces tree, and then Serial & Parallel. You should see you COM ports here, and you can click one and choose "Open VISA Test Panel." Here you can change settings and then go to "Input/Output" and send commands like *IDN?\n  which should return the serial number for the device. This will show that the device and PC are communicating correctly.

 

Let me know how all this goes, if you are successfully communicating with the test panel, but still not getting anything in LabVIEW, we can pursue that route.

 

If there is no communication even when the serial configuration in the test panel and on the instrument matches, it may be a hardware problem (could be cable, device, port)

 

After the problem is narrowed down I can continue to help from here.

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 9 of 11
(6,000 Views)

Hi Ian,

 

Thank you for your reply.

The communication is all right, thank you for your help.

My problem is that when I go to the Automation explorer and try to send the *IDN?\n command I am not given correct answer. 

I am usually given 6 either an instrument connected to the serial port or not. OR I am given an error message.

 

Maybe I am doing something completly wrong.

 

Many thanks for your help!

 

 

István

0 Kudos
Message 10 of 11
(5,976 Views)