INPUT PIN LOADING

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

INPUT PIN LOADING

2,513 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kalevikrant on Mon Jan 27 08:15:11 MST 2014

             I am trying to connect a pullup resistor  of value 4k7 to VDD  to pin 14 & 15. When physically checked the voltage found the voltage to
be around 0.8v. Can any one help me in this matter & let me know where I am going wrong..
Labels (1)
0 Kudos
Reply
16 Replies

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxp_apps on Fri Feb 21 14:43:43 MST 2014
Hi,

See reply:
http://www.lpcware.com/content/forum/how-do-i-program-lpc812-so-it-can-treat-12-vcc-zero-level#comme...

Thanks.

nxp_support
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kalevikrant on Thu Feb 13 09:26:34 MST 2014
Hi,
           How do I program LPC812 so that it can treat 1/2 VCC as Zero level?
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Tue Feb 11 17:25:23 MST 2014

Quote: kalevikrant
I want to add some wait time  or delay after checking the condition of input before setting the output Pin high or Low. How do i go about it?

Start a new thread to ask this question.
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kalevikrant on Tue Feb 11 07:27:58 MST 2014

    Hi,
              After seeing your post I checked my coding and did necessary corrections
and did Build program. It did not give any compilation error. I have also implemented GPIOPinValue command after seeing
it in the Library. I have included GPIO Library in my program. One small help in coding is required.

1) I want to add some wait time  or delay after checking the condition of input before setting the output
     Pin high or Low. How do i go about it?
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Tue Feb 11 03:00:54 MST 2014

Quote: kalevikrant
Hi,
Thanks for the input. surely will try it out and let you know the results.
I wanted to know from where I can download all this commands as they are not available
in LPC812 user manual or LpcExpresso Help Menu.

I believe that you have a problem with not including the lpc800_driver_lib, specifically lpc8xx_gpio.h, that is where you will find all of these functions.  You will need an include statement in your .c file and you will need to add the library and library path to your project settings.  You will also have to build the lpc800_driver_lib before you can use it.

Maybe we can make this conversation a bit more responsive if we check on replies more frequently?

EDIT: I made a error in my previous post, here are the corrections:

