Übersetzungsfrage

OP #1322558
Lesenswert?

Hallo.

Welche übersetzung ist richtig ?

Orginal CodeVision:
1
void sendData(int colors[][drivers])
2
{
3
 int i,j;
4
 CS = 0;
5
 
6
 for (i=15;i>0;i--)
7
 {
8
   for (j=drivers-1;j>=0;j--)
9
    {
10
     MOSI = (colors[i][j] & 0b1000000000000000) >> 15;
11
     SCLK = 1;
12
     SCLK = 0;
13
     MOSI = (colors[i][j] & 0b0100000000000000) >> 14;
14
     SCLK = 1;
15
     SCLK = 0;
16
....

ist diese Übersetztung richtig für gcc ?
1
void sendData(int colors[][drivers])
2
{
3
 int i,j;
4
 CS = 0;
5
 
6
 for (i=15;i>0;i--)
7
 {
8
   for (j=drivers-1;j>=0;j--)
9
    {
10
     if (colors[i][j] & 0b1000000000000000) PORT_MOSI |= (1<<MOSI);
11
     else PORT_MOSI &= ~(1<<MOSI);
12
     PORT_SCLK |= (1<<SCLK);
13
     PORT_SCLK &= ~(1<<SCLK);
14

15
     if (colors[i][j] & 0b0100000000000000) PORT_MOSI |= (1<<MOSI);
16
     else PORT_MOSI &= ~(1<<MOSI);
17
     PORT_SCLK |= (1<<SCLK);
18
     PORT_SCLK &= ~(1<<SCLK);
19
....


Vielen Dank, Markus
Gast #1322674
Lesenswert?

Wahrscheinlich ist ja meine Methode viel zu grobschlächtig und ich bitte 
vielmals um Verzeihung, das ich auf eine ausschliessliche 
Brain-Compilierung im Zusammenhang mit dem Brain-Modell Deiner, von 
meiner Glaskugel ermittelten Schaltung zurückgreife, aber was wäre mit 
AUSPROBIEREN?

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren