CHƯƠNG TRÌNH HOẠT ĐỘNG

Một phần của tài liệu Đồ án quang báo hiển thị led ma trận hình lập phương (Trang 46 - 61)

#INCLUDE <18F455.H>

#FUSES XT,NOWDT

#USE DELAY(CLOCK=4M)

#USE FAST_IO(B)

#USE FAST_IO(D)

#DEFINE CLEAR PIN_D4

Bất đầu Giải mã dữ liệu Vi điều khiển lấy dữ liệu

IC dịch lấy dữ liệu từ VĐK

Điều khiển khối led lập phương Kết thúc

begin

Khai bao bien

Khai bao khoi du lieu

Goi chuong trinh hien thi khoi led

END

#DEFINE RCK PIN_D6

#DEFINE DATA PIN_D7 INT8 CELL,LAYER,BIT,CHG;

INT1 VALUE;

VOID SHIFT_DATA();

VOID SCANNING();

VOID MAIN() {SET_TRIS_B(0);

OUTPUT_B(0);

SET_TRIS_D(0);

OUTPUT_D(0);

WHILE(TRUE)

{OUTPUT_LOW(CLEAR);

OUTPUT_HIGH(CLEAR);

OUTPUT_LOW(RCK);

FOR(CHG=0;CHG<=2;CHG++) {FOR(CELL=0;CELL<=32;CELL++) {SWITCH(CHG){

CASE 0:DELAY_MS(50);

FOR(LAYER=0;LAYER<=63;LAYER++) {SHIFT_DATA();

IF(LAYER==7) {OUTPUT_B(1);

SCANNING();}

IF(LAYER==15) {OUTPUT_B(2);

SCANNING();}

IF(LAYER==23) {OUTPUT_B(4);

SCANNING();}

IF(LAYER==31) {OUTPUT_B(8);

SCANNING();}

IF(LAYER==39) {OUTPUT_B(16);

SCANNING();}

IF(LAYER==47) {OUTPUT_B(32);

SCANNING();}

IF(LAYER==55) {OUTPUT_B(64);

SCANNING();}

IF(LAYER==63) {OUTPUT_B(128);

SCANNING();}}

BREAK;

CASE 1:DELAY_MS(1);

FOR(LAYER=0;LAYER<=63;LAYER++) {SHIFT_DATA();

IF(LAYER==7) {OUTPUT_B(1);

SCANNING();}

IF(LAYER==15) {OUTPUT_B(2);

SCANNING();}

IF(LAYER==23) {OUTPUT_B(4);

SCANNING();}

IF(LAYER==31) {OUTPUT_B(8);

SCANNING();}

IF(LAYER==39) {OUTPUT_B(16);

SCANNING();}

IF(LAYER==47) {OUTPUT_B(32);

SCANNING();}

IF(LAYER==55) {OUTPUT_B(64);

SCANNING();}

IF(LAYER==63) {OUTPUT_B(128);

SCANNING();}}

BREAK;

CASE 2:DELAY_US(50);

FOR(LAYER=0;LAYER<=63;LAYER++) {SHIFT_DATA();

IF(LAYER==7) {OUTPUT_B(1);

SCANNING();}

IF(LAYER==15) {OUTPUT_B(2);

SCANNING();}

IF(LAYER==23) {OUTPUT_B(4);

SCANNING();}

IF(LAYER==31) {OUTPUT_B(8);

SCANNING();}

IF(LAYER==39) {OUTPUT_B(16);

SCANNING();}

IF(LAYER==47) {OUTPUT_B(32);

SCANNING();}

IF(LAYER==55) {OUTPUT_B(64);

SCANNING();}

IF(LAYER==63) {OUTPUT_B(128);

SCANNING();}}

BREAK;

}}}}}

VOID SCANNING() {OUTPUT_HIGH(RCK);

DELAY_US(50);

OUTPUT_LOW(RCK);

OUTPUT_LOW(CLEAR);

OUTPUT_HIGH(CLEAR);}