Quote: larryvc
You need to [color=#f00]get[/color] (read) the bit value by calling GPIO[color=#f00]GetPin[/color]Value().  Then the compare will work.

Try this:
    if ( GPIOGetPinValue( 0, 6) == 0) {  // If bit 6 is low set bit 13 high, otherwise set bit 13 low
        GPIOSetBitValue( 0, 13, 1 );
    } else {
        GPIOSetBitValue( 0, 13, 0 );
    }



Why NXP used GPIOSetBitValue instead of GPIOSetPinValue is a mystery.  Everything else uses Pin, why Bit in this function only?  Doesn't really matter though, they are doing it right in LPCOpen including using the Byte Pin Registers for assignments instead of the old method of shifting and nanding/oring.

Kalevikrant,  I suggest that you use LPCOpen if you are just starting to develop with the LPC8xx series.
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kalevikrant on Mon Feb 10 07:01:03 MST 2014

               Hi,
                           Thanks for the input. surely will try it out and let you know the results.
I wanted to know from where I can download all this commands as they are not available
in LPC812 user manual or LpcExpresso Help Menu.
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Sun Feb 09 23:16:00 MST 2014

Quote: kalevikrant
I realized that I am comparing with function
that returns port value high or low.


No, you are still misunderstanding.  The function GPIOSetBitValue() does not return port value high or low.  In fact, as I had hinted to above, GPIOSetBitValue() returns nothing.  GPIO[color=#f00]SetBitValue[/color]() [color=#f00]sets[/color] a bit on the port to a high or low value.

You need to [color=#f00]get[/color] (read) the bit value by calling GPIO[color=#f00]Get[/color]BitValue().  Then the compare will work.

Try this:
    if ( GPIOGetBitValue( 0, 6) == 0) {  // If bit 6 is low set bit 13 high, otherwise set bit 13 low
        GPIOSetBitValue( 0, 13, 1 );
    } else {
        GPIOSetBitValue( 0, 13, 0 );
    }

0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kalevikrant on Sun Feb 09 09:38:47 MST 2014

Hi, Sorry for the mistake. I am learning coding for first time . Yes I want to compare the Bit value
before going future. In fact I want to OR the bit values from two input ports and then compare whether
it's high or LOW before output port gives any signal. I realized that I am comparing with function
that returns port value high or low. Can you suggest correct coding for my application
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Sun Feb 09 02:01:12 MST 2014

Quote: kalevikrant
I have modified the blinky program and it works fine for out put section. But for input it's giving error.
Need some ideas how to go around it. The above program didnt work at all. Please find the modified Program



You set  the port pin as an input
    /* Set port p0.6 to input */
   GPIOSetDir( 0, 6, 0 );
Then you try to do a compare based on the return value, if there even is one, of a function that sets the bit to a value.
if ( GPIO[color=#f00]Set[/color]BitValue( 0, 6, 0 ) == 0)  " GIVING ERROR"
Don't you want to do a compare on the value of the bit that you get (read) instead?

Also, please learn how to post your code between code tags like I did here and in my previous post.
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kalevikrant on Sat Feb 08 21:03:32 MST 2014

    Hi Larry,
                    I have modified the blinky program and it works fine for out put section. But for input it's giving error.
Need some ideas how to go around it. The above program didnt work at all. Please find the modified Program

  /* Set port p0.13 to output */
  GPIOSetDir( 0, 13, 1 );

/* Set port p0.6 to input */
  GPIOSetDir( 0, 6, 0 );

/* Set port p0.7 to input */
  GPIOSetDir( 0, 7, 0 );

//init_mrt(0x8000);

  while (1)                                /* Loop forever */
  {
/* I/O configuration and LED setting pending. */
if ( GPIOSetBitValue( 0, 6, 0 ) == 0)  " GIVING ERROR"
{
GPIOSetBitValue( 0, 13, 1 );
}
if (GPIOSetBitValue( 0, 6, 1 )== 1 )
{
GPIOSetBitValue( 0, 13, 0 );
}
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Tue Feb 04 19:44:20 MST 2014
Kalevikrant, Here is your code without all of the unnecessary comments and count increment code.  Also added a missing final closing brace for main().  Much nicer to read with formatting and it makes it easier for anyone trying to help you too.

Note the comment at the compare in the while loop.  I did not check for any other errors in your program.

#ifdef __USE_CMSIS
#include "LPC8xx.h"
#endif

void SwitchMatrix_Init()
{
    /* Enable the clock to the Switch Matrix */
    LPC_SYSCON->SYSAHBCLKCTRL |= ( 1 << 7 );

    /* Pin Assign 1 bit Configuration */
    /* SWCLK */
    /* SWDIO */
    /* XTALIN */
    /* XTALOUT */
    /* RESET */
    LPC_SWM->PINENABLE0 = 0xffffff83UL;

}

void IOCON_Init()
{
    /* Enable IOCON clock */
    LPC_SYSCON->SYSAHBCLKCTRL |= ( 1 << 18 );
}

int main(void)
{
// Configure the switch matrix
    SwitchMatrix_Init();

    LPC_IOCON->PIO0_10 = 0x80; // Xtal In
    LPC_IOCON->PIO0_11 = 0x80; // Xtal Out
    LPC_IOCON->PIO0_6  = 0x90; // Input1
    LPC_IOCON->PIO0_7  = 0x90; // Input1
    LPC_IOCON->PIO0_13 = 0x90; // Output pin

    /* Enable the clock to the Switch Matrix */
    LPC_SYSCON->SYSAHBCLKCTRL |= ( 1 << 7);

    while(1) {

        if ( LPC_IOCON->PIO0_6 || LPC_IOCON->PIO0_7 < 1 ) {  // <-- this is most likely not doing what you want it to do
            (LPC_IOCON->PIO0_13 = 0);
        }
    }
}

0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kalevikrant on Wed Jan 29 07:52:41 MST 2014

Sorry it's not that i don't want to provide information, but being new to programming I had take  help from LPC initializer to set the Pins
as Input/Output and Xin / Xout. By the way I am using 16 Pin soic package. I want the pins to drive low on fault condition and High in
normal condition.I am connecting third wire from three wire DC motor which require to be pulled up.

following is Code what I have written

#ifdef __USE_CMSIS
#include "LPC8xx.h"
#endif

#include <cr_section_macros.h>

#include <NXP/crp.h>
void SwitchMatrix_Init()
{
       /* Enable the clock to the Switch Matrix */
       LPC_SYSCON->SYSAHBCLKCTRL |= (1<<7);

       /* Pin Assign 8 bit Configuration */
       /* none */

       /* Pin Assign 1 bit Configuration */
       /* SWCLK */
       /* SWDIO */
       /* XTALIN */
       /* XTALOUT */
       /* RESET */
       LPC_SWM->PINENABLE0 = 0xffffff83UL;

}


void IOCON_Init() {
       /* Enable IOCON clock */
       LPC_SYSCON->SYSAHBCLKCTRL |= (1<<18);

       /* Pin I/O Configuration */
       /*LPC_IOCON->PIO0_0= 0x90; */
       /*LPC_IOCON->PIO0_1= 0x90; */
       /*LPC_IOCON->PIO0_2= 0x90; */
       /*LPC_IOCON->PIO0_3= 0x90; */
       /*LPC_IOCON->PIO0_4= 0x90; */
       /*LPC_IOCON->PIO0_5= 0x90; */
       /*LPC_IOCON->PIO0_6= 0x90; */
       /*LPC_IOCON->PIO0_7= 0x90; */
       /*LPC_IOCON->PIO0_8= 0x90; */
       /*LPC_IOCON->PIO0_9= 0x90; */
       /*LPC_IOCON->PIO0_10= 0x80; */
       /*LPC_IOCON->PIO0_11= 0x80; */
       /*LPC_IOCON->PIO0_12= 0x90; */
       /*LPC_IOCON->PIO0_13= 0x90; */

}

int main(void) {
// Configure the switch matrix
SwitchMatrix_Init();
    //LPC_IOCON->PIO0_7 = 0x90;
    /* LPC_IOCON->PIO0_8 = 0x90; */
    /* LPC_IOCON->PIO0_9 = 0x90; */
    /* LPC_IOCON->PIO0_10 = 0x80; */
    /* LPC_IOCON->PIO0_11 = 0x80; */
    /* LPC_IOCON->PIO0_12 = 0x90; */
    /* LPC_IOCON->PIO0_13 = 0x90; */
    /* LPC_IOCON->PIO0_14 = 0x90; */
    /* LPC_IOCON->PIO0_15 = 0x90; */
    LPC_IOCON->PIO0_10= 0x80; //X tal IN
    LPC_IOCON->PIO0_11= 0x80; // Xtal Out
    LPC_IOCON->PIO0_6 = 0x90; //Input1
    LPC_IOCON->PIO0_7 = 0x90; //Input1
    LPC_IOCON->PIO0_13 = 0x90; //Output pin

    /* Enable the clock to the Switch Matrix */
         LPC_SYSCON->SYSAHBCLKCTRL |= (1<<7);


    // Force the counter to be placed into memory
    volatile static int i = 0 ;
    // Enter an infinite loop, just incrementing a counter
    while(1) {

    if (LPC_IOCON->PIO0_6||LPC_IOCON->PIO0_7<1)
    {
    (LPC_IOCON->PIO0_13=0);
    }
        i++ ;
    }
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rocketdawg on Tue Jan 28 09:27:39 MST 2014
ok, so you do not want to provide any information, so I am guessing
on a 20 pin part like the LPC812, pin 14 is PIO0_8 and also XTALIN
display PIO0_8, address 0x4004 4038
PINENABLE0,address0x4000C1C0
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kalevikrant on Tue Jan 28 08:04:09 MST 2014
The Pins are configured as input only.
If the Chip comes with Internal pull up then how come it's dropping to 0.8 without any program loaded into the chip? In normal condition the input will be high, and will be pulled to low in fault condition.
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxp_apps on Mon Jan 27 12:04:28 MST 2014
Hi,

Please keep in mind that by default (without any software configuration), the pins are inputs with internal pull-up enabled. The pins will be pulled high to the Vdd voltage.

Thanks.

nxp_apps
0 Kudos
Reply

2,465 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rocketdawg on Mon Jan 27 09:11:14 MST 2014
is the pin configured as an input or output?
are you driving the pin low or high?

we probably need to see your pin setup code or more since several clock domains must be enabled to configure pins.
0 Kudos
Reply