Zur Übersicht - INFO - Neueste 50 Beiträge - Neuer Beitrag - Suchen - FAQ - Zum CC1-Forum - Zum CC-Pro-Forum

program to slow Kategorie: CC2-Unit & Appl.Board / CC2-Station (von Bram - 30.04.2006 23:09)
Ich nutze:
C-Control II Station, original OS
Hello everybody:
I have a C-Control II Station and written this file for a proto type machine ( suspension movments)    
the following programme in C2 according to the appropriate tools. However, it is way too slow and
I cannot get to work the interrupts. (See the blocked section).
I know assembler (8051) fairly well and I want to know if somebody can help me get started to
transfer this programme in assembler C164.

//------------
  thread main
//------------
{
   byte i,f ;
   int x,m[210] ;
   string s,output ;
   station_lcd.init();
   station_io.init();
   hwcom.init();
   hwcom.setspeed(5);
   plm.settimebase(0, 1);
   plm.setperiod(0, 999);
   station_lcd.cursorpos(1,0);
   output = "TEST UNIT";
   station_lcd.print(output);
   output = "MODULE II";
   station_lcd.cursorpos(2,0);
   station_lcd.print(output);
   x = 0;
   i = 0;
   sleep 100;
 loop
  {
   station_io.LEDoff(1);
   station_io.LEDoff(2);
   hwcom.receive(f,2,1);
   if f > 100               // motor starts with speed data
   {
   station_io.RELon(1);
   str.putint(s,f);
   x = f ;
   f = 0;
   x = (x - 100)* 10;
   }
   if f  == 63               //  ? motor stop speed data 0
   {
   f = 0;
   x = 0;
   station_io.RELoff(1);
   }
   if f == 64                //  @ data to PC
   for i= 0...200
   {
   f = 0;
   str.clear(s);
   str.putint(s,m[i]);
   hwcom.send(s,3);
   hwcom.put(13);
   hwcom.put(10);
   hwcom.flush();
   }
//========================================================================
   if ports.get(8) == -1     // 1 puls per rpm from encoder A
  {
   station_io.LEDon(1);
   i = 0;
   wait ports.get(8) == 0;   // wait for low
  }
   if ports.get(9) == -1     // 200 puls per rpm from encoder A = ca 1 kHz
  {
   wait ports.get(9) == 0;   // wait for low
   i = i+1;
   station_io.LEDon(2);
   m[i] = ports.adc(0);
  }
//=========================================================================
   plm.out(0,x);            // motor speed duty cycle  to 99 %
 }

Thanks, Bram



    Antwort schreiben


Antworten:

Re: program to slow (von André H. - 1.05.2006 22:04)
Re: program to slow (von Ingo - 1.05.2006 8:09)