VOID SHIFT_DATA()

{ INT8 CONST DATA_0[]={

0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 0X00,0X00,0X00,0X00,0X00,0X80,0X40,0X20 0X00,0X00,0X00,0X80,0X40,0X20,0X10,0X08 0X00,0X80,0X40,0X20,0X10,0X08,0X04,0X02 0X40,0X20,0X10,0X08,0X04,0X02,0X01,0X00 0X10,0X08,0X04,0X02,0X01,0X00,0X00,0X00 0X04,0X02,0X01,0X00,0X00,0X00,0X00,0X00

0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00 };//W2V3 INT8 CONST DATA_1[]={

0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 0X00,0X00,0X00,0X00,0X00,0X80,0X40,0X20 0X00,0X00,0X00,0X80,0X40,0X20,0X10,0X08 0X00,0X80,0X40,0X20,0X10,0X08,0X04,0X02 0X40,0X20,0X10,0X08,0X04,0X02,0X01,0X00 0X10,0X08,0X04,0X02,0X01,0X00,0X00,0X00 0X04,0X02,0X01,0X00,0X00,0X00,0X00,0X00 };

INT8 CONST DATA_2[]={

0X04,0X02,0X01,0X00,0X00,0X00,0X00,0X00 0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 0X00,0X00,0X00,0X00,0X00,0X80,0X40,0X20 0X00,0X00,0X00,0X80,0X40,0X20,0X10,0X08 0X00,0X80,0X40,0X20,0X10,0X08,0X04,0X02 0X40,0X20,0X10,0X08,0X04,0X02,0X01,0X00 0X10,0X08,0X04,0X02,0X01,0X00,0X00,0X00 };

INT8 CONST DATA_3[]={

0X10,0X08,0X04,0X02,0X01,0X00,0X00,0X00 0X04,0X02,0X01,0X00,0X00,0X00,0X00,0X00 0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 0X00,0X00,0X00,0X00,0X00,0X80,0X40,0X20 0X00,0X00,0X00,0X80,0X40,0X20,0X10,0X08 0X00,0X80,0X40,0X20,0X10,0X08,0X04,0X02 0X40,0X20,0X10,0X08,0X04,0X02,0X01,0X00 };

INT8 CONST DATA_4[]={

0X40,0X20,0X10,0X08,0X04,0X02,0X01,0X00 0X10,0X08,0X04,0X02,0X01,0X00,0X00,0X00 0X04,0X02,0X01,0X00,0X00,0X00,0X00,0X00 0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 0X00,0X00,0X00,0X00,0X00,0X80,0X40,0X20 0X00,0X00,0X00,0X80,0X40,0X20,0X10,0X08 0X00,0X80,0X40,0X20,0X10,0X08,0X04,0X02 };

INT8 CONST DATA_5[]={

0X00,0X80,0X40,0X20,0X10,0X08,0X04,0X02 0X40,0X20,0X10,0X08,0X04,0X02,0X01,0X00 0X10,0X08,0X04,0X02,0X01,0X00,0X00,0X00 0X04,0X02,0X01,0X00,0X00,0X00,0X00,0X00 0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 0X00,0X00,0X00,0X00,0X00,0X80,0X40,0X20 0X00,0X00,0X00,0X80,0X40,0X20,0X10,0X08 };

INT8 CONST DATA_6[]={

0X00,0X00,0X00,0X80,0X40,0X20,0X10,0X08 0X00,0X80,0X40,0X20,0X10,0X08,0X04,0X02 0X40,0X20,0X10,0X08,0X04,0X02,0X01,0X00 0X10,0X08,0X04,0X02,0X01,0X00,0X00,0X00 0X04,0X02,0X01,0X00,0X00,0X00,0X00,0X00 0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 0X00,0X00,0X00,0X00,0X00,0X80,0X40,0X20 };

