Help code C not build

void LED_update() //cập nhật dữ liệu hiển thị ra bảng LED
{
for(int line_height=0;line_height<ScanMode;line_height++)
{
int count=0;
for(int i=0;i<4;i++)
{
for(int index=0;index<2;index++)
{
for(int bit_pos=0;bit_pos<8;bit_pos++)
{
buff_GPIO[line_height][count]=0;
if((buffer_display[0][ line_height][i*2+index] & mask_bit_8S[bit_pos]) != 0)buff_GPIO[line_height][count]|=BR1; //tính data cho nửa panel trên
if((buffer_display[1][ line_height][i*2+index] & mask_bit_8S[bit_pos]) != 0)buff_GPIO[line_height][count]|=BG1;
if((buffer_display[2][ line_height][i*2+index] & mask_bit_8S[bit_pos]) != 0)buff_GPIO[line_height][count]|=BB1;
if((buffer_display[0][16+line_height][i*2+index] & mask_bit_8S[bit_pos]) != 0)buff_GPIO[line_height][count]|=BR2; //tính data cho nửa panel dưới
if((buffer_display[1][16+line_height][i*2+index] & mask_bit_8S[bit_pos]) != 0)buff_GPIO[line_height][count]|=BG2;
if((buffer_display[2][16+line_height][i*2+index] & mask_bit_8S[bit_pos]) != 0)buff_GPIO[line_height][count]|=BB2;
count++;
}
}

Read this, then format your post.
https://www.cplusplus.com/articles/jEywvCM9/

Then maybe provide a log of your error messages, not "it doesn't build" as a topic title.
Once you have formatted your code properly as salem c suggested you will see that you miss a few closing braces.
Hello damtran2509,


PLEASE ALWAYS USE CODE TAGS (the <> formatting button), to the right of this box, when posting code.

Along with the proper indenting it makes it easier to read your code and also easier to respond to your post.

http://www.cplusplus.com/articles/jEywvCM9/
http://www.cplusplus.com/articles/z13hAqkS/

Hint: You can edit your post, highlight your code and press the <> formatting button. This will not automatically indent your code. That part is up to you.

You can use the preview button at the bottom to see how it looks.

I found the second link to be the most help.



With proper indenting and a few blank lines this is much easier to read:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
void LED_update() //cập nhật dữ liệu hiển thị ra bảng LED
{
    for (int line_height = 0; line_height < ScanMode; line_height++)
    {
        int count = 0;

        for (int i = 0; i < 4; i++)
        {
            for (int index = 0; index < 2; index++)
            {
                for (int bit_pos = 0; bit_pos < 8; bit_pos++)
                {
                    buff_GPIO[line_height][count] = 0;

                    if ((buffer_display[0][line_height][i * 2 + index] & mask_bit_8S[bit_pos]) != 0)
                        buff_GPIO[line_height][count] |= BR1; //tính data cho nửa panel trên

                    if ((buffer_display[1][line_height][i * 2 + index] & mask_bit_8S[bit_pos]) != 0)
                        buff_GPIO[line_height][count] |= BG1;

                    if ((buffer_display[2][line_height][i * 2 + index] & mask_bit_8S[bit_pos]) != 0)
                        buff_GPIO[line_height][count] |= BB1;

                    if ((buffer_display[0][16 + line_height][i * 2 + index] & mask_bit_8S[bit_pos]) != 0)
                        buff_GPIO[line_height][count] |= BR2; //tính data cho nửa panel dưới

                    if ((buffer_display[1][16 + line_height][i * 2 + index] & mask_bit_8S[bit_pos]) != 0)
                        buff_GPIO[line_height][count] |= BG2;

                    if ((buffer_display[2][16 + line_height][i * 2 + index] & mask_bit_8S[bit_pos]) != 0)
                        buff_GPIO[line_height][count] |= BB2;

                    count++;
                }
            }

This makes it much easier to see that you are missing some closing }s.

Andy

Edit typo:
Last edited on
Topic archived. No new replies allowed.