TỰ ĐỘNG ĐIỀU KHIỂN - TỰ ĐỘNG HÓA
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.

giup em ve chuong trinh ccs

2 posters

Go down

giup em ve chuong trinh ccs Empty giup em ve chuong trinh ccs

Bài gửi  gaonljne0809 Fri Dec 16, 2011 8:36 pm

thua thay hom nay em viet chuong trinh dem sp hien thi led 7 doan.ko hieu sao bt thi led ko sang het 4 con.khi co sp di qua thi led moi sang du 4 con dong thoi so san pham tang len 1.day la code cua em.


#include <16f877a.h>
#fuses nowdt,noprotect,nolvp,xt,put
#use delay(clock=4000000)
#use fast_io(a)
#use fast_io(b)
#use fast_io(c)
#use fast_io(d)
#byte porta=0x05
#byte portb=0x06
#byte portc=0x07
#byte portd=0x08
#bit a4=porta.4
unsigned char spch=0,spdv=0,tch=0,tdv=0,i=0,j=0,w=0;
const unsigned char led7[]={0b11000000, 0b11111001, 0b10100100, 0b10110000, 0b10011001,\
0b10010010, 0b10000010, 0b11111000, 0b10000000, 0b10010000};
void tach_so();
void quet_led();
void kt();

void main()
{ set_tris_a(0b11111);
set_tris_b(0);
set_tris_c(0b0000);
while(1)
{kt();
tach_so();
quet_led();
}}

void kt()
{
if (a4==0)
{while(a4==0)
{}
i++;
if(i==12)
{i=0;
j++;
}
tach_so();
quet_led();
}}

void tach_so()
{
spch=i/10;
spdv=i%10;
tch=j/10;
tdv=j%10;
}
void quet_led()
{
for (w=1;w<=50;++w)
{
portc=(0b1110);
portb=led7[spch];
delay_ms(5);

portc=(0b1101);
portb=led7[spdv];
delay_ms(5);

portc=(0b1011);
portb=led7[tch];
delay_ms(5);

portc=(0b0111);
portb=led7[tdv];
delay_ms(5);
}
}

gaonljne0809

Tổng số bài gửi : 5
Join date : 04/10/2011
Age : 33
Đến từ : bến tre

http://idgunny.zing.vn

Về Đầu Trang Go down

giup em ve chuong trinh ccs Empty Re: giup em ve chuong trinh ccs

Bài gửi  admin Sun Dec 18, 2011 9:56 pm

gaonljne0809 đã viết:thua thay hom nay em viet chuong trinh dem sp hien thi led 7 doan.ko hieu sao bt thi led ko sang het 4 con.khi co sp di qua thi led moi sang du 4 con dong thoi so san pham tang len 1.day la code cua em.


#include <16f877a.h>
#fuses nowdt,noprotect,nolvp,xt,put
#use delay(clock=4000000)
#use fast_io(a)
#use fast_io(b)
#use fast_io(c)
#use fast_io(d)
#byte porta=0x05
#byte portb=0x06
#byte portc=0x07
#byte portd=0x08
#bit a4=porta.4
unsigned char spch=0,spdv=0,tch=0,tdv=0,i=0,j=0,w=0;
const unsigned char led7[]={0b11000000, 0b11111001, 0b10100100, 0b10110000, 0b10011001,\
0b10010010, 0b10000010, 0b11111000, 0b10000000, 0b10010000};
void tach_so();
void quet_led();
void kt();

void main()
{ set_tris_a(0b11111);
set_tris_b(0);
set_tris_c(0b0000);
while(1)
{kt();
tach_so();
quet_led();
}}

void kt()
{
if (a4==0)
{while(a4==0)
{}
i++;
if(i==12)
{i=0;
j++;
}
tach_so();
quet_led();
}}

void tach_so()
{
spch=i/10;
spdv=i%10;
tch=j/10;
tdv=j%10;
}
void quet_led()
{
for (w=1;w<=50;++w)
{
portc=(0b1110);
portb=led7[spch];
delay_ms(5);

portc=(0b1101);
portb=led7[spdv];
delay_ms(5);

portc=(0b1011);
portb=led7[tch];
delay_ms(5);

portc=(0b0111);
portb=led7[tdv];
delay_ms(5);
}
}
Em them vao chuong trinh
portc=(0b1011);
portb=led7[tch];
delay_ms(5);
portb=(ob11111111);
tuong tu cho cac doan con lai

admin
Admin

Tổng số bài gửi : 46
Join date : 06/03/2011

https://dktd.forumvi.com

Về Đầu Trang Go down

giup em ve chuong trinh ccs Empty Re: giup em ve chuong trinh ccs

Bài gửi  gaonljne0809 Sun Dec 18, 2011 11:11 pm

da em cam on thay

gaonljne0809

Tổng số bài gửi : 5
Join date : 04/10/2011
Age : 33
Đến từ : bến tre

http://idgunny.zing.vn

Về Đầu Trang Go down

giup em ve chuong trinh ccs Empty Re: giup em ve chuong trinh ccs

Bài gửi  Sponsored content


Sponsored content


Về Đầu Trang Go down

Về Đầu Trang

- Similar topics

 
Permissions in this forum:
Bạn không có quyền trả lời bài viết