INT8 CONST DATA_7[]={

0X00,0X00,0X00,0X00,0X00,0X80,0X40,0X20 0X00,0X00,0X00,0X80,0X40,0X20,0X10,0X08 0X00,0X80,0X40,0X20,0X10,0X08,0X04,0X02 0X40,0X20,0X10,0X08,0X04,0X02,0X01,0X00 0X10,0X08,0X04,0X02,0X01,0X00,0X00,0X00 0X04,0X02,0X01,0X00,0X00,0X00,0X00,0X00 0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 };

INT8 CONST DATA_8[]={

0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 0X00,0X00,0X00,0X00,0X00,0X80,0X40,0X20 0X00,0X00,0X00,0X80,0X40,0X20,0X10,0X08 0X00,0X80,0X40,0X20,0X10,0X08,0X04,0X02 0X40,0X20,0X10,0X08,0X04,0X02,0X01,0X00 0X10,0X08,0X04,0X02,0X01,0X00,0X00,0X00 0X04,0X02,0X01,0X00,0X00,0X00,0X00,0X00 0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00 };

INT8 CONST DATA_9[]={

0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 0X00,0X00,0X00,0X00,0X00,0X80,0X40,0XA0 0X00,0X00,0X00,0X80,0X40,0XA0,0X50,0X28 0X00,0X80,0X40,0XA0,0X50,0X28,0X14,0X0A 0X40,0XA0,0X50,0X28,0X14,0X0A,0X05,0X02 0X50,0X28,0X14,0X0A,0X05,0X02,0X01,0X00 0X14,0X0A,0X05,0X02,0X01,0X00,0X00,0X00 0X05,0X02,0X01,0X00,0X00,0X00,0X00,0X00 };

INT8 CONST DATA_10[]={

0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 0X00,0X00,0X00,0X00,0X00,0X80,0X40,0XA0 0X00,0X00,0X00,0X80,0X40,0XA0,0X50,0XA8 0X00,0X80,0X40,0XA0,0X50,0XA8,0X54,0X2A 0X40,0XA0,0X50,0XA8,0X54,0X2A,0X15,0X0A 0X50,0XA8,0X54,0X2A,0X15,0X0A,0X05,0X02 0X54,0X2A,0X15,0X0A,0X05,0X02,0X01,0X00 0X15,0X0A,0X05,0X02,0X01,0X00,0X00,0X00 };

INT8 CONST DATA_11[]={

0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 0X00,0X00,0X00,0X00,0X00,0X80,0X40,0XA0 0X00,0X00,0X00,0X80,0X40,0XA0,0X50,0XA8 0X00,0X80,0X40,0XA0,0X50,0XA8,0X54,0XAA 0X40,0XA0,0X50,0XA8,0X54,0XAA,0X55,0X2A 0X50,0XA8,0X54,0XAA,0X55,0X2A,0X15,0X0A 0X54,0XAA,0X55,0X2A,0X15,0X0A,0X05,0X02 0X55,0X2A,0X15,0X0A,0X05,0X02,0X01,0X00 };

INT8 CONST DATA_12[]={

0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80 0X00,0X00,0X00,0X00,0X00,0X80,0X40,0XA0 0X00,0X00,0X00,0X80,0X40,0XA0,0X50,0XA8 0X00,0X80,0X40,0XA0,0X50,0XA8,0X54,0XAA 0X40,0XA0,0X50,0XA8,0X54,0XAA,0X55,0XAA 0X50,0XA8,0X54,0XAA,0X55,0XAA,0X55,0X2A 0X54,0XAA,0X55,0XAA,0X55,0X2A,0X15,0X0A 0X55,0XAA,0X55,0X2A,0X15,0X0A,0X05,0X02 };

