LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LABVIEW VISA ERRORS WITH ARDUINO

Solved!
Go to solution

CAN ANY1 HELP ME???AND REPLY ME???

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 1 of 26
(3,026 Views)

I M REALLY TENSE REGARDING MY PROECT I MUST SUBMIT MY STUFF VERY SOON OR ELSE I WILL BE IN VERY BIG TROUBLE...KINDLY HELP FAST

0 Kudos
Message 2 of 26
(3,017 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 3 of 26
(3,016 Views)

You say that a serial monitor program can communicate with the Arduino but your VI cannot. That suggests that you are not sending the required termination characters. VISA does not send termination characters by default while many serial port monitor programs do. Try appending a line feed or carriage return to the string you send. Use the character the Arduino expects.

 

Lynn

0 Kudos
Message 4 of 26
(3,005 Views)

CAN U ELABORATE M NOT ABLE TO UNDERSTAND

0 Kudos
Message 5 of 26
(3,000 Views)

I MEAN HOW CAN N EXACTLY WHERE SHUD I ADD THIS CARRIGE RETURN OR LINE FEED

0 Kudos
Message 6 of 26
(2,992 Views)
Stop shouting! That is just rude.

The suggestion is to add it to your LabVIEW code. The simplest way is to right click on the string control you are using to send the command, and select '\' Codes Display. Then you would type a \r for a carriage return or \n for a line feed. This is how the simple serial example is setup.
0 Kudos
Message 7 of 26
(2,981 Views)

@vanashree wrote:

I MEAN HOW CAN N EXACTLY WHERE SHUD I ADD THIS CARRIGE RETURN OR LINE FEED


You could just use the Concatinate Strings and an End Of Line character.  But, personally, I like to use the Format String function.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 26
(2,978 Views)

It is not considered ploite on this Forum to use all CAPS because that is like shouting. 

 

Here is a quick modification of your VI. The VISA Open is not needed when using VISA Configure Serial Port. The string indicators have been changed to '\' Codes Display mode to show non-printing characters like line which appears as "\n".  If the Arduino uses a different termination character, like carriage return, you will need to change to that character.

 

Lynn

0 Kudos
Message 9 of 26
(2,977 Views)

m sorry dennis and forum guys i didnt notice that my caps was on. labview forum has always been useful to me..and will definitely take care next time m sorry

0 Kudos
Message 10 of 26
(2,968 Views)