:: مهندس ::
تاريخ التسجيل: May 2011
المشاركات: 10
|
|
نشاط [ aziz_botta2002 ]
قوة السمعة:0
|
|
23-12-2012, 08:07 PM
المشاركة 1
|
|
بسم الله الرحمن الرحيم
السلام عليكم
انا مبيدئ فى مجال الميكروكنترول وكان عندى استفسار عن طريقة برمجة IC موديل P16F628A لانى حاولت كثيرا لكن دون فائدة مع العلم انى شغال على برنامج الميكرو سى وده كود المعادلة الى بحاول ابرمجه
كود:
void main()
{TRISB=0; PORTB=0;
TRISA=0; PORTA=0;
loop:
PORTA=0B00000001; delay_ms(500); // L0 ON
PORTA=0B00000011; delay_ms(500); //L0,L1 ON
PORTA=0B00000111; delay_ms(500); //L0,L1,L2 ON
PORTA=0B00001111; delay_ms(500); //L0,L1,L2,L3 ON
PORTB=0B00000001; delay_ms(500); // L0 ON
PORTB=0B00000011; delay_ms(500); //L0,L1 ON
PORTB=0B00000111; delay_ms(500); //L0,L1,L2 ON
PORTB=0B00001111; delay_ms(500); //L0,L1,L2,L3 ON
PORTB=0B00011111; delay_ms(500); //L0,L1,L2,L3,L4 ON
PORTB=0B00111111; delay_ms(500); //L0,L1,L2,L3,L4,L5 ON
PORTB=0B01111111; delay_ms(500); //L0,L1,L2,L3,L4,L5,L6 ON
PORTB=0B11111111; delay_ms(500); // L0,L1,L2,L3,L4,L5,L6,L7 ON
PORTB=0B00000000; PORTA=0B00000000; delay_ms(500); // ALL LEDs OFF
PORTB=0B00000110; PORTA=0B00000000; delay_ms(500); // L3,L4 ON
PORTB=0B00001111; PORTA=0B00000000; delay_ms(500); //L2-L5 ON
PORTB=0B00011111; PORTA=0B00001000; delay_ms(500); //L1-LS ON
PORTB=0B00111111; PORTA=0B00001100; delay_ms(500); //L1-LS ON
PORTB=0B01111111; PORTA=0B00001110; delay_ms(500); // ALL LEDs ON
PORTB=0B11111111; PORTA=0B00001111; delay_ms(500); // ALL LEDs ON
PORTB=0B00000000; PORTA=0B00000000; delay_ms(500); // ALL LEDs OFF
PORTB=0B11111111; PORTA=0B00001111; delay_ms(500); // ALL LEDs ON
PORTB=0B00000000; PORTA=0B00000000; delay_ms(500); // ALL LEDs OFF
PORTB=0B11111111; PORTA=0B00001111; delay_ms(500); // ALL LEDs ON
PORTB=0B00000000; PORTA=0B00000000; delay_ms(500); // ALL LEDs OFF
goto loop;}
ولكم جزيل الشكر فى انتظار الرد
|