3 Replies Latest reply on Dec 26, 2015 8:06 AM by user_1377889

    filter

    user_304190885

      as I convert the value to the filter med (Filter_Read8 ()) to numerical voltage value ??

        • 1. Re: filter
          user_1377889

          ???

             

           

             

          Bob

          • 2. Re: filter
            user_304190885

             for(;;)
                {
                   
                    /* Poll waiting for the holding register to have data to read */
                    while (Filter_IsInterruptChannelA() == 0) ;
                    
                    num = (Filter_Read8(Filter_CHANNEL_A));
                    
                    v = ((num*5.00)/255);//// Problem ??????????????????????????
                    sprintf((char *)wrBuffer, "v = %2.f\n\r",v);
                    PrintToUSBUART((char8 *)wrBuffer);
                    
                    CyDelay(1000);
                }
                
            }

            • 3. Re: filter
              user_1377889

              I assume v is calculated correctly, you may check that in debugger.

                 

              To print a float:

                 

              Set the heap size to 0x200 (.cydwr view -> System tab)

                 

              Set Use newlib-nano and Use newlib-nano float formatting both to TRUE (Project -> Build settings -> Linker)

                 

               

                 

              Bob