- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello, I am using psoc 5lp cy8ckit-059 prototyping kit. I am planning to create a project that can switch to 3 different circuit designs/ modes which I have designed in separate projects as in attachment. Is there any methods to do this or should I just need to only use one project that combine the circuit to do this?
Solved! Go to Solution.
- Labels:
-
ispn:39618:1:0
-
l1:314:1:0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Naz99,
I believe the attached project is what you are looking for.
I combined ALL three modes into one project. All but one of the modes is enabled by disabling the schematic pages in TopDesign for the other modes.
To change modes: FIRST disable the schematic page of the currently active mode. Then enable the desired mode. It may or may not warn that signal names need to be assigned, This is not an issue.
If you don't FIRST disable the previous mode page before enabling the next mode page, Creator will complain that the newly enabled page has components with name collisions. It will ask if you want to rename the components on the newly enabled page. This is not what you want.
I use this technique of multiple schematic pages all the time.
Here's an additional feature when using this method:
When you "Application Build" your project, you will find a file "Generated_Source/cydisabledsheets.h".
Inside the file you'll find something like this:
#ifndef INCLUDED_CYDISABLEDSHEETS_H
#define INCLUDED_CYDISABLEDSHEETS_H
#define Mode_1__DISABLED 1u /* Mode_1 */
#define Mode_3__DISABLED 1u /* Mode_3 */
#endif /* INCLUDED_CYDISABLEDSHEETS_H */
It will have a #define of the disabled sheets.
This allows you to create conditional compile instructions. This would allow you to determine which line(s) of code to use for the compile/link phase. For example:
#if (Mode_1__DISABLED) && (Mode_3__DISABLED)
// These lines here will be valid if both Mode_1__DISABLED and Mode_3__DISABLED sheets are disabled.
#endif
#if !(Mode_2__DISABLED)
// These lines here will be valid if Mode_2__DISABLED is not found.
#endif
#if !defined(Mode_2__DISABLED)
// These lines here will be valid if Mode_2__DISABLED is not found.
#endif
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It depends... Who can switch between mode 0/1/2 ?
Try putting it in 1 project as much as possible, it makes changing code and testing much easier
If multiple projects needed, try working with libraries as much as possible. If you change e.g. the UART routines I guess you dont want to change it in all different projects.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Naz99,
I believe the attached project is what you are looking for.
I combined ALL three modes into one project. All but one of the modes is enabled by disabling the schematic pages in TopDesign for the other modes.
To change modes: FIRST disable the schematic page of the currently active mode. Then enable the desired mode. It may or may not warn that signal names need to be assigned, This is not an issue.
If you don't FIRST disable the previous mode page before enabling the next mode page, Creator will complain that the newly enabled page has components with name collisions. It will ask if you want to rename the components on the newly enabled page. This is not what you want.
I use this technique of multiple schematic pages all the time.
Here's an additional feature when using this method:
When you "Application Build" your project, you will find a file "Generated_Source/cydisabledsheets.h".
Inside the file you'll find something like this:
#ifndef INCLUDED_CYDISABLEDSHEETS_H
#define INCLUDED_CYDISABLEDSHEETS_H
#define Mode_1__DISABLED 1u /* Mode_1 */
#define Mode_3__DISABLED 1u /* Mode_3 */
#endif /* INCLUDED_CYDISABLEDSHEETS_H */
It will have a #define of the disabled sheets.
This allows you to create conditional compile instructions. This would allow you to determine which line(s) of code to use for the compile/link phase. For example:
#if (Mode_1__DISABLED) && (Mode_3__DISABLED)
// These lines here will be valid if both Mode_1__DISABLED and Mode_3__DISABLED sheets are disabled.
#endif
#if !(Mode_2__DISABLED)
// These lines here will be valid if Mode_2__DISABLED is not found.
#endif
#if !defined(Mode_2__DISABLED)
// These lines here will be valid if Mode_2__DISABLED is not found.
#endif
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you for the answer. I manage to switch to other mode after following your guide. Also, can I switch the modes using a button to make it easier to switch?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Naz99,
... can I switch the modes using a button to make it easier to switch?
On the PSoC5 you have 4 VDACs available and 4 SC blocks (for the PGAs).
To incorporate ALL your 3 modes into one active schematic you will need:
- 8 VDACs
- 6 PGAs.
You will be 4 VDACs and 2 PGAs short.
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for the help. I am currently working with the code. will do my best on this project
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Naz99,
Something was screwed up about your .cydwr file. When I went to select the "DWR/Pins" to look at the setting of your URT pins, it would come up.
The project however built without complaint. I also received no UART output when I should have.
To fix the issue I renamed the project. Doing so yielded an error. However I was now able to select "DWR/Pins". The pin assignment for the UART was correct.
A new build and program now yielded UART terminal output. (Yeah!!!) even though the data was wrong.
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Naz99,
I've modified your project and can now switch modes on-the-fly by typing:
- '1' for mode 1
- '2' for mode 2
- '3' for mode 3
This might not be exactly what you're expecting but you can use it as a guide for further development.
Note: I got rid of the two other Debouncer components. I use the same one Debouncer using P2.2 on the CY8CKIT-059.
Once you're in a new mode, pressing and releasing SW1 (P2.2) will change the InputMux channel setting the input for ADC conversion.
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you so much for modifying my coding. However, when the program is running, the serial terminal display random characters after working well for a second as in image below. any idea how to fix this problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Naz99,
I suspect when you push SW1 you are jostling the USB connection to the UART.
I have my Cy8CKIT-059 in a small vise to eliminate this issue.
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for the advice. I solved the problem after configuring the UART setting bps from 115200 to 9600. everything works well. thanks again for helping me 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Naz99,
Sorry. I routinely use 115.2K for my UART comm. That way since most of my UART comm is blocking, it doesn't take as long to send (or receive).
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"It depends... Who can switch between mode 0/1/2 ?"
"Also, can I switch the modes using a button to make it easier to switch?"
So the modes need to be switched during runtime. Do you have the possibility to combine it in one diagram ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think it is not possible to put all of them in one schematic since it uses same components
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Keep on trying to make it fit. Otherwise, you could maybe provide the processor with multiple applications - see AN73854 "Introduction to Bootloaders"... I'm not sure how many applications you could use, might be only 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you for your help. I will try my best on this project.