بسم الله الرحمن الرحيم
اهلا شباب . . تعرفوا موضوعي السابق الي كتبته حول طلبي دائره وبرنامج لعمل ليد يضي ويقل ضوئه من خلال تقنيه pwm عبر زر . .
انا لقيت الدائره والبرنامج بس ياريت حد يساعدني ويعطيني تطبيق الدائره على البروتيوس والبرنامج على المايكروسي . . اقصد الملفات يعني . .
هاي الدائره ياريت حد يسويها بالبروتيوس ويعطيني الملف :
وهاد هو البرنامج ياريت حد يعطيني ملف المايكروسي تبعو وملف hex :
كود:
/* '******************************************************************************* ' Lesson nr.06: ' Push Button ' Written by: ' Aureliu Raducu Macovei, 2010. ' Description: ' In this experiment we will make a demonstration with button library ' The PORTB is used for this experiment (as output, for a leds) ' and RA6 (as imput, for button). ' Test configuration: ' MCU: PIC16F628A ' Test.Board: WB-106 Breadboard 2420 dots ' SW: MikroC PRO for PIC 2010 (version v4.15) ' Configuration Word ' Oscillator: INTOSC:I/O on RA.6, I/O on RA.7 ' Watchdog Timer: OFF ' Power up Timer: Disabled ' Master Clear Enable: Enabled ' Browun Out Detect: Enabled ' Low Voltage Program: Disabled ' Data EE Read Protect: Disabled ' Code Protect: OFF '******************************************************************************* */ unsigned short oldstate; void main() { // Main; TRISB = 0; // Set PORTB direction to be output; PORTB = 0xFF; // Turn OFF LEDs on PORTA; TRISA6_bit = 1; // Set PORT RB1 input for button; oldstate = 0; // Define value of oldstate; do { if (Button(&PORTA,6,1,1)) oldstate = 1; Delay_ms(100); //delay for prevent crash if (oldstate &&Button(&PORTA,6,1,0)) { PORTB = ~PORTB; //invert state of PORTB oldstate = 0; } } while(1); //Infinite loop. }
ودمتم سالمين . . اتمنى قبل يوم الاثنين واكون ممنونه لكم