Page 3 of 8
Re: Functional overview
Posted: Mon Jan 02, 2017 1:24 pm
by ArtF
Wow, you found serial and are dicking with that? Your not one to be trifled with.
I dont think anyone has hooked a vfd up as yet. But I did make sure the commands worked as
I put them together. Unfortunatley though, thats not a cnc57 command. Its a true serial channel open
on your PC. Thats OK if your close enough I guess and can hook a usb serial channel to your machine,
but there is no serial hookup yet available to the pokeys board that Ive allowed a channel to. Im
afraid Im one of those people that prefrers to control my vfd by hand, so I havent put much into vfd
control..
Art
Re: Functional overview
Posted: Tue Jan 03, 2017 12:19 pm
by Richard Cullin
Its a true serial channel open
on your PC.
[I looked for it everywhere with the logic probe ;D]
That's plenty good enough , findings so far
sending these data sets
1,5,3,0x27,0x10,0,crc sets spindle to 6000rpm
1,5,3,0x47,7,0,crc sets spindle to 10000rpm
1,4,3,0,crc will read set freq
1,4,3,1,crc will read actual freq
1,3,1,1,crc will turn spindle on cw
1,3,1,8,crc will turn spindle off
just need to code freq to rpm calc's and dro updates
an a crc routine
the huanyung vfd 485 port is not really Modbus at all ,no real time out constraints or refresh requirements at all. it looks to be quite easy
[famous last words]
Re: Functional overview
Posted: Tue Jan 03, 2017 1:57 pm
by Amazon [Bot]
Very cool, great to see this :) Excellent development
Are the speeds based on your VFD spindle ranges, or are these values based on some internal data point range?
guess i'm not seeing a linearity
Also, have to assume your running the VFD direct from a usb serial port
1,5,3,0x27,0x10,0,crc sets spindle to 6000rpm
1,5,3,0x47,7,0,crc sets spindle to 10000rpm
Re: Functional overview
Posted: Tue Jan 03, 2017 10:48 pm
by Richard Cullin
Are the speeds based on your VFD spindle ranges, or are these values based on some internal data point range?
guess i'm not seeing a linearity
it was based on looking at what the mach3 vfd dll sends to the vfd with a logic analyser .
and I agree the data looks incorrect . I believe the correct result is 55rpm per 1Hz of vfd freq
so :-
0x2710 = 10000 (freq x 100 ) ie 100.00 Hz and is really 5500 rpm
0x4707 = 18183 181.83 Hz 10000 rpm
the vfd display verifies this
Also, have to assume your running the VFD direct from a usb serial port
correct [elcheapo ebay rs485 stick] I will try it with auggie today
Re: Functional overview
Posted: Wed Jan 04, 2017 12:31 am
by Richard Cullin
fallen at first hurdle,can't figure out how to send a table via serial or infact anything but const ascii string
Code: Select all
// Library Vfd-Spindle
// Created Wednesday, January 04, 2017
// Author rc -- Do not edit above this line
// Enter Global vars below this line.
// the librarian no matter where they are, but its easier
// to find and edit them in one spot.
// vfd stuff
global myser = Serial();
//
//
//
// called from OnEnable
global Vfd_Open = function()
{
myser.Open(6,9600);
print( "VFD opened");
};
//this is a relay spindle control,
//it will use only the OC output #1
//to control a relay to turn a simple
//on/off spindle, on or off.
global SpindleOn = function()
{
data =table();
data[0]=1;
data[1]=3;
data[2]=1;
data[3]=1;
data[4]=0x31;
data[5]=0x88;
//[font=Verdana] this fails[/font]
//myser.SendData(data[0],data[1]);
// [font=Verdana]this works [/font]
myser.SendData("010301013188");
//FreeSetSpeed( MySpindleAxis, GlobalGet("SpindleSpeed")); //turn on spindle
print("Vfd Spindle was turned on");
print("Set to Frequency " + GlobalGet("SpindleSpeed"));
};
//this is a relay spindle control,
//it will use only the OC output #1
//to control a relay to turn a simple
//on/off spindle, on or off.
global SpindleOff = function()
{
//FreeSetSpeed( MySpindleAxis,0); //turn off spindle
print("Spindle speed zeroed");
};
Re: Functional overview
Posted: Wed Jan 04, 2017 1:46 am
by Amazon [Bot]
how about something like this
Code: Select all
global myser = Serial();
//global vfd={"0x01,","0x03,","0x01,","0x01,","0x31,","0x88,"}; No luck
global vfd={0x01,0x03,0x01,0x01,0x31,0x88};
global VFDOpen = function()
{
myser.Open(6,9600); //port 6 baud 9600
print( "VFD opened");
return;
};
global SpindleOn = function()
{
// sendData=(vfd[0]+vfd[1]+vfd[2]+vfd[3]+vfd[4]+vfd[5]);
sendData=(vfd[0]+","+vfd[1]+","+vfd[2]+","+vfd[3]+","+vfd[4]+","+vfd[5]);
debug();
myser.SendData(sendData);
print("Set to Frequency " + GlobalGet("SpindleSpeed"));
return;
};
global VFDSpindle = function(control)
{
FreeSetSpeed( MySpindleAxis,control); //turn on/off spindle
if(control ==1){
print("Spindle On");
SpindleOn();
}
else
{
print("Spindle Off");
//SpindleOff(); // need to call/Create the Off function
}
};
VFDOpen();
VFDSpindle(1); //1 is on 0 is off
Re: Functional overview
Posted: Wed Jan 04, 2017 2:15 am
by Richard Cullin
I really want to send
sendData=(vfd[0]+vfd[1]+vfd[2]+vfd[3]+vfd[4]+vfd[5]);
myser.SendData(sendData);
error is
expecting param 0 as string, got int
if I
sd=vfd[0].string()
myser.SendData(sd);
it sends 0x31 not 1
so I can't even send 1 element at a time :-[
really need to see function template of SendData() or something
Re: Functional overview
Posted: Wed Jan 04, 2017 2:17 am
by ArtF
Hi Richard:
I think its done as follows..
global vfd={0x01,0x03,0x01,0x01,0x31,0x88,0x00}; //terminated with zero for string conversion..
global myser = Serial();
myser.Open(6,9600); //port 6 baud 9600
line = ToString(vfd);
myser.SendData(line);
myser.Close();
Ill dig in the code to be sure..
Art
Re: Functional overview
Posted: Wed Jan 04, 2017 2:29 am
by ArtF
Richard:
While that compiles, it doesnt work as expected.. Ill trace it down and report the fix..
Art
Re: Functional overview
Posted: Wed Jan 04, 2017 2:39 am
by Richard Cullin
ToString(vfd);
that sends
table:0x13bd9fc4
looks like an address