HT

Vai ai contenuti
POSIZ pos1;              //posizionamento indipendente

posiz_fissi *fi=0;
posiz_var   *va=0;
float quotax=100;
float speedx=10;
char b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14;
char ss1,ss2,ss3,ss4,ss5;
unsigned short int t_rep,t_rep_old;
char loopoff;
#include "page1.h"
// -------------------------------+
//    form  page1
// -------------------------------+
void form_page1(void)
{
 object(TPage,(void **)&page1,page1_Body,0,0,&Null,Byte,1,0,"PAGE");
}
// -------------------------------
// methods:
// -------------------------------

// -----------------------------------------------------------
// routine che esegue tutti i posizionamenti della levigatrice
// e le funzioni di levigatura. Chiamabile come timer o task
// -----------------------------------------------------------
void lavora(void)            //routine a tempo che chiama il ...
{
  loop_posiz(&pos1);        //passo della routine di posizionamento
}


void Event(onentry)()
{
  static int primo=1;
  if(primo)
  {
     primo=0;
     sf_rdata(&pos1.fis,0,sizeof(posiz_fissi)); //dati fissi del posiz. indipendente
     pos1.fis.nfcmin=0;
     pos1.fis.nfcmax=0;
     pos1.var.cmd=P_INIT;       //comando inizializza il posizionamento
     t_rep_old=0;               //vecchio tempo routine di posizionamento
     t_rep=1;                   //tempo desiderato routine di posizionamento
     speedx=(int)pos1.fis.vmax/2; //velocita' di default
     sl1=100;
     return;
  }
  if (t_rep!=t_rep_old)         //se cambiato tempo routine di posizionamento
  {
     exec_timer(lavora,t_rep,t_rep);  //reimposta routine a tempo
     t_rep_old=t_rep;
  }   
  ss1=O(pos1.fis.nonoff);       //aggiorna immagini dei led
  ss2=O(pos1.fis.ndirez);       //
  ss3=O(pos1.fis.nlento);       //
  ss4=O(pos1.fis.ndirup);       //
  ss5=O(pos1.fis.nfreno);       //
  if (pos1.fis.tipo_trasduttore!=2)
  {
      page1->edit12->Caption=page1->label5->Caption;
      page1->edit13->Caption=page1->label7->Caption;
  }
  else    
  {
      page1->edit12->Caption=page1->label2->Caption;
      page1->edit13->Caption=page1->label6->Caption;
  }
  if ((pos1.fis.sviluppo)&&(pos1.fis.impulsigiro)) Local->edit1->Color=219;
  else Local->edit1->Color=255;
  pos1.var.joggle=sl1/100.;
}
// -------------------------------
void Event(panel1_onentry)()
{
  fi=&pos1.fis;                 //puntatore ai posiz. attuali
  va=&pos1.var;                 //
}
// -------------------------------
void Event(button1_onmousedown)()
{
  sf_wdata(&pos1.fis,0,sizeof(posiz_fissi)); //dati fissi del posiz. indipendente
}
// -------------------------------
void Event(button2_onmousedown)()
{
  posiz(&pos1,P_START,quotax,speedx);   //comando start posizionamento
  if ((loopoff)&&(pos1.fis.gain))       //se flag motore off....
  {
     while(pos1.var.cmd){idle();};      //attendi comando accettato
     posiz(&pos1,P_OFF,0,0);            //comando successivo:motore off
  }
}
// -------------------------------
void Event(button3_onmousedown)()
{
  posiz(&pos1,P_DOWN_FAST,0,0);         //comando indietro veloce
}
// -------------------------------
void Event(button4_onmousedown)()
{
  posiz(&pos1,P_DOWN_SLOW,0,0);         //comando indietro lento
}
// -------------------------------
void Event(button5_onmousedown)()
{
  posiz(&pos1,P_UP_SLOW,0,0);           //comando avanti lento
}
// -------------------------------
void Event(button6_onmousedown)()
{
  posiz(&pos1,P_UP_FAST,0,0);           //comando avanti veloce
}
// -------------------------------
void Event(button3_onmouseup)()
{
  posiz(&pos1,P_STOP,0,0);              //comando stop
}
// -------------------------------
void Event(button8_onmousedown)()
{
  posiz(&pos1,P_STOP,0,0);              //comando stop
}
// -------------------------------
void Event(button9_onmousedown)()
{
  posiz(&pos1,P_START,0,speedx);        //vai a quota 0
  if ((loopoff)&&(pos1.fis.gain))       //se flag motore off...
  {
     while(pos1.var.cmd){idle();};      //attendi comando accettato
     posiz(&pos1,P_OFF,0,0);            //nuovo comando:motore off
  }
}
// -------------------------------
void Event(button11_onmousedown)()
{
  posiz(&pos1,P_OFF,0,0);               //comando motore off
}
// -------------------------------
void Event(button15_onmousedown)()
{
  posiz(&pos1,P_CERCA_MICRO_ZERO,0,0);  //comando ricerca micro di zero
}
// -------------------------------
void Event(button12_onmousedown)()
{
  posiz(&pos1,P_VMAX,500,0);            //comando autoapprendimento vmax e offset
}
// -------------------------------
void Event(edit29_onentry)()
{
  if(fi) me->decimals=fi->decimali;
}

