Für dieses Forum muß Javascript im Browser aktiviert werden!
Kommentar: Einfügen von HTML im Kommentar: Link einfügen: <a href="LINKURL" target="_blank">LINKTITEL</a> Bild einfügen: <img src="BILDURL"> Text formatieren: <b>fetter Text</b> <i>kursiver Text</i> <u>unterstrichener Text</u> Kombinationen sind auch möglich z.B.: <b><i>fetter & kursiver Text</i></b> C2 Quellcode formatieren: <code>Quellcode</code> ASM Quellcode formatieren: <asm>Quellcode</asm> (Innerhalb eines Quellcodeabschnitts ist kein html möglich.) Wichtig: Bitte mache Zeilenumbrüche, bevor Du am rechten Rand des Eingabefeldes ankommst ! > Hallo Bram, > > Your main problem is the obsolete Software you use. > Please use at least OSOPT V3.0 an the up to date moduls. > The old Software breaks the C-Control II. > > There aro also aome errors in Your Code: > <code> > byte f; > ... > hwcom.receive(f,2,1); > if f > 100 // motor starts with speed data > { > ... > </code> > Here, you use the receive()-Funktion with a byte-variable for receive-buffer. > But the function hwcom.receive needs a byte-buffer-variable. (e.g.<code>byte f[10]</code>) > <code> > ... > station_io.RELon(1); > str.putint(s,f); > ...</code> > Here, you put a value to the string s. > But you don't use this String here to make an output. > > <code> > 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); > } > </code> > Here, you should use the counter-Ports directly. > I don't know what you want to do exactly, but this ist the slowest way. > > Try this: > The Programm should do nearly the same, but much faster. > <code> > //------------ > thread main > //------------ > { > byte i,f; > int x,m[210] ; > string s,output ; > stports.init(); > lcdext.init(); > hwcom.init(); > hwcom.setspeed(5); > plm.settimebase(0, 1); > plm.setperiod(0, 999); > lcdext.print("TEST UNIT"); > lcdext.line(2); > lcdext.print("MODULE II"); > x = 0; > i = 0; > sleep 100; > loop > { > stports.setLED(1,0); > stports.setLED(2,0); > if hwcom.rxd() > f=hwcom.get(); > else > f=0; > if f > 100 // motor starts with speed data > { > stports.setRel(1,1); > x = (f - 100)* 10; > } > else > if f==63 // ? motor stop speed data 0 > { > x = 0; > stports.setRel(1,0); > } > else > if f==64 // @ data to PC > { > for i= 0...<200 > { > hwcom.num(m[i]); > hwcom.ret(); > } > } > //======================================================================== > if ports.getcount(0) // 1 puls per rpm from encoder A > { > stports.setLED(1,1); > i = 0; > } > if ports.getcount(1) // 200 puls per rpm from encoder A = ca 1 kHz > { > i = i+1; > stports.setLED(2,1); > m[i] = ports.adc(0); > } > //========================================================================= > plm.out(0,x); // motor speed duty cycle to 99 % > } > }</code> > > Perhaps it would be better to use multithreading. > > Regards, > André H. > > > > 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 > > > >