|
:: عضو ذهبي ::
تاريخ التسجيل: Jul 2009
الدولة: الخرطوم_السودان
المشاركات: 895
|
|
نشاط [ robota ]
قوة السمعة:
|
|
24-04-2010, 07:01 PM
المشاركة 34
|
|
كود الميكروبيسك
هذا هو كود ايجاد ثابت السرعةبالبيسك قام بكتابته الاخ :صهيب البلال جزاه الله خيرا
كود:
program speed
dim LCD_RS as sbit at RB2_bit
LCD_EN as sbit at RB3_bit
LCD_D4 as sbit at RB4_bit
LCD_D5 as sbit at RB5_bit
LCD_D6 as sbit at RB6_bit
LCD_D7 as sbit at RB7_bit
LCD_RS_Direction as sbit at TRISB2_bit
LCD_EN_Direction as sbit at TRISB3_bit
LCD_D4_Direction as sbit at TRISB4_bit
LCD_D5_Direction as sbit at TRISB5_bit
LCD_D6_Direction as sbit at TRISB6_bit
LCD_D7_Direction as sbit at TRISB7_bit
dim cnt as byte
speed as integer
txt as string[10]
sub procedure Interrupt()
Inc(cnt) ' Increment value of counter on every interrupt
INTCON = 0x20 ' Set T0IE, clear T0IF
end sub
main:
OPTION_REG = %00101111
TRISB = 0
TRISA = 0xff
INTCON = %10100000
Lcd_Init() '
Lcd_Cmd(_LCD_CLEAR)
Lcd_Cmd(_LCD_CURSOR_OFF)
TMR0 = 0
cnt = 0
speed=0
Lcd_Out(1,1,"Encodertest")
delay_ms(1000)
speed=TMR0+(255*cnt)
speed=speed*60
intToStr(speed, txt)
Lcd_Cmd(_Lcd_CLEAR)
Lcd_Out(1,1,"speed=")
Lcd_Out(2,6,txt)
end.
سنكمل قريبا ان شاء الله
بالتوفيق
|