sudhir p

How to Configure PTC4 as IRQ in MCF51CN128

Discussion created by sudhir p on May 2, 2011

Hi all,


I am new to Tower and its source code, I am using MCF51CN128 Controller. It want to make the PTC4 pin of this tower as IRQ pin by configuring MUX control pin appropriately.


According to table in MCF51CN128 Reference Manual page 38 Default function of the pin is assigned as PTC4 and IRQ is given as alternate1 function. Its also given that in-order to assign alternate functions to pin we can make use of software control using MUX CONTROL REGISTERS


This is how my main task look like, i want to know how do i define the input set here in order to choose IRQ function from the PTC4 pin



void main_task (uint_32 initial_data)
    //Create GPIO structures for input and output
    const uint_32 output_set[] = {
         (BSP_LED1 | GPIO_PIN_STATUS_1),
    const uint_32 input_set[] = {       
    /* Open and set port pins as output to drive LEDs (LED10 - LED13) */
    output_port = fopen("gpio:write", (char_ptr) &output_set);

    /* Open and set port pins as input to read value from switches */
    input_port = fopen("gpio:read", (char_ptr) &input_set);

        printf("Failed input\n");
        printf("Failed output\n");
    if (output_port)
        ioctl(output_port, GPIO_IOCTL_WRITE_LOG0, NULL);   

    /* Configure input pins as interrupts */
    ioctl(input_port, GPIO_IOCTL_SET_IRQ_FUNCTION, (pointer) &irq_callback);
    ioctl(input_port, GPIO_IOCTL_ENABLE_IRQ, NULL);




Can anyone please help me to know how do i configure and define this to make this pin a perfectly working input port with MUX control selecting IRQ.



Thank You all