5 Replies Latest reply on Apr 27, 2018 3:34 AM by bob.marlowe

    how to accesses a variable after compiling ?

    tomer.cccp_2937441

      hello in my code there is an array and my question is how can i see the information of the array ?(meaning to see the data of each cell )

      with out using debugger .

      this is my code :

       

       

       

       

       

       

       

       

       

      int main()

      {

          int32 output={0};

           volatile  int32 output_array[1000]={0}; // voltatile is used to avoid optimized out eror

          int32 mVolts;

         int i=0;

         

          

          char displayStr[15] = {0};   /* Character array to hold the micro volts*/

          /* Start the components */

       

       

          LCD_Start();

          ADC_DelSig_1_Start();

       

       

          /* Start the ADC conversion */

          ADC_DelSig_1_StartConvert();

       

       

          /* Display the value of ADC output on LCD */

          LCD_Position(0u, 0u);

          LCD_PrintString("ADC_Output (Hex):");

          ADC_DelSig_1_SetOffset(130);// -25

         

         LCD_Position(2u, 0u);

          LCD_PrintString("ADC-voltage:");

         

         

         for(;;) // this for meanes that it will run forever

          {

             

              

             

             

       

       

             

             

             

            

             

             

             

             

            

             

              if(ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_WAIT_FOR_RESULT))

              {

             output = ADC_DelSig_1_GetResult32();

             mVolts = ADC_DelSig_1_CountsTo_uVolts(output);

         

       

                  for(i=0;i<=1000;i++)

          {  

          output_array[i] = ADC_DelSig_1_GetResult32();

         

         

          }

         

         

         

         

         

                 

             LCD_Position(1u, 0u);

             LCD_PrintInt32(output);

             sprintf(displayStr,"%5ld",mVolts);

             LCD_Position(3,0);   

             LCD_PrintString(displayStr);

             

             CyDelay(500u);

         

        

        

       

       

       

              }

          }

      }

        • 1. Re: how to accesses a variable after compiling ?
          bob.marlowe

          You could use a UART connected to your PC and send the data to the screen using PuTTY. You are probably using a Cypress development kit, which one? CY8CKIT-0??

           

          There are some errors in your code:

          for(i=0;i<=1000;i++)

          This will write past the array. Use

          for(i=0;i<1000;i++)

           

           

               for(i=0;i<1000;i++)

              {  

                 output_array[i] = ADC_DelSig_1_GetResult32();

              }

          Here you read 1000 conversions without waiting for a conversion ready. Better use

           

               for(i=0;i<1000;i++)

              {

                  ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_WAIT_FOR_RESULT) 

                 output_array[i] = ADC_DelSig_1_GetResult32();

              }

           

          It is easier for us when you post the complete project so that we all can have a look at all of your settings. To do so, use

          Creator->File->Create Workspace Bundle (minimal)

          and attach the resulting file.

           

          Bob

          • 2. Re: how to accesses a variable after compiling ?
            tomer.cccp_2937441

            here is my project , i dont want to see it in UART ,i want to get a vector of samples and process the information with excel or matlab

            • 3. Re: how to accesses a variable after compiling ?
              bob.marlowe

              You did not yet insert the suggestions I made.

              I assume you have got a CY8CKIT-059 prototyping kit. For a connection to your PC where matlab is running on you should use the on-board UART-USB bridge. Check your kit documentation, use ports P12_6 and P12_7 for UART. On PC side the bridge will show up as a COM-Portwhich you will see in the device manager. There you can connect matlab to.

               

              Bob

              • 4. Re: how to accesses a variable after compiling ?
                tomer.cccp_2937441

                i am a bit confused about your comment should i write :

                 

                     for(i=0;i<1000;i++)

                    { 

                       output_array[i] = ADC_DelSig_1_GetResult32();

                    }

                or

                 

                     for(i=0;i<1000;i++)

                    {

                        ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_WAIT_FOR_RESULT)

                       output_array[i] = ADC_DelSig_1_GetResult32();

                    }

                 

                 

                because the the second option i am already using .

                 

                about the UART . is it necessary to use UART ? because i remember that i had trouble download and use the programs to use UART.

                and thank your for your help as you can see i am new to all the cypress board and world

                • 5. Re: how to accesses a variable after compiling ?
                  bob.marlowe

                  In your uploaded project you are not using the second option which would be correct for you to fill the array, so I didn't know whether you already changed something.

                  What kind of interface between the PSoC board and your PC you want to use? For UART there is nothing at all you need to download, everything is ready waiting for you:

                  on PC side there are emulated com-ports and commands to set serial speed etc (mode command). You even may copy the data from serial into a file.

                  On PSoC side there is the UART component. In your Kitprog documentation (installed on your PC when you installed the kit files) is explained in detail how the USB-UART bridge can be used.

                   

                  Bob

                  1 of 1 people found this helpful