32*16ドットLEDマトリックス表示
ピン番号 | 信号名 | 意味 | ピン番号 | 信号名 | 意味 |
1 | LED_PWR | LED用電源 | 6 | LATCH | データ保持 |
2 | SIN1 | 行選択信号 | 7 | STROBE | LでLED点灯 |
3 | SIN2 | 左LEDデータ | 8 | IC_PWR | 制御用電源 |
4 | SIN3 | 右LEDデータ | 9 | GND | 電源GND |
5 | CLOCK | データ用クロック | 10 | GND | 電源GND |
#include <16F873A.h> #fuses HS,NOWDT,NOLVP,NOPROTECT #use delay(CLOCK=20000000) //クロック20MHz //主要なピン 回路を変えたらここも書き換えること #define cs1 PIN_C5 #define cs2 PIN_C6 #define cs3 PIN_C7 #define strobe PIN_B0 #define latch PIN_B1 #define clock PIN_B2 //R4,R5に1kの抵抗 //R1,R2は短絡 //CN1A、CN2A端子表 //1 LED_PWR 電源 //2 SIN1 縦(行選択)データ //3 SIN2 LED1行データ //4 SIN3 LED2行データ //5 CLOCK 立ち上がりでSIN1,2,3のデータ取り込み //6 LATCH 0で出力、1で保持 //7 STROBE 0で点灯 //8 IC_PWR IC電源 //9 GND //10 GND unsigned int16 OP1 = 0x8000;//左表示データ //long OP2 = 0xCC01; unsigned int16 OP3 = 0xF0C3;//右表示データ unsigned int16 OP2 =0xC3A5; int i,j,k; long lc; long li; unsigned int16 P0,P1,P2,P3; void main(){ //クロック初期化 P3=0; output_low(clock); output_low(strobe); output_high(latch); P2=P3=0; while(1){ lc=0; for(i = 0; i < 16; i++){ P1 = 0; bit_set(P1,i); li=i; P2 = i+(li<<4)+(li<<8)+(li<<12); P3 = i+(li<<4)+(li<<8)+(li<<12); //1行を送る for(j = 0; j < 16; j++){ output_bit(cs1,bit_test(P1, j)); output_bit(cs2,bit_test(P2, j)); output_bit(cs3,bit_test(P3, j)); output_high(clock); output_low(clock); }//for j //latch output_toggle(PIN_C0); output_low(latch); output_high(latch); //OP1= OP1>>1; delay_ms(1); }//for i // delay_ms(100); }//while }