PIC Vietnam

Go Back   PIC Vietnam > Robotics > Cơ cấu chấp hành (Actuator)

Tài trợ cho PIC Vietnam
Trang chủ Đăng Kí Hỏi/Ðáp Thành Viên Lịch Tìm Kiếm Bài Trong Ngày Ðánh Dấu Ðã Ðọc Vi điều khiển

Cơ cấu chấp hành (Actuator) Động cơ DC, AC, động cơ không chổi than, động cơ không cảm biến...

Trả lời
 
Ðiều Chỉnh Xếp Bài
Old 23-12-2010, 08:49 PM   #46
ykien_cuatoi
Nhập môn đệ tử
 
Tham gia ngày: Sep 2010
Bài gửi: 1
:
sao thế.đợi hoài không thấy ai đăng hết ta
ykien_cuatoi vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 23-01-2011, 09:04 PM   #47
opto
Nhập môn đệ tử
 
Tham gia ngày: Oct 2010
Bài gửi: 7
:
điều khiển một động co rcservo thi dễ rùi. còn điều khiển kiểu này có ai làm được chưa
http://www.youtube.com/watch?v=0il8uEUCGtk
opto vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 23-01-2011, 09:19 PM   #48
opto
Nhập môn đệ tử
 
Tham gia ngày: Oct 2010
Bài gửi: 7
:
đây là code cho 1 servo:

#include "16F84.H"
#define CP_off |= 0x3FFF // copy protect off for 16F84
#pragma config CP_off, PWRTE=on, WDTE=off, FOSC=XT

/* assign names to ports and pins */
#pragma bit SERVO @ PORTB.1
#pragma bit RESET_S @ PORTA.0
#pragma bit TURN_C @ PORTA.1
#pragma bit TURN_A @ PORTA.2

/* function prototypes */
void delay_min (void);
void delay_var (char n);
void pause (void);

void main( void)
{
PORTB = 0b.0000.0000; /* initial value */
TRISB = 0b.0000.0000; /* Port B all o/p */
PORTA = 0b.0.0111; /* initial value */
TRISA = 0b.1110.0111; /* xxx0 0001 */

char position=107; // total time 1.5ms center position

while(1) // endless loop
{
SERVO=1;
delay_min();
if (position>0)
delay_var(position);
SERVO=0;
pause(); // 20 ms delay before next pulse
if ((TURN_C==0)&&(position<255))
position++;
if ((TURN_A==0)&&(position>0))
position--;
if (RESET_S==0)
position=107; // center the servo
}

} // end of main


void delay_min (void) // 750 uS including overhead
{
char n=248;
do ; while(--n>0);
nop(); // padding to produce precise time
}
// delay = 2 + 2 + (n x 3) -1 +1 +2 = 750us @ 4MHz
// 2 for call, 2 for preset n, (n x 3)-1 for loop, 1 padding, 2 for return

void delay_var (char n) // adc x 7 uS = 1790us max.
{
do {nop(); nop(); nop(); nop();} while(--n>0);
}
// delay= 2 + 2 + (t x 7) -1 +2 us @ 4MHz

void pause (void) // delay between pulses approx 20 ms
{
char n;
for (n=0;n<26;n++)
{
delay_min(); // 750 us
}
}
opto vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 23-01-2011, 09:21 PM   #49
opto
Nhập môn đệ tử
 
Tham gia ngày: Oct 2010
Bài gửi: 7
:
còn đây là code cho 4 servo. bạn nào quan tâm chúng ta cùng mổ xẻ nhé:


#include "16C711.H" // Change for your CPU
#include "int16CXX.h"

#pragma config WDTE=off, FOSC=XT, BODEN=on
#pragma config |= 0x3FB0 // Code protect off

char servo_pin; // Variable for port pins
char servo[4]; // Servo position values
char servo_num; // Pointer to current servo position value
char position; // Working servo position value
char window; // 2ms - position value
char boogies; // Interrupt counter
char loops; // Loop counter
char current; // same as servo_num, but outside of interrupt
bit direction; // direction of travel flag

#pragma origin 4

