Hallo,
Ich hab grade eben mal angefangen ne kleine Software für meinen Omniwheel-Bot zu bauen.
Ich hab da mit meinem Mathelehrer ne kleine Funktion gebastelt, die mit dem Sinus arbeitet und eigentlich so funktionieren müsste.
Nur kompiliert Bascom genau das nicht. ABS() will angeblich immer einen Integer oder Long.
Dabei benutz ich die Funktion gar nicht und wie kann bei sin() ein Integer rauskommen? Es sei denn das wird noch mit 100 multipliziert.
Könnt ihr mir helfen?
Code:$regfile = "m16def.dat" $crystal = 8000000 Config Pind.4 = Output 'OC1A Config Pind.5 = Output 'OC1B Config Pind.7 = Output 'OC2 Config Pina.3 = Output 'A IN 1 Config Pina.4 = Output 'A IN 2 Config Pina.5 = Output 'B IN 1 Config Pina.6 = Output 'B IN 2 Config Pina.7 = Output 'C IN 1 Config Pinc.0 = Output 'C IN 2 Porta.3 = 1 Porta.5 = 1 Porta.7 = 1 Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up , Prescale = 1 'Config Timer2 = Pwm , Compare A Pwm = Clear Up , Prescale = 1 ' TIMER2 ' may control another chopper, phase 90 'won't work with BASCOM! 'Config Timer2 = Pwm , Compare Pwm = Clear Up , Prescale = n 'her is hard coded replace ' 7 = 0 always in PWM mode ' 6:3 = 11 Fast PWM 8bit ' 5:4 = 10 clear on compare match ' 2:1:0 = 001 / 1 ; 010 / 8 ; 011 / 32 : 100 / 64 : 101 / 128 : 110 / 256 : 111 / 1024 Prescale ' / 1 ~ 8MHz used Tccr2 = &B01101001 Ocr2 = 0 Dim Motor1 As Single Dim Motor2 As Single Dim Motor3 As Single Dim I As Integer Do For I = 1 To 360 Motor1 = Sin(i) Motor2 = Sin(i -((2 / 3) * 3.14159265358979)) Motor3 = Sin(i -((1 / 3) * 3.14159265358979)) Next 'Compare1a = 75 'Compare1b = 75 'Ocr2 = 75 Loop







Zitieren

Lesezeichen