LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview arduino communication

Solved!
Go to solution

hey

Download All
0 Kudos
Message 1 of 8
(3,278 Views)

you donot attach the snap shot of your block diag and your vi is not opening in my LV 8.5

 

however i am attaching a vi and its snapshots. basically you need a case structure controlled by OK button inside which you send your data via serial port. you need to convert your numerical data to string before sending on serail port. i hope it will help you. i left the visa serial port config (baud rate etc) on you.

 

0 Kudos
Message 2 of 8
(3,258 Views)
Solution
Accepted by vanashree
vanashree,

Please don't use that poorly written example. It has what is called a greedy loop. It spins at a high rate and starves the cpu. It also initializes and closes the serial port each time the case is true. Initialize the port once and close when the VI finishes. You should be using the event structure and a value change of the Boolean.
Message 3 of 8
(3,226 Views)

THANKS

0 Kudos
Message 4 of 8
(3,089 Views)

WASMREALLY ILL FOR LAS FEW MONTHS COULDNT WORK..BUT NOW FOUND THE SOLUTION THANKS

0 Kudos
Message 5 of 8
(3,084 Views)

i have attached my DAC08 program interfaced using arduino.when i command from serial monitor from arduino DAC responds means arduino prog is ok. but when  i command from LabVIEW it doesnt. i dont want to use LIFA. i just wnt to use VISA to pass stuffs to my arduino upon selection and my arduino to be programmed as to when ever a particular hex string is recieved from visa which corresponding hex code should be routed to the device.labview interfacing is not achieved.

i couldnt attach the .ino file of arduino prog. so i am copy pastin the same here

#include <SPI.h>
#include "htoi.h"
void setup()
{
Serial.begin(9600);
DDRC = 0xff;
}

void loop()
{
char a = Serial.read();
switch(a)
{
case '164':
PORTC = 0xFF; //THESE VALUES CAN BE VARIED AS YOU WANT
break;
case 'B':
PORTC = 0x00;
break;
case 'C':
PORTC = 0xC0;
break;
case 'D': //MORE CASES CAN BE ADDED FOR TESTING IF REQUIRED
PORTC = 0xD0;
break;
//default:
//PORTC = 0x00;
}
}

and print screens of block dia of labview 

 

kindly reply quickly m really in need

regards 

vanashree

Download All
0 Kudos
Message 6 of 8
(3,045 Views)

i had added htoi file in order to generate a table as when a hex string is available from visa arduino will be ready as to what shud be done..i think there is some error either in my htoi r in labview

the htoi file is:

int ten(char tens)
{
switch(tens)
{
case '0':
return 0;
case '1':
return 16;
case '2':
return 32;
case '3':
return 48;
case '4':
return 64;
case '5':
return 80;
case '6':
return 96;
case '7':
return 112;
case '8':
return 128;
case '9':
return 134;
case 'A':
return 160;
case 'B':
return 176;
case 'C':
return 192;
case 'D':
return 208;
case 'E':
return 224;
case 'F':
return 240;

}
}

int unit(char units)
{
switch(units)
{
case '0':
return 0;
case '1':
return 1;
case '2':
return 2;
case '3':
return 3;
case '4':
return 4;
case '5':
return 5;
case '6':
return 6;
case '7':
return 7;
case '8':
return 8;
case '9':
return 9;
case 'A':
return 10;
case 'B':
return 11;
case 'C':
return 12;
case 'D':
return 13;
case 'E':
return 14;
case 'F':
return 15;
}
}

int htoi(char tens, char units)
{
int a = ten(tens);
int b = unit(units);
int sum = a + b;
return sum;
}

0 Kudos
Message 7 of 8
(3,040 Views)

HexStringToValue.png

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 8
(2,983 Views)