#include "page1.h"
// -------------------------------+
//    form  page1
// -------------------------------+
void form_page1(void)
{
 object(TPage,(void **)&page1,page1_Body,0,0,&Null,Byte,1,0,"PAGE");
}
// -------------------------------
// methods:
// -------------------------------
void Event(onentry)()
{
#define PCIR *(unsigned char*) 0xef02
  static unsigned short int var1,var2,var3,var4;
  static unsigned short int a;
  a++;
  if(!(a & 255))
  {
     var1=SYSCON;
     var2=XPERCON;
     var3=RP0H;
     var4=SYSCON3;
     sprintf(Local->label2->Caption,"syscon =%04X",var1);
     sprintf(Local->label3->Caption,"xpercon=%04X",var2);
     sprintf(Local->label5->Caption,"rp0h   =%04X",var3);
     sprintf(Local->label6->Caption,"syscon3=%04X",var4);
//    sprintf(Local->label6->Caption,"can14  =%04X",can14);
  }   
  tachi++;
  residui=canopen_msg();
  tutti=canopen_r;
}
// -------------------------------
void Event(timer1_ontimer)()
{
  static int x=0;
  o1= (x>>0)&1;
  o33=(x>>1)&1;
  o49=(x>>2)&1;
  o34=1;
  o50=1;
  x++;
  taco=taco-taco/5+tachi;tachi=0;
  
  tachi3=encoder5;
  taco2=tachi3-tachi2;
  tachi2=tachi3;
  
  tachi13=encoder6;
  taco12=tachi13-tachi12;
  tachi12=tachi13;
}
// -------------------------------
void Event(timer2_ontimer)()
{
  static int b,c;
  b=b+200;
  c=c-200;
  anal5=b;
  anal6=c;
}
// -------------------------------
void Event(button1_onmouseup)()
{
// BUSCON2=0x2222;
}
// -------------------------------
void Event(panel2_onentry)()
{
 if (can_emergency_id)
 {
     v_locate(x_x+4,y_y+10);
     v_font(OFF8,1,1);
     v_color(BLACK,GRAY);
     printf("Emerg. ID=%04x ST=%04x CO=%04x",can_emergency_id,can_emergency_status,can_emergency_control);
 }
}
// -------------------------------
void Event(ondraw)()
{
}
HIGH
TECHNOLOGIES
We never stop approaching perfect
APPS

Electrical cabinet for CnC machines
Software engineering embedded
CadCam 3-4-5 Axes









SERVICES


Software Engineering
Electrical Engineering
Mechanicals Engineering



PROGRAMMING

DEVICES

APPS

CONNECTIONS

Torna ai contenuti