Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

0 state not actually 0

Status
Not open for further replies.

mungoj

Newbie level 3
Newbie level 3
Joined
Jul 8, 2014
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
25
Hi,
I've created a circuit board with pic32mx250 and I'm powering the it through the programmer (pickit 3). For the test, I've included a LED on one of the digital pins. Problem is, that it won't completely "turn off" and go to 0V but it has some voltage drop if it's in 0 state, so it's shinning a little but it's ok in state 1 (it's shinning in full brightness).
Is the problem in ground connection somewhere maybe? Any ideas?
 

hi,
Do you have a voltmeter to check the output pin voltage levels when the pin is at +V and 0V.?

Its important that the PIC's 0V pin and the cathode of the LED are connected to the same 0V.
I assume you have a current limiting resistor in series withe the LED.?

E
 

They are on the same 0V (I have a ground plane over the whole circuit). Resistor in series is 4k ohm (I didn't have any lower and use the 4k one). I think this shouldn't be a problem.

- - - Updated - - -

I can't measure it right now, cuz I'm at work. But it's not so small gap between levels. I've also saw that when it's in 1 state it's stable but when in 0, it flickers a little (at really small voltage).
 

I've also saw that when it's in 1 state it's stable but when in 0, it flickers a little (at really small voltage).
As you say a 4K is too high a value for a LED limiter, , usually its in the order of 220R thru 560R depending upon the LED colour.
The flickering suggests that the pin maybe not be configured correctly as an I/O pin.?
 

Hi,

disable the PIC internal pullup (port setup)

also be sure that no other periferal uses this pin. (programmer, RS232, I2C....)


Klaus
 

Hi,

Also quiet possible that your program is in a closed loop turning the led pin on and off very quickly so giving that appearance as if its glowing slightly.
 

Code:
#include <stdio.h>
#include <stdlib.h>


// PIC32MX250F128D Configuration Bit Settings

// 'C' source line config statements

//#include <xc.h>
#include <plib.h>
// DEVCFG3
// USERID = No Setting
#pragma config PMDL1WAY = OFF           // Peripheral Module Disable Configuration (Allow multiple reconfigurations)
#pragma config IOL1WAY = OFF            // Peripheral Pin Select Configuration (Allow multiple reconfigurations)
#pragma config FUSBIDIO = ON           // USB USID Selection (Controlled by Port Function)
#pragma config FVBUSONIO = ON          // USB VBUS ON Selection (Controlled by Port Function)

// DEVCFG2
#pragma config FPLLIDIV = DIV_2         // PLL Input Divider (2x Divider)
#pragma config FPLLMUL = MUL_16         // PLL Multiplier (16x Multiplier)
#pragma config UPLLIDIV = DIV_5         // USB PLL Input Divider (5x Divider)
#pragma config UPLLEN = OFF             // USB PLL Enable (Disabled and Bypassed)
#pragma config FPLLODIV = DIV_2         // System PLL Output Clock Divider (PLL Divide by 2)

// DEVCFG1
#pragma config FNOSC = PRIPLL           // Oscillator Selection Bits (Primary Osc w/PLL (XT+,HS+,EC+PLL))
#pragma config FSOSCEN = OFF            // Secondary Oscillator Enable (Disabled)
#pragma config IESO = OFF               // Internal/External Switch Over (Disabled)
#pragma config POSCMOD = HS             // Primary Oscillator Configuration (HS osc mode)
#pragma config OSCIOFNC = OFF           // CLKO Output Signal Active on the OSCO Pin (Disabled)
#pragma config FPBDIV = DIV_2           // Peripheral Clock Divisor (Pb_Clk is Sys_Clk/8)
#pragma config FCKSM = CSDCMD           // Clock Switching and Monitor Selection (Clock Switch Disable, FSCM Disabled)
#pragma config WDTPS = PS1              // Watchdog Timer Postscaler (1:1)
#pragma config WINDIS = OFF             // Watchdog Timer Window Enable (Watchdog Timer is in Non-Window Mode)
#pragma config FWDTEN = OFF             // Watchdog Timer Enable (WDT Disabled (SWDTEN Bit Controls))
#pragma config FWDTWINSZ = WISZ_25      // Watchdog Timer Window Size (Window Size is 25%)

// DEVCFG0
#pragma config JTAGEN = OFF             // JTAG Enable (JTAG Disabled)
#pragma config ICESEL = ICS_PGx1        // ICE/ICD Comm Channel Select (Communicate on PGEC4/PGED4)
#pragma config PWP = OFF                // Program Flash Write Protect (Disable)
#pragma config BWP = OFF                // Boot Flash Write Protect bit (Protection Disabled)
#pragma config CP = OFF                 // Code Protect (Protection Disabled)

#define CONFIG         (CNB_ON | CNB_IDLE_CON)
#define PINS           (CNB0_ENABLE)


int main() {
int count=0;
mPORTBDirection(0);

//mPORTBSetBits(BIT_5);
while (1)
{
mPORTBToggleBits(BIT_5);
while(count)
{
count--;
}
count=1000000;
}

return (EXIT_SUCCESS);
}



This is my code. wp100, well I don't think this is problem, cuz I tried to put pin on state 0 with a simple code and LED was also flickering. I think this should be due to the floating ground somewhere.
 
Last edited by a moderator:

Hi,

maybe a problem of schematic or a bad solder joint.


Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top