// With .1ms resolution, we can control the servo in 10% steps:
// 10 = 0 degrees (or 100% backward motion) 1.0ms
// 11 = 18 degrees (or 80% backward motion) 1.1ms
// 12 = 36 degrees (or 60% backward motion) 1.2ms
// 13 = 54 degrees (or 40% backward motion) 1.3ms
// 14 = 72 degrees (or 20% backward motion) 1.4ms
// 15 = 90 degrees (or stopped) 1.5ms
// 16 = 108 degrees (or 20% forward motion) 1.6ms
// 17 = 126 degrees (or 40% forward motion) 1.7ms
// 18 = 144 degrees (or 60% forward motion) 1.8ms
// 19 = 162 degrees (or 80% forward motion) 1.9ms
// 20 = 180 degrees (or 100% forward motion) 2.0ms
// So our pulse routine needs to run 1ms + x tenths.
// Next version will (maybe) use hundredths, from 100 to 200.

interrupt scan_servos() {
PORTA = 2; // indicate where we are
T0IF = 0; // Clear TMR0 interrupt flag
int_save_registers // Save status & W reg
char fsr; fsr = FSR; // Save FSR
OPTION = 8; // No TMR0 prescaler
servo_pin = 1; // Set up for first servo
for(servo_num = 0; servo_num <=3; servo_num++) {
position = servo[servo_num]; // get pulse width value
window = 30 - position; // Figure out remainder of 2ms window
PORTB = servo_pin; // Turn on servo pin
TMR0 = 0; // Clear TMR0
do {
TMR0 = 11; // Adjust for execution time
while ( TMR0 < 100 ); // wait 100 uS
} while( --position > 0 ); // for as many as we need
PORTB = 0; // Turn off all servo pins
// Now we have to burn up the remainder of the 2ms total pulse
// window...
if(window > 0) {
do {
TMR0 = 11; // Adjust for execution time
while ( TMR0 < 100 ); // wait 100 uS
} while(--window > 0); // for as many as we need
}
// And set us up for the next servo in line...
servo_pin = servo_pin*2; // Set up for next servo in line
}

// Now we set up for an 8ms delay until the ext interrupt.
// We just spent 8ms pulsing the servos, so in another 12 we
// need to do it again.
int_restore_registers // Retrieve the registers
FSR = fsr; // Restore FSR
OPTION = 5; // 256 prescaler for TMR0
TMR0 = 187; // Set up for 12ms interrupt
boogies++; // Increment boogie counter
PORTA = 0;
}


void main(){
T0CS = 0; // T0 on instruction cycle
T0SE = 1; // rising edge
clearRAM(); // start with clear RAM
PORTA = 0;
PORTB = 0; // All outputs off
TRISA = 0;
TRISB = 0; // Port B is all output
OPTION = 5; // Prescaler set to 256
direction = 0;

// Set all servo position registers to the 90 degree mid point.
for(current = 0; current < 4; current++) {
servo[current] = 15;
}
TMR0 = 131; // Set up timer for 8ms
T0IE = 1; // Enable TMR0 interrupt
GIE = 1; // Duh.

// The boogie counter gets updated every 20ms, so 50 boogies
// equals one second. Tip of the hat to bogomips.

// First wait 2 seconds to let us see how the servos do at deadband
while(boogies < 100); // Loop for 2 seconds

// Now do 60 loops of 10% steps once a second, full motion
// range from 10 to 20 and back. Should take 1 minute.
direction = 1;
loops = 0;
PORTA = 1;
do {
boogies = 0; // clear boogie counter
while( boogies < 10 ); // Wait 1/5 second
for(current=0; current < 4; current++) {
if(servo[current] == 25) direction = 0;
if(servo[current] == 5) direction = 1;
if(direction == 0) servo[current]--;
if(direction == 1) servo[current]++;
}
} while(++loops < 60);

// Now recenter the servos for 2 seconds
for(current=0; current < 4; current++) {
servo[current] = 15;
}
boogies = 0;
while(boogies < 100);

// Now we finish up with 10 full-travel swings, 10 to 20,
// with a 2-second delay in between.

loops = 0;
PORTA = 0xD;
do {
boogies = 0;
while(boogies < 100); // 2 second delay
for(current=0; current < 4; current++) {
if(servo[current] == 25) direction = 0;
else if(servo[current] == 5) direction = 1;
else if(servo[current] > 5 && servo[current] < 25) direction = 0;
if(direction == 0) servo[current] = 5;
if(direction == 1) servo[current] = 25;
}
} while(++loops < 10);

// And loop forever.
main();
}
opto vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 08-04-2011, 10:34 PM   #50
langtul42
Nhập môn đệ tử
 
