From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW arduino communication using VISA

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

and print screens of block dia of labview 

 

regards 

vanashree

Download All
0 Kudos
Message 1 of 6
(2,645 Views)

duplicate post   http://forums.ni.com/t5/LabVIEW/labview-arduino-communication/m-p/2973749

 

stay on topic at the original

0 Kudos
Message 2 of 6
(2,641 Views)

no that was adifferent prog.n now m trying something different.this is just a simple comm between labview and arduino for DAC08 only. kindly help me to rectify my prog and donot say to follow the earlier comm in which i was askiing about some OK button and not comm problem

0 Kudos
Message 3 of 6
(2,612 Views)

still if u feel i shud post on it i will.but i want answer

0 Kudos
Message 4 of 6
(2,611 Views)

what is the problem?is it in my arduino code or in my ivsa code?

my arduino code is here:

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

void loop()
{
char a = Serial.read();
switch(a)
{
case '1':
PORTC = 0xFF; //THESE VALUES CAN BE VARIED AS YOU WANT
break;
case '2':
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 in htoi file where hex code once recvd from visa and the according case in the arduino is here:

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;
}

 

WHAT IS WRONG IN LABVIEW OR IN ARDUINO? 

I NEED HELP URGETLY

0 Kudos
Message 5 of 6
(2,591 Views)
0 Kudos
Message 6 of 6
(2,562 Views)