%Read pulsewidth & voltage
%
%Reads the driving pulsewidth applied to the motor and the supply
%voltage.
%
%Voltage scale = [0.03522 V]

function [PW,V]=readPwV(H)

globalVar;

command = READ_PW_V;
param1 = 0;
param2 = 0;
checksum = 256 - mod((STARTBYTE+command+param1+param2),256);

sendMessage(H,command,param1,param2,checksum);
[PW,V]=readMessage(H);

PW=(PW/255)*100;
V=V*V_RESOLUTION;

if(PW > 100)
    errfcn(H,ERR_READ_PW_V);
end
