Switching the Analog Output on a Pin

Version 1
    Question: I have a CT block and an SC block in same column. How can I configure my output pin either for CT Block output or for SC block output?



    You've already completed the first step, which is to place both modules in the same column.

    When the UMs are parameterized one of the parameters is "AnalogBus". The "AnalogBus" parameter controls if the UM drives the analog bus associated with that column of SoC Blocks. The column's analog bus will drive a pin (port0, pin 3 in this case) if the buffer at the bottom of the analog column (Buf0 in this case) is turned on.

    PSoC Designer will only allow one UM in the column to have their "AnalogBus" paramter set to the AnalogOutBus_x (AnalogOutBus_0 in this case). The other UM will have to have its Analog Bus connection set to Disable. You may want to choose one of the UMs to be the UM connected at start up, or you may want to set both UMs AnalogBus parameter to Disable.

    Once the UMs are set up, the application can be generated.

    Next, write software to switch which UM is connected to the analog output pin. The analog blocks have a bit that controls whether that block drives the analog column bus. For Continous Time analog blocks (CT Blocks) it is bit 7 of the Analog Continuous Time Block Control 1 Register. For Switch Cap analog blocks (SC Blocks) it is bit 7 of the Analog Switch Cap Block Control 2 Register.

    Lets take an Example of a PGA and a DAC. Only one of these bits should be on at a time, so when switching the PGA output on, the DAC output should be disabled and then the PGA output enabled. Likewise, when switching the DAC output on, the PGA should be disabled, then the DAC enabled.

    The include and header files for the UMs have definitions for the registers used by them. These should be used so that if you have to move everything to column 1 for some reason, the code will work without having to be modified.

    Here is some example code that should do the job:

    DISABLE: equ ~80h keeping with the names used by PSoC Designer


    In C, it lacks the definitions of the registers using the UM name in the header files. Therefore, to get it to work the absolute names of the registers must be used. This makes it less portable (you have to edit the code if the move the blocks that the UMs are in), but it still works just fine. PSoC allows you to get contention between analog blocks if you turn more than one on at a time.

    define DISABLE ~0x80;// keeping with the names used by PSoC Designer
    #define ANALOGOUTBUS 0x80
    void main()

    while (1)
    void DACOutEnabled(void)
    ACA00CR1 &= DISABLE;
    void PGAOutEnabled(void)
    ASA10CR2 &= DISABLE;