INT8 CONST DATA_13[]={

0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80

0X00,0X00,0X00,0X00,0X00,0X80,0X40,0XA0 0X00,0X00,0X00,0X80,0X40,0XA0,0X50,0XA8 0X00,0X80,0X40,0XA0,0X50,0XA8,0X54,0XAA 0X40,0XA0,0X50,0XA8,0X54,0XAA,0X55,0XAA 0X50,0XA8,0X54,0XAA,0X55,0XAA,0X55,0XAA 0X54,0XAA,0X55,0XAA,0X55,0XAA,0X55,0X2A 0X55,0XAA,0X55,0XAA,0X55,0X2A,0X15,0X0A };

INT8 CONST DATA_14[]={

0X00,0X00,0X00,0X00,0X00,0X80,0X40,0XA0 0X00,0X00,0X00,0X80,0X40,0XA0,0X50,0XA8 0X00,0X80,0X40,0XA0,0X50,0XA8,0X54,0XAA 0X40,0XA0,0X50,0XA8,0X54,0XAA,0X55,0XAA 0X50,0XA8,0X54,0XAA,0X55,0XAA,0X55,0XAA 0X54,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA };

INT8 CONST DATA_15[]={

0X00,0X00,0X00,0X80,0X40,0XA0,0X50,0XA8 0X00,0X80,0X40,0XA0,0X50,0XA8,0X54,0XAA 0X40,0XA0,0X50,0XA8,0X54,0XAA,0X55,0XAA 0X50,0XA8,0X54,0XAA,0X55,0XAA,0X55,0XAA 0X54,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA };

INT8 CONST DATA_16[]={

0X00,0X80,0X40,0XA0,0X50,0XA8,0X54,0XAA 0X40,0XA0,0X50,0XA8,0X54,0XAA,0X55,0XAA 0X50,0XA8,0X54,0XAA,0X55,0XAA,0X55,0XAA 0X54,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA };

INT8 CONST DATA_17[]={

0X40,0XA0,0X50,0XA8,0X54,0XAA,0X55,0XAA 0X50,0XA8,0X54,0XAA,0X55,0XAA,0X55,0XAA 0X54,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA };

INT8 CONST DATA_18[]={

0X50,0XA8,0X54,0XAA,0X55,0XAA,0X55,0XAA 0X54,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA

0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA };

INT8 CONST DATA_19[]={

0X54,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA };

INT8 CONST DATA_20[]={

0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA 0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA };

INT8 CONST DATA_21[]={

0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0XAA,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 };

INT8 CONST DATA_22[]={

0X00,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X55,0XAA,0X55,0XAA,0X55,0XAA,0X55 };

INT8 CONST DATA_23[]={

0X00,0X00,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0XAA,0X55,0XAA,0X55,0XAA,0X55

0X00,0X00,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0XAA,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0XAA,0X55,0XAA,0X55,0XAA,0X55 };

INT8 CONST DATA_24[]={

0X00,0X00,0X00,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X55,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X55,0XAA,0X55,0XAA,0X55 };

INT8 CONST DATA_25[]={

0X00,0X00,0X00,0X00,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X00,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X00,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X00,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X00,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X00,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X00,0XAA,0X55,0XAA,0X55 0X00,0X00,0X00,0X00,0XAA,0X55,0XAA,0X55 };

INT8 CONST DATA_26[]={

0X00,0X00,0X00,0X00,0X2A,0X55,0X2A,0X55 0X00,0X00,0X00,0X00,0X2A,0X55,0X2A,0X55 0X00,0X00,0X00,0X00,0X2A,0X55,0X2A,0X55 0X00,0X00,0X00,0X00,0X2A,0X55,0X2A,0X55 0X00,0X00,0X00,0X00,0X2A,0X55,0X2A,0X55 0X00,0X00,0X00,0X00,0X2A,0X55,0X2A,0X55 0X00,0X00,0X00,0X00,0X2A,0X55,0X2A,0X55 0X00,0X00,0X00,0X00,0X2A,0X55,0X2A,0X55 };

