[PSOC 5LP] Multiple Analog Inputs Multiplexed (AMux, ADC SAR, and USBUART)

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.พ. 2025

ความคิดเห็น • 7

  • @TheBackyardScientist
    @TheBackyardScientist 2 ปีที่แล้ว +1

    How do you vary the period and pulse width of the LED using this method?
    Here is the code im trying to use
    AMux_Select(0);
    int pot1 = ADC_SAR_GetResult8();
    PWM_WriteCompare(pot1);
    CyDelay(100);
    AMux_Select(1);
    int pot2 = ADC_SAR_GetResult8();
    PWM_WritePeriod(pot2);
    I think the PWM is switching between between writing the period, and writing the pulse width. I want it to update both values at the same time. hope that makes sense.

    • @ryanmsparks
      @ryanmsparks  2 ปีที่แล้ว

      Makes sense to me! Because they're multiplexed though there isn't a way to read them simultaneously with this hardware configuration. Instead you have to read them separately just like you're doing, but I think the position of your delay statement is what's causing the "switching between" behavior you're talking about. Try moving your CyDelay to the end of that code block and see if it works better! :)

  • @jonathansgl4373
    @jonathansgl4373 ปีที่แล้ว +1

    Really helpful. Thanks!

  • @matthiasVanderCam-theundering
    @matthiasVanderCam-theundering 3 ปีที่แล้ว +2

    Thank you for your video !

  • @jona4385
    @jona4385 2 ปีที่แล้ว

    Thank you so much

  • @BasicScroller
    @BasicScroller 3 ปีที่แล้ว

    Hello
    I'm receiving an error message concerning USBUART_PutString (Undefined reference to)
    I don't know why. Is this familiar with you?

    • @ryanmsparks
      @ryanmsparks  3 ปีที่แล้ว

      That means the C compiler (which executes your software) doesn't know where the function "USBUART_PutString" is, and that's about all the information you get - but some background info might help you figure out why it can't find it. Since PSoC Creator generates that function when you build the hardware, I'd guess it's probably something to do with how you named your USBUART block. By default it comes like "USBUART_1", so in that case the function you'd use in software would be "USBUART_1_PutString" (or you can rename it and re-build your hardware).
      Now, that's not the only reason it might not be able to find it. Another reason might be if you accidentally removed an important "#include" statement, for example.