Rev 543 | Rev 743 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 543 | Rev 723 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | 33 | ||
34 | 34 | ||
35 | int main(void) |
35 | int main(void) |
36 | { |
36 | { |
- | 37 | char i,Parity; // Bit-Counter and Parity Bit |
|
37 | char i,Parity; // Bit-Counter and Parity Bit |
38 | DDRA = 0b011; // PORT A INPUT: RESET; OUTPUT: Sync+Data |
38 | DDRA = 0b011; // PORT A INPUT: /RESET; OUTPUT: Sync+Data |
39 | DDRB = 0b00000000; // PORT B INPUT: Jumper for Bypass |
- | 40 | DDRD = 0b0000000; // PORT D INPUT: Switches + DX7-Sync |
|
39 | DDRD = 0b0000000; // PORT D INPUT: Switches + DX7-Sync |
41 | PORTA = 0b111; // Pull-Up for /RESET, High for Sync+Data |
Line 40... | Line 42... | ||
40 | PORTA = 0b111; // Pull-Up for /RESET; High for Sync+Data |
42 | PORTB = 0b01000000; // Pull-Up for Jumper |
41 | PORTD = 0b0011111; // Pull-Up for Switches |
43 | PORTD = 0b0011111; // Pull-Up for Switches |
42 | 44 | ||
- | 45 | while(1) // Main-Loop (Sending data all the time) |
|
- | 46 | { |
|
43 | while(1) // Main-Loop (Sending data all the time) |
47 | if (!(PINB & (1<<PINB6))) // By-Pass Mode |
Line -... | Line 48... | ||
- | 48 | { |
|
- | 49 | if (PIND & (1<<PIND0)) PORTA |= 1 << PORTA1; // A1=D0 |
|
- | 50 | else PORTA &= ~(1 << PORTA1); |
|
44 | { |
51 | |
45 | Parity = 0; // Reset Parity Bit |
52 | if (PIND & (1<<PIND1)) PORTA |= 1 << PORTA0; // A0=D1 |
46 | Send(1,0); // Send SYNC Pulse |
53 | else PORTA &= ~(1 << PORTA0); |
47 | - | ||
48 | for (i=0;i<5;i++) // Encode the first five Port Pins |
54 | } |
- | 55 | else // Normal Mode |
|
49 | { |
56 | { |
50 | if (PIND & (1<<i)) // Check Pin #i |
- | |
51 | { |
- | |
52 | Send(0,0); // When High, Send Low (Switched to "0") |
57 | Parity = 0; // Reset Parity Bit |
- | 58 | Send(1,0); // Send SYNC Pulse |
|
- | 59 | ||
- | 60 | for (i=0;i<5;i++) // Encode the first five Port Pins |
|
- | 61 | { |
|
- | 62 | if (PIND & (1<<i)) // Check Pin #i |
|
- | 63 | { |
|
- | 64 | Send(0,0); // When High, Send Low (Switched to "0") |
|
53 | Parity = ~Parity; // and invert Parity Bit |
65 | Parity = ~Parity; // and invert Parity Bit |
- | 66 | } |
|
54 | } |
67 | else |
55 | else |
- | |
Line 56... | Line 68... | ||
56 | { |
68 | { |
- | 69 | Send(0,1); // When Low, Send High (Switched to "1") |
|
57 | Send(0,1); // When Low, Send High (Switched to "1") |
70 | } |
Line 58... | Line 71... | ||
58 | } |
71 | } |