Go Down

Topic: optimization 2 (Read 111 times) previous topic - next topic

ludocraft


Hello
after a request on a previous post to know how to optimize

Code: [Select]

Write_Max7219(1, B00000000)
Write_Max7219(2, B00000000)
Write_Max7219(3, B00000000)
Write_Max7219(4, B00000000)
Write_Max7219(5, B00000000)
Write_Max7219(6, B00000000)
Write_Max7219(7, B00000000)
Write_Max7219(8, B00000000)


in

Code: [Select]

for (int f =1; f <8; f++){
Write_Max7219(f, 0);
}


i want to try to optimize

Code: [Select]

Write_Max7219(1, B10101010)
Write_Max7219(2, B01010101)
Write_Max7219(3, B10101010)
Write_Max7219(4, B01010101)
Write_Max7219(5, B10101010)
Write_Max7219(6, B01010101)
Write_Max7219(7, B10101010)
Write_Max7219(8, B01010101)




can you tell me if it's possible
optimize all its with the for command

the lines 1 , 3 , 5 , 7

and 2 ,  4 , 6 , 8

bring them together
in 2 command for different
i am un gros noob

ludocraft

no one to help me ??; (
i am un gros noob

TheMemberFormerlyKnownAsAWOL

Code: [Select]
for (int f =1; f <8; f++){Oops
Please don't PM technical questions - post them on the forum, then everyone benefits/suffers equally

Blackfin

One way:

Code: [Select]
byte
    var = 0b10101010;

for( int i=1; i<9; i++ )
{
    Write_Max7219( i, var );
    var ^= 0b11111111;
   
}//for

TheMemberFormerlyKnownAsAWOL

can you tell me if it's possible
optimize all its with the for command

the lines 1 , 3 , 5 , 7

and 2 ,  4 , 6 , 8

bring them together
in 2 command for different

Yes. Simple arithmetic.
Please don't PM technical questions - post them on the forum, then everyone benefits/suffers equally

gfvalvo

no one to help me ??; (
@ludocraft, you posted this bump only 30 Minutes after your original post. Are you freaking kidding?
No technical questions via PM. They will be ignored. Post your questions in the forum so that all may learn.

Paul_KD7HB

I don't think you have ever told us your goal for optimization.

Are wanting to minimize the size of you source code text file?
Are you wanting to minimize the number of compiled instructions?
Are you wanting to increase the speed of execution of your program?
Are you wanting to minimize the memory size of your compiled program?

Just curious.

Paul

ludocraft


yes reduce the size of the text and reduce the size of the memory

i am un gros noob

Go Up