PDA

View Full Version : Encoder


falleaf
27-06-2005, 10:21 AM
Các bạn download chương trình thiết kế encoder tại đây (http://picvietnam.com/download/Encoder_Design.exe)

Chúc vui.

Trần Quốc Đạt
29-11-2005, 12:14 PM
thế bác cho mình hỏi nguyên lý hoạt động của encoder đựoc chứ? hoặc sơ đồ khối càng tốt. tui định nghiên cứu làm thử xem sao nhưng tìm tài liệu khó quá. thanks

falleaf
29-11-2005, 04:41 PM
http://picvietnam.com/showthread.php?t=224

bạn xem bài viết trong luồng này.

Chúc vui.

dinhmanh0406
15-10-2010, 01:07 PM
các bác cho em hỏi cấu tạo và nguyên lý hoạt động của con encoder được không
Cản Ơn Các Bác Nhiều!!!

hcmut.khoamaisi
16-10-2010, 06:51 PM
Cái link bi hu roi

ducanh0215
31-05-2011, 11:57 PM
ủa
e không biết cắm encoder vào mạch thế nào
encoder của em có 3 dây thôi

hoangson_fet
18-04-2012, 06:49 PM
sửa giúp em với các pro. em điều khiển PWM được rồi theo nhiệt độ LM35 được rồi. còn đo tốc độ DC bằng encoder hiện lên LCD thì hiện 48484848. xem rồi tìm chổ sai giúp em với...(encoder vào chân RA4 của PIC 16F877a)

#include "D:\avr va pic\LM\Theend.h"
#include <LCD.C>
#fuses NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use delay(clock=20000000)
#byte portb=0x06
#byte porta=0x05 // khai bao cac dic chi
#byte portD=0x08 // khai bao dia chi cho Port D neu k co khai bao nay thi se k duoc define
#bit dir=0x06.0
#bit tmr1=0x0e.0
#bit tmr0=0x01.0
#bit intcon=0x0b.0
float tocdo,soxung;
int8 a,b,c,d,a1;
int16 sovong,i,count;

#int_rtcc
void Timer0_isr() // Dem so vong quay dong co
{
count++;

}
#int_TIMER1
TIMER1_isr()
{
soxung=count;
set_timer1(55535); // Trong 1ms
if(tmr1==1)
{
intcon=0; //stop ngat
a1=1;
}
}
void hienthi(float x)
{
if(a1==1)
{
tocdo=((float)*(60*x)/(0.01*100));
a=tocdo/1000;
b=(int)(tocdo-1000*a)/100;
c=(int)(tocdo-1000*a-100*b)/10;
d=(int)tocdo%10;
lcd_gotoxy(3,2);
printf(lcd_putc,"%du",a+0x30);
lcd_gotoxy(5,2);
printf(lcd_putc,"%du",b+0x30);
lcd_gotoxy(7,2);
printf(lcd_putc,"%du",c+0x30);
lcd_gotoxy(9,2);
printf(lcd_putc,"%du",d+0x30);
lcd_gotoxy(11,2);
delay_ms(5);
tmr0=0;tmr1=0;
}
}
void vantoc(int val);
void vantoc(int val)
{
setup_ccp1(ccp_pwm);
setup_timer_2(t2_div_by_4,124,1);
Set_pwm1_duty(val);
}
void main()
{
float value;
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
delay_ms(1);
set_timer0(0);
set_timer1(55535);
setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
setup_timer_2(T2_DIV_BY_1,0,1);
setup_ccp1(CCP_PWM);
set_pwm1_duty(0);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
lcd_init();
enable_interrupts(INT_TIMER1);
enable_interrupts(GLOBAL);
set_tris_a (0xff);
set_tris_b(0x00);
set_tris_d(0xff);
dir=1;
delay_us(10);
while(1)
{
set_adc_channel(0);
lcd_gotoxy(1,1);
value = read_adc();
delay_us(10);
value = value*455/(225);
printf(lcd_putc,"T=%f C",value);

if(value <20)
{
delay_us(10);
dir=1;
}
if(value>20&& value<23)
{
delay_us(10);
dir=0;
vantoc(50);
}
if(value >23 && value<27)
{
delay_us(10);
dir=0;
vantoc(80);
}
if(value > 27&& value < 30)
{
delay_us(10);
dir=0;
vantoc(110);
}
if(value>30)
{
setup_ccp1(ccp_off);
}
hienthi(sovong);
}

// TODO: USER CODE!!

}

anhminhpro
09-05-2012, 03:16 AM
cho em hỏi nguyên lí hoạt động của encoder.thank moi người nha.