Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
LLamabob
Level 1
Level 1
First question asked 5 sign-ins Welcome!

Hello,

I've got a DAVE project with the XMC1400.     My main.c file is about 500 lines long and growing.  I'm wanting to try to organize my code, by creating additional  .c files such as ADC.c, ScanInputs.c, etc.     

Is there a way to add multiple files, to the code?   

I tried creating a file and adding '#include "DAVE.h"'  at the top, and tried moving some of my code there and got an error.   

Thanks,
Bob 

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Owen_Su
Moderator
Moderator
Moderator
250 solutions authored 500 replies posted 50 likes received

Hi, @LLamabob ,

    You can follow the steps below: (I take 'XMC13_I2C' as an example)

1) click 'Project Explorer';

Owen_Su_0-1661320902105.png

2) right click project 'XMC13_I2C', and then click 'new -- folder', here I added a folder IIC into the project;

Owen_Su_1-1661321093387.png

3) then right click 'IIC', choose 'New -- Source file/header file'. After finished this, move the codes to IIC. c.

Owen_Su_2-1661321392643.png

4) when you want to use the functions in IIC. c, you need to include this header in your codes.

    I think that maybe you lost some headers and then got an error, you can follow the example below and rebuilt your codes. Hope this can help you, please let me know if you have any other questions?

Regards,

Owen_Su

View solution in original post

0 Likes
1 Reply
lock attach
Attachments are accessible only for community members.
Owen_Su
Moderator
Moderator
Moderator
250 solutions authored 500 replies posted 50 likes received

Hi, @LLamabob ,

    You can follow the steps below: (I take 'XMC13_I2C' as an example)

1) click 'Project Explorer';

Owen_Su_0-1661320902105.png

2) right click project 'XMC13_I2C', and then click 'new -- folder', here I added a folder IIC into the project;

Owen_Su_1-1661321093387.png

3) then right click 'IIC', choose 'New -- Source file/header file'. After finished this, move the codes to IIC. c.

Owen_Su_2-1661321392643.png

4) when you want to use the functions in IIC. c, you need to include this header in your codes.

    I think that maybe you lost some headers and then got an error, you can follow the example below and rebuilt your codes. Hope this can help you, please let me know if you have any other questions?

Regards,

Owen_Su

0 Likes