13 Replies Latest reply on Jan 16, 2020 2:33 PM by LuMo_4610041

    #define 'variable' grayed out in c code

    LuMo_4610041

       

      As you can see above the #define does not become active as I run the Build command.

      The error prj.M0120 Build error: is generated instead,

       

      I am using PSoC Creator  4.2 (4.2.0.641) in a PSoC5LP connecting the Character LCD (multi-Port) [v1.4] to a 2x8 LCD display and interact with and ADC.

       

      Please help with information on what is preventing this directive for executing. Attached is my project.

       

      I am not sure what Community to direct this to for a hopeful prompt reply/comment.

       

      Thanks!

        • 1. Re: #define 'variable' grayed out in c code
          MoTa_728816

          Hi,

           

          I tried your project but in my PSoC Creator v4.2 I did not have Character LCD (multi-Port) [v1.4],

          so I could not compile the project.

           

          Beside above, when I saw your schematic there were

          ADC and LCD, but no LCD_Char_1.

           

          So how about select "LCD_Char_1" in the Workspace Explorer and  "Delete" it?

          Note: I could not "Remove From <Project>"

           

          moto

          • 2. Re: #define 'variable' grayed out in c code
            LuMo_4610041

            Hi,

            Please see attached the datasheet of the LCD I am trying to use, Character LCD (multi-Port) [v1.4]. It calls to use LCD_Char_1.

            I got this LCD from the attached library.

             

            I noticed that the gray out variables in my original shot are being called in the .h files. I suspect that file LCD_Char_1_Cntl_Prt.c is causing the LCD_Char_1_Cntl_Port_Sync_ctrl_reg__CONTROL_REG not being recognized. What do you think?

            • 3. Re: #define 'variable' grayed out in c code
              MoTa_728816

              Hi,

               

              It took me a while to find out from where "CharLCDmp_v1.4" came from.

              All I could find was the topic

              Character LCD (mp) Multi-Port

               

              And in the last post MarkH_61-san was writing...

              ===================

              I updated the component so that it should work fine with PSoC Creator 4.1 or 4.2. 

              The older version of the Control register was removed in Creator 4.1 so that is why it broke. 

              Let me know if the attached library works OK for you.

              ===================

               

              The last attached "CharLCDmpLib.cylib.zip contains

              CharLCDmpLib_workspace.JPG

              So I suppose that v1.4 had problem with the Control register and v1.5 was introduced for PSoC Creator v4.1 or v4.2.

               

              Then I imported v1.5 and tried to build, but the author forgot to change names form CharLCDmp_v1_4 to Char LCDmp_v1_5 in v1.5.

              so I received 33 error.. orz

               

              After changing all the names, I could build the project.

              Note: As I don't have the hardware, I could not test it.

              compiled.JPG

               

              Hope this can be some help for you ;-)

               

              moto

              • 4. Re: #define 'variable' grayed out in c code
                LuMo_4610041

                Motoo,

                I appreciate the effort and time into this but I believe you did not attach the right file. I may be mistaken but I see that the title of the project does not match the attachment. Besides it would not run in the hardware. Please see below. Can you try again? Thanks in advance,

                 

                • 5. Re: #define 'variable' grayed out in c code
                  MoTa_728816

                  Dear LuMo-san,

                   

                  Yes, You are right! >_<

                   

                  I wonder how I managed to paste an archive from quite different project...

                   

                  Anyway, I hope this one is the right one.

                   

                  Best Regards,

                  14-Jan-2020

                  Motoo Tanaka

                  • 6. Re: #define 'variable' grayed out in c code
                    LuMo_4610041

                    Motoo,

                     

                    I seems to be the right one but why can't I open it? What could be the problem?

                     

                    Thanks

                    • 7. Re: #define 'variable' grayed out in c code
                      LuMo_4610041

                      Motto,

                       

                      It seems that your project did not include the updated version of CharteLCDmp_v1_5. Can you send the updated version please?

                       

                      Thanks,

                       

                      • 8. Re: #define 'variable' grayed out in c code
                        MoTa_728816

                        Dear LuMo-san,

                         

                        Adding CharLCDmpLib later seems to be complicated.

                         

                        Let me attach the project which contains the lib.

                         

                        Please do "Clean and Rebuild" after expanding the archive.

                        At least this archive was compile-able.

                        000-compiled.JPG

                         

                        moto

                        • 9. Re: #define 'variable' grayed out in c code
                          LuMo_4610041

                          Motoo,

                           

                          The file would not open. I downloaded your file, opened PSoC, uploaded the your .cyprj but could not access. When trying to run the Clean and Build I see what you see. Any suggestions? I did not see the lib in your project, may be is missed, but it should not have prevent from opening, right?

                           

                          • 10. Re: #define 'variable' grayed out in c code
                            MoTa_728816

                            Dear LuMo-san,

                             

                            I have just tried following with both Window10 and Windows7

                            (1) Downloaded the attached file of my previous response to  "Desktop\tmp" folder

                            (2) Expanded the project

                            (3) Opened the project by double clicking "ADC_Copy_200109_2.cyprj" file in "ADC_Copy_200109_2.cydsn" folder

                              Note: I got following warning dialog, probably because of the "CharLCDmp_v1_5"

                            000-first-warning.JPG

                            (4) From PSoC Creator "Clean and Build ADC_Copy_200109_2" from Build Menu

                                And it could be compiled.

                            (Windows7)

                            001-compiled.JPG

                            (Windows10)

                            200115_compiled.JPG

                             

                            One thing bothers me from your screen shot, is the error message suggests that the project is in the

                            C:\Program Files (x86)\Cypress\PSoC Creator\4.2\ADC_Copy_200109_2.cydsn...

                             

                            Where did you expand the zip file?

                            I would suggest you to use either close to the root of the file system or your document folder,

                            such as

                            C:\Design\ADC_Copy_200109_2.cydsn

                            C:\<your document>\Desktop\tmp\ADC_Copy_200109_2.cydsn

                            something like these.

                             

                            Best Regards,

                            15-Jan-2020

                            Motoo Tanaka

                            • 11. Re: #define 'variable' grayed out in c code
                              LuMo_4610041

                              Motoo,

                               

                              Your efforts were not in vain, thanks! I was able to built and run . I did not get the original problem or not recognizing the #define anymore.

                               

                              There is an issue thought, as I program the PSoC, RS, E and D4, D5, D6, D7, don't change state. The PSoC is not exchanging info with the LCD. The output remain at a fix state. As if the commands in the code were not executing as they should, please see attached my code and screen shots. Where there are like voltage spikes I see  dark squares on the LCD otherwise remains blank (nothing on it). Can you help me discover why?

                              A bit of background, I am using Windows and I removed the ADC thinking that it was interfering with the rest.

                              Regards,

                              • 12. Re: #define 'variable' grayed out in c code
                                MoTa_728816

                                Dear LuMo-san,

                                 

                                I'm glad hearing that the project is now compile-able at your side, too!

                                 

                                > There is an issue thought, as I program the PSoC, RS, E and D4, D5, D6, D7, don't change state.

                                This question is leaving the original "#define" issue.

                                Would you close (or leave) this topic and post the question as a new discussion,

                                so that others can find the question as regarding to "LCD" problem instead of "#define" issue?

                                 

                                Although I'm going to try looking into the issue, as I'm not familiar with LCD.

                                So there may be more/other engineers who can help you with this problem.

                                 

                                Best Regards,

                                16-Jan-2020

                                Motoo Tanaka

                                 

                                 

                                • 13. Re: #define 'variable' grayed out in c code
                                  LuMo_4610041

                                  Moto,

                                   

                                  I appreciate your help. And yes, I'll created a different post. Have a great one.