Tham gia ngày: Apr 2010
Bài gửi: 2
:
help me !!!

pac nao co tai lieu ve dong co rc servo thi share cho minh voi ,dang lam do an ma tim hoai hok thay,......

ah ! minh dag co ban 2 con cam bien sieu am SRF 05 , hoan toan moi , chua qua su dung , gia moi con la 24 USD ,. ban nao co nhu cau thi lien he voi minh nha : 01688956982
langtul42 vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 19-04-2011, 01:00 AM   #51
delta21
Đệ tử 5 túi
 
delta21's Avatar
 
Tham gia ngày: Mar 2010
Bài gửi: 95
:
Send a message via Yahoo to delta21
bác opto lấy đoạn code trên ở đâu thê!!!
__________________
Chỉ sợ thiếu tiền......
delta21 vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 30-08-2011, 01:37 PM   #52
NBTrung
Nhập môn đệ tử
 
Tham gia ngày: Feb 2009
Bài gửi: 10
:
anh falleaf cho em xin tài liệu rc servo với ạ, link post #1 die rùi.
Nếu k tiện up lên thì cho e vào mail dont.surrender@yahoo.com.vn
NBTrung vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 27-09-2011, 10:34 AM   #53
dinhquang2410
Nhập môn đệ tử
 
Tham gia ngày: Sep 2011
Bài gửi: 1
:
minh dang lam luan van ve dong co servoRC su dung trong cac thiet bi dieu khien tu xa nhu do choi dieu khien may bay cac bac co ai biet ve phan mem viet code va lam trinh ko chi minh voi,cach thuc hien nhu the nao.thks

thay đổi nội dung bởi: dinhquang2410, 27-09-2011 lúc 10:39 AM.
dinhquang2410 vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 09-12-2011, 10:42 AM   #54
tuand1
Nhập môn đệ tử
 
Tham gia ngày: Mar 2011
Bài gửi: 5
:
tìm hoài cũng thấy tài liệu về Servo motor gửi lên cho các bác tham khảo
tuand1 vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 09-12-2011, 10:44 AM   #55
tuand1
Nhập môn đệ tử
 
Tham gia ngày: Mar 2011
Bài gửi: 5
:
http://www.mediafire.com/?f6t8gsddl70f7lv
tuand1 vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 29-02-2012, 10:16 AM   #56
chuong_prof
Nhập môn đệ tử
 
Tham gia ngày: Jul 2011
Bài gửi: 8
:
điều khiển >10 RC servo

Trích:
Nguyên văn bởi opto View Post
điều khiển một động co rcservo thi dễ rùi. còn điều khiển kiểu này có ai làm được chưa
http://www.youtube.com/watch?v=0il8uEUCGtk
Có ai làm được cái này chưa ta?
chuong_prof vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Trả lời

Ðiều Chỉnh
Xếp Bài

Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt

Chuyển đến

Similar Threads
Ðề tài Người gửi Chuyên mục Trả lời Bài mới
Điều khiển servo falleaf Điều khiển 11 13-12-2011 12:46 AM
Tìm mua động cơ Servo loại HS232,.. thuanbk Tìm mua sản phẩm 3 04-03-2011 07:43 PM
động cơ servo ken Cơ cấu chấp hành (Actuator) 41 02-11-2010 03:07 PM
Biến tần( AC Servo Drive) - giao tiếp với PC, PLC dùng MODBUS Communications hieutq Điều khiển 8 18-10-2006 02:31 PM
Tim mua mach dieu khien DC/AC SERVO Driver Vo Hoang SOn Tìm mua sản phẩm 0 13-08-2005 11:40 AM


Múi giờ GMT. Hiện tại là 05:28 AM.


Được sáng lập bởi Đoàn Hiệp
Powered by vBulletin®
Page copy protected against web site content infringement by Copyscape
Copyright © PIC Vietnam