Other Parts Discussed in Thread: C2000WARE, LAUNCHXL-F28379D
Tool/software: Code Composer Studio
1)how can we convert the presiding dac_sine example inorder to generate a triangular wave
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
1)how can we convert the presiding dac_sine example inorder to generate a triangular wave
You cannot use the preprocessor directives `#if`, `#elif`in this context, as these conditions can only be based on compile-time information such as #define constants. You can simply use regular `if` and `else` conditions here.
Your should also modify your code to avoid integer division, when calculating the values to fill the table with.
Best regards,
Ryan Voogjarv
That code is still yielding incorrect values due to integer division.
Specifically, over your range of values for `j`, `((j-180)/180)` will only ever equal -1 or 0. `((180-j)/180)` will only ever equal 0.
You may also wish to read C2000 Fundamentals Workshop for CCSv7 to for a quick tutorial on how to use breakpoints to debug and inspect the behaviour of your code. This workshop is written for the F28379D LaunchPad (LAUNCHXL-F28379D), but the procedure should be nearly identical for your board.
Best regards,
Ryan Voogjarv