INT8 CONST DATA_27[]={

0X00,0X00,0X00,0X00,0X2A,0X15,0X2A,0X15 0X00,0X00,0X00,0X00,0X2A,0X15,0X2A,0X15 0X00,0X00,0X00,0X00,0X2A,0X15,0X2A,0X15 0X00,0X00,0X00,0X00,0X2A,0X15,0X2A,0X15 0X00,0X00,0X00,0X00,0X2A,0X15,0X2A,0X15 0X00,0X00,0X00,0X00,0X2A,0X15,0X2A,0X15 0X00,0X00,0X00,0X00,0X2A,0X15,0X2A,0X15 0X00,0X00,0X00,0X00,0X2A,0X15,0X2A,0X15 };

INT8 CONST DATA_28[]={

0X00,0X00,0X00,0X00,0X0A,0X15,0X0A,0X15 0X00,0X00,0X00,0X00,0X0A,0X15,0X0A,0X15 0X00,0X00,0X00,0X00,0X0A,0X15,0X0A,0X15 0X00,0X00,0X00,0X00,0X0A,0X15,0X0A,0X15

0X00,0X00,0X00,0X00,0X0A,0X15,0X0A,0X15 0X00,0X00,0X00,0X00,0X0A,0X15,0X0A,0X15 0X00,0X00,0X00,0X00,0X0A,0X15,0X0A,0X15 0X00,0X00,0X00,0X00,0X0A,0X15,0X0A,0X15 };

INT8 CONST DATA_29[]={

0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X05 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X05 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X05 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X05 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X05 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X05 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X05 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X05 };

INT8 CONST DATA_30[]={

0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X04 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X04 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X04 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X04 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X04 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X04 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X04 0X00,0X00,0X00,0X00,0X0A,0X05,0X0A,0X04 };

INT8 CONST DATA_31[]={

0X00,0X00,0X00,0X00,0X0A,0X04,0X08,0X00 0X00,0X00,0X00,0X00,0X0A,0X04,0X08,0X00 0X00,0X00,0X00,0X00,0X0A,0X04,0X08,0X00 0X00,0X00,0X00,0X00,0X0A,0X04,0X08,0X00 0X00,0X00,0X00,0X00,0X0A,0X04,0X08,0X00 0X00,0X00,0X00,0X00,0X0A,0X04,0X08,0X00 0X00,0X00,0X00,0X00,0X0A,0X04,0X08,0X00 0X00,0X00,0X00,0X00,0X0A,0X04,0X08,0X00 };

INT8 CONST DATA_32[]={

0X00,0X00,0X00,0X00,0X08,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X08,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X08,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X08,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X08,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X08,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X08,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X08,0X00,0X00,0X00 };

SWITCH(CELL)

{CASE 0:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_0[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 1:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_1[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 2:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_2[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 3:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_3[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 4:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_4[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 5:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_5[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 6:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_6[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 7:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_7[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 8:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_8[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 9:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_9[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 10:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_10[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 11:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_11[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 12:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_12[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 13:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_13[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 14:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_14[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 15:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_15[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 16:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_16[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 17:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_17[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 18:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_18[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 19:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_19[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 20:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_20[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 21:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_21[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 22:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_22[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 23:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_23[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 24:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_24[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 25:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_25[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 26:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_26[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 27:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_27[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 28:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_28[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 29:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_29[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 30:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_30[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 31:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_31[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

CASE 32:FOR(BIT=8;BIT>=1;BIT--)

{VALUE=BIT_TEST(DATA_32[LAYER],BIT-1);

OUTPUT_BIT(DATA,VALUE);

OUTPUT_HIGH(CLOCK);

OUTPUT_LOW(CLOCK);}

BREAK;

}}

CHƯƠNG VI

Một phần của tài liệu Đồ án quang báo hiển thị led ma trận hình lập phương (Trang 46 - 61)

Tải bản đầy đủ (DOC)

(63 trang)
w