دوستان من شدیدا مشغول به درست کردن یه ساعت گردون هستم برای سخت افزارش یه نمونه ابتدایی با فیبر سوراخ دار درست کردم ولی چون بالانس مکانیکیش خوب نبود یه برد زدم والان از لحاظ سخت افزاری آماده هستش ولی یه برنامه خیلی ساده نوشتم که با اومدن یه اینتراپت یکسری کد رو بریزه روی خروجی هاش ولی حالا نمیدونم کجای برنامم ایراد داره که هر چی تو پروتئوس چک می کنم اون کار رو انجام نمیده :cry2:
برنامم اینه :
فایل پروتئوس همراه با خود برنامه رو می زارم امیدوارم دوستان من رو کمک کنن 
http://up.persianscript.ir/uploads/daaf-test.rar
برنامم اینه :
کد:
'//////////////////////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ '----------------------------------------------------------------------------------------------------------------------- ' |-------------------------------------------------------------------------------| ' | | ' |name : Propller Clock.bas | ' | | ' |program : ENG.Amin Ghaffari | ' | | ' |purpose : shows how to write a program for a propeller clock | ' | | ' |micro : ATmega 8A | ' | | ' |date : 1392/8/23 | ' | | ' |university name : AZAD ISLAMICH UNIVERSITY OF BOJNOURD | ' | | ' |-------------------------------------------------------------------------------| '------------------------------------------------------------------------------------------------------------------------ '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\////////////////////////////////////////////////////////////////// '=========================== [DECLARE MICRO] ================================= $regfile = "m8def.dat" $crystal = 8000000 '========================= [CONFIG INTERRUPTS] =============================== Enable Interrupts 'enable global interrupts '------------------------- (external interrupt) ------------------------------ Enable Int0 'enable int0 of external interrupts Config Int0 = Rising 'we configure the INT0 interrupt to trigger when a rising edge is detected On Int0 Showe 'if happen int0 then go showe sub '======================= [CONFIG PORTS FOR OUTPUT] =========================== Config Portc = Output 'all portc for output Ddrc = &HFF '----------------------- Config Portb.0 = Output 'some pin of portb for output Config Portb.1 = Output Config Portb.2 = Output Config Portb.3 = Output Config Portb.4 = Output Config Portb.5 = Output Ddrb.0 = 1 Ddrb.1 = 1 Ddrb.2 = 1 Ddrb.3 = 1 Ddrb.4 = 1 Ddrb.5 = 1 '----------------------- Config Portd.0 = Output 'and some pin of portd for output Config Portd.1 = Output Config Portd.3 = Output Config Portd.4 = Output Ddrd.0 = 1 Ddrd.1 = 1 Ddrd.3 = 1 Ddrd.4 = 1 '======================= [DECLARES THE SUBROUTINES] ========================== Declare Sub Trans '======================== [DIMENSION THE VARIABLES] ========================== Dim J1 As Word Dim C As Byte '------------------------------------------------------------------------------- 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIII[MAIN PROGRAM]IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII '------------------------------------------------------------------------------- End 'end program '------------------------------------------------------------------------------- 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII '------------------------------------------------------------------------------- Showe: C = 0 Do J1 = Lookup(c , Data1) Gosub Trans Incr C Waitms 100 Loop Until C = 9 Return '-------------------------- Sub Trans: Portc.0 = J1.0 Portc.1 = J1.1 Portc.2 = J1.2 Portc.3 = J1.3 Portc.4 = J1.4 Portc.5 = J1.5 '------------- Portb.0 = J1.6 Portb.1 = J1.7 Portb.2 = J1.8 Portb.3 = J1.9 Portb.4 = J1.10 Portb.5 = J1.11 '------------- Portd.0 = J1.12 Portd.1 = J1.13 Portd.3 = J1.14 Portd.4 = J1.15 Return End Sub '============================== (WORD - A ) ==================================== Data1: Data 1022% , 1152% , 2176% , 4224% , 8320% , 4224% , 2176% , 1152% , 1022%

http://up.persianscript.ir/uploads/daaf-test.rar
دیدگاه