Hallo zusammen,
ich hab grad irgendwie ein Denkproblem.
Wie kann ich folgendes elegant in einer Schleife ausdrücken?
1 | if(data & 0x80) //output '1'
|
2 | LCD_PORT |= (1<<SER);
|
3 | else //output '0'
|
4 | LCD_PORT &= ~(1<<SER);
|
5 | high_pulse_sck();
|
6 |
|
7 | if(data & 0x40) //output '1'
|
8 | LCD_PORT |= (1<<SER);
|
9 | else //output '0'
|
10 | LCD_PORT &= ~(1<<SER);
|
11 | high_pulse_sck();
|
12 |
|
13 | if(data & 0x20) //output '1'
|
14 | LCD_PORT |= (1<<SER);
|
15 | else //output '0'
|
16 | LCD_PORT &= ~(1<<SER);
|
17 | high_pulse_sck();
|
18 |
|
19 | if(data & 0x10) //output '1'
|
20 | LCD_PORT |= (1<<SER);
|
21 | else //output '0'
|
22 | LCD_PORT &= ~(1<<SER);
|
23 | high_pulse_sck();
|
Ich schäm mich jetzt schon, danke schonmal für eure Antworten,
Alex