Professional Documents
Culture Documents
Msv:171601290
+Chương trình:
#include<stdlib.h>
#include<xc.h>
#include<pic.h>
#include<pic16f877a.h>
#define CS RC0
// CONFIG
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = OFF // Brown-out Reset Enable bit (BOR disabled)
#pragma config LVP = OFF // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit
(RB3 is digital I/O, HV on MCLR must be used for programming)
#pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code
protection off)
#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all
program memory may be written to by EECON control)
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
#include <xc.h>
#include"Timer_0_delay.h"
#include<stdio.h>
#include<stdlib.h>
#include<pic.h>
#include<pic16f877a.h>
#include <xc.h>
#include <xc.h>
for(int i = 0;i<n;i++)
PORTC = 0xAA;
_delayTmr0_ms(50);
PORTC= ~ PORTC;
for(int i = 0;i<n;i++)
_delayTmr0_ms(50);
PORTC= ~ PORTC;
for(int i = 0;i<n;i++)
unsigned char a;
_delayTmr0_ms(50);
a =0x01;
PORTC = a;
a= (a << 1);
_delayTmr0_ms(50);
for(int i = 0;i<n;i++)
_delayTmr0_ms(100);
for(int i=0;i<8;i++)
_delayTmr0_ms(50);
{
unsigned char a,i;
a=0XFF;
PORTC=0XFF;
__delay_ms(50);
for(i=0;i<9;i++)
PORTC=a;
a=(a>>1)&0x7F;
__delay_ms(50);
for(int i = 0;i<n;i++)
_delayTmr0_ms(50);
k = 9;
for(int i = 0;i < 8 ; i++)
k--;
a = PORTC;
c = 0x01;
b = a;
a |= c;
PORTC = a;
_delayTmr0_ms(50);
a = b;
c = c<< 1;
void main(void)
Timer0_init();
TRISC = 0;
PORTC = 0;
while(1)
flash_duoi_2LED(25);
flash_8LED(10);
sang_duoi_1LED(5);
sang_duoi_vong(5);
sang_dan(5);
tat_dan(5);
sang_don(5);
+ Mô phỏng