LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

COMUNICACION ARDUINO Y LABWINDOW/CVI10

Hi everyone,
I am trying to communicate with Arduino and LabWindowCVI10. Just want to send integers for my Arduino to read. It is not clear how it works the ComWrt function.
You can give me a hand?

 

This is my code LabWindow

 

int CVICALLBACK Frecuencia (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
double x;
GetCtrlVal(panelHandle, PANEL_FRECUENCIA, &x);
char info[10];
Fmt(info, "%s<%f[p0]", x);
/*for(int i=0; i<strlen(info); i++){
int c = info[i];
ComWrtByte(COM, c);
Delay(0.1);

}*/

ComWrt(COM,info, strlen(info));
break;
}
return 0;
}

 

And this on my Arduino

 

char cadena[8];
byte posicion;
unsigned long valor;

void loop() {
if (Serial.available())
{
memset(cadena, 0, sizeof(cadena));

while (Serial.available() > 0)
{
delay(5);
cadena[posicion] = Serial.read();
posicion++;
}
valor = atol(cadena);
AsignarFrecuencia(valor);
posicion = 0;
}
}

 

Not if I'm working properly with LabWindow. I would appreciate any help.

Regards from Spain ¡¡¡

 

0 Kudos
Message 1 of 2
(4,694 Views)

A few thoughts about your question...

 

1) Please, please, please, format your code with the Insert Code button on the visual toolbar.  It improves your chances for answered questions.

2015-02-24 13_35_23-Reply to Message - Discussion Forums.png

 

2) Be more specifc!  What kind of errors are you getting?  

 

3) Do your troubleshooting one piece at a time:

  • Set up a self-contained test on the LabWinodows end of the software.  
  • Use DebugPrintf commands to be sure you're getting the results you want.
  • Use the debugger in LabWindows to verify control loops, structure, etc.
  • Use a loopback on your serial port to verify the LabWindows - to - Windows driver interface is good.
  • Do a test on the target end of the interface.  Send commands with a serial port emulator directly to your Arduino.  I use RealTerm almost every day.  It can do binary, ASCII, and host of other modes.

 

4) Once all these separate tests are done, then you can try to hook it all up together.

0 Kudos
Message 2 of 2
(4,691 Views)