Matlab Slow Analog IO code issue

Just about everything about Red Pitaya
Post Reply
davilloo
Posts: 1
Joined: Tue Jun 05, 2018 6:58 pm

Matlab Slow Analog IO code issue

Post by davilloo » Tue Jun 05, 2018 7:07 pm

Hi !

For my project I'm going to use slow analog IO. For testing, I'm connecting the AO# to the AI# to measure the voltages. But when I use a variable to set the output voltage, it gives to the output the last value given before using the variable to set the value. Here is the code:

%% Define Red Pitaya as TCP/IP object
clc;

IP= '172.26.37.200'; % Input IP of your Red Pitaya...
port = 5000;
tcpipObj=tcpip(IP, port);

%% Open connection with your Red Pitaya

fopen(tcpipObj);
tcpipObj.Terminator = 'CR/LF';

G=1;
R=1;
C=1;
P=1;

fprintf(tcpipObj,'ANALOG:PIN AOUT0,G'); % 0.3 Volts is set on output 0
fprintf(tcpipObj,'ANALOG:PIN AOUT1,R');
fprintf(tcpipObj,'ANALOG:PIN AOUT2,C');
fprintf(tcpipObj,'ANALOG:PIN AOUT3,P');

volts0=str2num(query(tcpipObj,'ANALOG:PIN? AIN0'))
volts1=str2num(query(tcpipObj,'ANALOG:PIN? AIN1'))
volts2=str2num(query(tcpipObj,'ANALOG:PIN? AIN2'))
volts3=str2num(query(tcpipObj,'ANALOG:PIN? AIN3'))

%% Close connection with Red Pitaya

fclose(tcpipObj);

Should I use a loop to refresh?

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: Google [Bot] and 22 guests