MC9S12XEP100 Port H & Port J used for LED with 74HC04 Hex Inverter

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC9S12XEP100 Port H & Port J used for LED with 74HC04 Hex Inverter

929 Views
harshal_pawar
Contributor III

I am using PH2,PH3,PJ6 & PJ7 of MC9S12XEP100 for glowing LED using 74HC04 Hex Inverter.

Initially when I power the board all four LEDs are ON by default.

LED PJ6 & PJ7 are working as expected but PH2 & PH3 LEDs are continuously glowing even by giving Data on that pin as continuously low. 

I have checked the hardware connections & everything is fine there.

So what could be the reason behind this?

Labels (1)
4 Replies

767 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

can you share the code and the schematic?

Thanks,

Daniel

0 Kudos

767 Views
harshal_pawar
Contributor III

LED_Sch.JPG

#include <hidef.h>      /* common defines and macros */
#include "derivative.h"      /* derivative-specific definitions */
#include <MC9S12XEP100.h>
#include <stdlib.h>
void main(void)
{
    PTH_PTH2=0;     /* PH2-LD2 */
    PTH_PTH3=0;     /* PH3-LD3 */ 
    PTJ_PTJ6=0;     /* PJ6-LD4 */
    PTJ_PTJ7=0;     /* PJ7-LD7 */
   
    DDRH_DDRH2=1;   /* PH2-LD2 */
    DDRH_DDRH3=1;   /* PH3-LD3 */   
    DDRJ_DDRJ6=1;   /* PJ6-LD4 */
    DDRJ_DDRJ7=1;   /* PJ7-LD7 */
   
    while(1)
    {
         
         PTH_PTH2=1;   /* LD2 ON */  
         PTH_PTH3=0;   /* LD3 OFF */
         PTJ_PTJ6=1;   /* LD4 ON */
         PTJ_PTJ7=0;   /* LD7 OFF */
    }
                
}
0 Kudos

767 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Can you disconnect the 74HC04 and check the outputs.

There is only one difference between PTJ6/7 and PTH2/3.

PTJ6/7 have internal pull-up resistor enabled by default whereas PH2/3 don't.

PH2/3 are floating inputs out of reset.

Do you use any alternative function of the pins (SPI, SCI)?

Regards,

Daniel

767 Views
harshal_pawar
Contributor III

Issue resolved! There was a problem with hardware connection.

Thanks for the help.

0 Kudos