08-30-2014 10:10 AM - edited 08-30-2014 10:11 AM
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
Solved! Go to Solution.
08-30-2014 10:13 AM
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
08-30-2014 10:13 AM
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;
}
08-30-2014 10:21 AM
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
08-30-2014 10:32 AM
CAN U ELABORATE M NOT ABLE TO UNDERSTAND
08-30-2014 10:42 AM
I MEAN HOW CAN N EXACTLY WHERE SHUD I ADD THIS CARRIGE RETURN OR LINE FEED
08-30-2014 10:48 AM
08-30-2014 10:54 AM
@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.
08-30-2014 10:55 AM
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
08-30-2014 11:18 AM
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