using System;
using System.Threading;
public class IOusb
{
USBIO usb;
public static void Main()
{
new IOusb().main();
}
public IOusb()
{
usb = new USBIO();
usb.Connect();
}
private void wait(int n)
{
for(int j=0; j<n; j++)
for(int i=0; i<1000; i++);
}
private void digit(byte n)
{
byte[] pattern =
// 0 1 2 3 4 5 6 7 8 9
{0x08,0x3b,0x14,0x11,0x23,0x41,0x40,0x1b,0x00,0x03 };
if(n>10)
usb.P1Write((byte)(pattern[n&0x7f]|0x80));
else
usb.P1Write(pattern[n]);
}
private void digitTwo(byte n)
{
byte high= (byte)(n/10);
byte low = (byte)(n%10);
for(int i=0; i<150; i++){
digit((byte)(high | 0x80));
wait(100);
digit(low);
wait(100);
}
}
public void main()
{
while(true){
for(byte i=0; i<100; i++) digitTwo(i);
}
}
}
|
1 7セグメントLEDはA-551SRDを用いる
2 アノードコモンである
3 AAAAAA
4 F B
5 F B
6 FGGGGB
7 E C
8 E C
9 EDDDDC
10
11 表示面から見ての接続
12 G F + A B
13
14 E D + C .
15
16 ポート1の対応表
17 7 6 5 4 3 2 1 0
18 x B A F G C D E
19
20
21
22 一桁表示ルーチン
23
24
25
26 数字と表示パターンの表
27
28
29 bit7が上位/下位のスイッチ
30
31
32
33 二桁表示ルーチン
34
35
36
37
38
39
40
41
42
43
44
45
46
47 00~99まで繰り返し表示
48
49
50
|