![]() |
[HELP] PIC 16f887 + 74HC595
1 Attachment(s)
Mấy anh chị xem giùm em đoạn code này sai chỗ nào giúp em:
Em muốn hiển thị 3 số lên 3 led 7 đoạn mà nó ko chạy. [CODE] #include <16f887.h> #device *=16 ADC=8 #use delay(clock=20000000) #fuses HS #define DATA PIN_D1 #define SCK PIN_D0 #define SCL PIN_D2 void truyen(); unsigned char ma[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x9 0}; void truyen(unsigned char tram, unsigned char chuc, unsigned dv) { unsigned Q,i,temp; Q=tram;for(i=0;i<8;i++){temp=(Q&0x80);if (temp==1)output_high(DATA);else output_low(DATA);output_low(SCK);output_high(SCK); Q<<=1;} Q=chuc;for(i=0;i<8;i++){temp=(Q&0x80);if (temp==1)output_high(DATA);else output_low(DATA);output_low(SCK);output_high(SCK); Q<<=1;} Q=dv; for(i=0;i<8;i++){temp=(Q&0x80);if (temp==1)output_high(DATA);else output_low(DATA);output_low(SCK);output_high(SCK); Q<<=1;} output_high(SCL);output_low(SCL); } void main() { while (true) { truyen(ma[5],ma[4],ma[8]); } } [CODE]/ mấy anh chị xem giúp em! |
Múi giờ GMT. Hiện tại là 10:26 AM. |
Tên diễn đàn: vBulletin Version 3.8.11
Được sáng lập bởi Đoàn Hiệp.
Copyright © PIC Vietnam