Go Down

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

#### ludocraft

##### Jan 15, 2020, 12:17 pm

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

#1
##### Jan 15, 2020, 12:47 pm
no one to help me ??; (
i am un gros noob

#### TheMemberFormerlyKnownAsAWOL

#2
##### Jan 15, 2020, 01:48 pm
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

#3
##### Jan 15, 2020, 02:05 pm
One way:

Code: [Select]
`byte    var = 0b10101010;for( int i=1; i<9; i++ ){    Write_Max7219( i, var );    var ^= 0b11111111;    }//for`

#### TheMemberFormerlyKnownAsAWOL

#4
##### Jan 15, 2020, 02:13 pm
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

#5
##### Jan 15, 2020, 04:50 pm
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

#6
##### Jan 15, 2020, 05:05 pm
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

#7
##### Jan 15, 2020, 06:21 pm

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

i am un gros noob

Go Up