Functional overview

Discussions and file drops for Auggie
MBad
Old Timer
Posts: 23
Joined: Tue Feb 16, 2016 2:15 pm

Re: Functional overview

Post by MBad »

I dont know how to Thank You ...
but now I have to go for 5 days to hospital and they do not like, that i bring my VfD with me  :-[.

Regards Michael
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4591
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Functional overview

Post by ArtF »

Take care, lots of time when you return. :)

Art
Richard Cullin
Old Timer
Posts: 152
Joined: Sat Jun 02, 2012 5:45 am

Re: Functional overview

Post by Richard Cullin »

some question re  Serial()

I have the laser licked,  time to tackle the  RS 485 VfD 

Code: Select all

myser = Serial();
myser.Open(7,9600);
I assume creates a serial instance on pin 7 ?  is it an input or an output ?
[where is pin 7 on a 57cnc ?  but that's another adventure]

the only reference to outputting data I can find  is
myser.SendData("data")

so what pin would that use ?
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4591
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Functional overview

Post 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
Richard Cullin
Old Timer
Posts: 152
Joined: Sat Jun 02, 2012 5:45 am

Re: Functional overview

Post 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]
Ya-Nvr-No
Old Timer
Posts: 188
Joined: Wed Sep 08, 2010 11:15 am

Re: Functional overview

Post by Ya-Nvr-No »

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

Last edited by Ya-Nvr-No on Tue Jan 03, 2017 3:21 am, edited 1 time in total.
Richard Cullin
Old Timer
Posts: 152
Joined: Sat Jun 02, 2012 5:45 am

Re: Functional overview

Post 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

Richard Cullin
Old Timer
Posts: 152
Joined: Sat Jun 02, 2012 5:45 am

Re: Functional overview

Post 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");
    
};  
 
Ya-Nvr-No
Old Timer
Posts: 188
Joined: Wed Sep 08, 2010 11:15 am

Re: Functional overview

Post by Ya-Nvr-No »

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

Richard Cullin
Old Timer
Posts: 152
Joined: Sat Jun 02, 2012 5:45 am

Re: Functional overview

Post 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

User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4591
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Functional overview

Post 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
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4591
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Functional overview

Post by ArtF »

Richard:

While that compiles, it doesnt work as expected.. Ill trace it down and report the fix..

Art
Richard Cullin
Old Timer
Posts: 152
Joined: Sat Jun 02, 2012 5:45 am

Re: Functional overview

Post by Richard Cullin »

ToString(vfd);
that sends

table:0x13bd9fc4

looks like an address
Richard Cullin
Old Timer
Posts: 152
Joined: Sat Jun 02, 2012 5:45 am

Re: Functional overview

Post by Richard Cullin »

thanks art , while your lookin  is there a bog standard ccitt  crc code in there anywhere ??
Ya-Nvr-No
Old Timer
Posts: 188
Joined: Wed Sep 08, 2010 11:15 am

Re: Functional overview

Post by Ya-Nvr-No »

do these hex values need to be sent as a string?

Code: Select all

global  myser = Serial();
global  vfd={"0x01","0x03","0x01","0x01","0x31","0x88","0x00"}; 
 
global  VFDOpen = function()
{
	myser.Open(6,9600); //port 6 baud 9600
	print( "VFD opened");  
       return;
};
 
global SpindleOn = function()
{

vfd0=ToString(vfd[0]);
vfd1=ToString(vfd[1]);
vfd2=ToString(vfd[2]);
vfd3=ToString(vfd[3]);
vfd4=ToString(vfd[4]);
vfd5=ToString(vfd[5]);
vfd6=ToString(vfd[6]);

  sendData=(vfd0+","+vfd1+","+vfd2+","+vfd3+","+vfd4+","+vfd5+","+vfd6);
 
print(sendData);
    myser.SendData(sendData);
    print("Set to Frequency " + GlobalGet("SpindleSpeed"));
    myser.Close();
    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

9:52:510  VFD opened 
9:52:513  Spindle On 
9:52:516  0x01,0x03,0x01,0x01,0x31,0x88,0x00 
9:52:519  Set to Frequency 0 
Last edited by Ya-Nvr-No on Tue Jan 03, 2017 4:09 pm, edited 1 time in total.
Post Reply

Who is online

Users browsing this forum: No registered users and 56 guests