Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
et:examples:motors:servo [2009/06/16 20:24] raivo.sellet:examples:motors:servo [2009/11/04 13:25] (current) – eemaldatud mikk.leini
Line 1: Line 1:
-====== RC Servo motor ====== 
  
-===== Ühendamine ===== 
-{{:examples:actuator:servo.jpg?500|}} 
- 
-{{:examples:actuator:servo_schema.jpg?300|}} 
-{{:examples:actuator:servo_connection_table.jpg|}} 
- 
- 
-===== RC servomootori juhtsignaal ===== 
- 
-{{:examples:actuator:pwm_signal.jpg|}} 
- 
-===== Näitekood ===== 
- 
-<code c> 
-/*------------------------------------------------------------- 
-Title: RC Servo motor with Actuator Board 
-Date: 080327 
-Ver.: 1.1 
-Compiler: AVR-GCC 
-Target: ATmega128 
-Hardware: ATmega128 controller board, Actuator board, RC servo motor 
-Author: Raivo Sell 2008 
- 
-Notes:  
-Description: Moves slowly RC motor shaft from one edge to another. 
----------------------------------------------------------------*/ 
-#define F_CPU 14745600UL //CPU Frequency (influences delay function) 
- 
-#include <avr/io.h> 
-#include <util/delay.h> 
- 
-///////////////// Main function ////////////////////////////////// 
-int main (void){ 
- 
- // Set timer control registers 
- TCCR1A = _BV(COM1A1) | _BV(COM1B1) | _BV(WGM11); 
- TCCR1B = _BV(CS11) | _BV(WGM13) | _BV(WGM12);  
-   
-    DDRB = 0x30;  // PB5 & PB6 output 
- ICR1   = 36000; // Sets the upper limit to Timer1  
-    //(creates 50 Hz signal) XTAL/8/256*50   14745600 
- OCR1A  = 2700;  // Sets when the PWM signal should toggle. 
-  
- while(1){ 
- for(OCR1A=500;OCR1A!=5000;OCR1A++)  {_delay_ms(3);} 
- for(OCR1A=5000;OCR1A!=500;OCR1A--)  {_delay_ms(3);} 
- } 
-} 
-</code> 
et/examples/motors/servo.1245183862.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0