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.

[PIC] pic16f1829 output is just half the vdd and pk-pk is 240mv

Status
Not open for further replies.

rajat2905

Newbie level 5
Joined
Jan 3, 2015
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
91
hi all, i have been using pic16f1829 at 3.3vfor spi interfacing but the port B is not getting configured and when i configure it as a digital io it changes state as per the program but with very low peak to peak voltage equal to 240mv only as shown in the oscilloscope image. pic1829output.jpg

my settings are:

TRISB=0x30;
LATB = 0x00;
ANSELB = 0x00;
WPUB = 0xF0;
OPTION_REGbits.nWPUEN = 0;
INLVLB = 0x00;
SSP1CON1 = 0x00;


i am trying to toggle the state of port B every 2 sec, but full voltage is not coming? why?
 

Hi,

Disconnect the load and measure directly at the pin.

Klaus
 

Hi,

Disconnect the load and measure directly at the pin.

Klaus

There is no load connected to the microcontroller pin. Only oscillator probe is connected.

- - - Updated - - -

There is no load connected to the microcontroller pin. Only oscillator probe is connected.
 

Hi,

very unlikely - the DC voltage of about 1.3V

* Check scope connections, especially GND connection.
* cross check output voltage with an DMM
* check power supply connection and power supply voltage.

Klaus
 

Hi,

very unlikely - the DC voltage of about 1.3V

* Check scope connections, especially GND connection.
* cross check output voltage with an DMM
* check power supply connection and power supply voltage.

Klaus

Yes multimeter also shows the same result.
One thing i observed is that when i remove the spi data transfer code from my code the RB7 pin becomes a staright line at 1.84V constant and nothing happens. same is the case with RB6 sclk pin.
thanks
 

I noticed that when i do this all pins work fine:
LATA=~LATA;
LATC=~LATC;
LATB=~LATB;

Meaning when all pins of pic16f1829 are configured as output and all are simultaneously turned on and off then only it works fine not by doing this:
LATBbits.LATB7=~LATBbits.LATB7;
 

i have set tris bits to zero to set all the pins of pic16f1829 as output. all the pins are toggling every 2 sec as per my logic but RC6,RB7,RB5 and RB6 not changing state when toggle. what may be the reason, coz i have disabled all the other peripherals also? Plz help!!
 

Hi,
I suggest that you use MCC plugin in MPLAB X.
It makes initialization much easier. The PIC16F1xxx have lots of new registers compared to older ones and my gues is that your program is missing some initialization.
Regards
 

Is this on your own PCB or a commercial board? It could be that those pins are being shorted out - on the PDIP package they are the 4 pins at the far end of the package and they are all together on one side of the QFN package (along with RB4).
Susan
 

It sure sounds like you've got shorted pins. Instead of changing all three pins at the same time, change only one at a time.
 

I am using pic16f1829 ssop20 package on a commercial pcb board. I also checked the continuity of all the 4 pins with multimeter, they are not shorted.

When i toggle the pins one by one i found RC6 and RB7 toggle in pair i.e. RC6 does not change state when toggle alone , RB6 changes state when RC6 is also changed. RB7 changes state when RB4 is also toggled.
There is huge trouble in bottom 4 pins of pic16f1829. Is it due to peripherals or what?
 

It cannot be any peripherals because in post #3 you told us there were no peripherals connected.
Also time to show us all of you code including the config settings.
I’m also not clear on what is happening when you toggle individual pins. Can you toggle RC6 only and tell us which pins change. Then toggle RB4 and tell us the same thing; then the other pins individually.
What is the commercial board you are using?
Susan
 

this is my simple code which is failing:



Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* 
 * File:   newmain.c
 * Author: Administrator
 *
 * Created on 22 November, 2017, 9:38 PM
 */
 
#include <stdio.h>
#include <stdlib.h>
 
// PIC16F1829 Configuration Bit Settings
 
// 'C' source line config statements
 
#include <xc.h>
 
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
 
// CONFIG1
#pragma config FOSC = INTOSC    // Oscillator Selection (INTOSC oscillator: I/O function on CLKIN pin)
#pragma config WDTE = OFF        // Watchdog Timer Enable (WDT enabled)
#pragma config PWRTE = OFF      // Power-up Timer Enable (PWRT disabled)
#pragma config MCLRE = ON       // MCLR Pin Function Select (MCLR/VPP pin function is MCLR)
#pragma config CP = OFF         // Flash Program Memory Code Protection (Program memory code protection is disabled)
#pragma config CPD = OFF        // Data Memory Code Protection (Data memory code protection is disabled)
#pragma config BOREN = ON       // Brown-out Reset Enable (Brown-out Reset enabled)
#pragma config CLKOUTEN = OFF   // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin)
#pragma config IESO = ON        // Internal/External Switchover (Internal/External Switchover mode is enabled)
#pragma config FCMEN = ON       // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is enabled)
 
// CONFIG2
#pragma config WRT = OFF        // Flash Memory Self-Write Protection (Write protection off)
#pragma config PLLEN = ON       // PLL Enable (4x PLL enabled)
#pragma config STVREN = ON      // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will cause a Reset)
#pragma config BORV = LO        // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.)
#pragma config LVP = ON         // Low-Voltage Programming Enable (Low-voltage programming enabled)
 
/*
 * 
 */
int main(int argc, char** argv) {
    ANSELB=0x00;
    ANSELC=0x00;
    TRISB=0x00;
    TRISC=0x00;
  while(1){
      LATB=~LATB;
    }
    return (EXIT_SUCCESS);
}



output:
RB6= 0 to 2.0V
RC6 = 0.5 to 1V (even when i am not toggling PORTC)
RB5 = 0 to 3.3 V but with delay and fluctuations
RB7 = 0.1 to 2.0 V
RB4 = 0 to 3.3V perfect


i have a doubt that all these pins are related to MSSP 1 and MSSP2 ports somehow? so why these are not behaving as a normal GPIO?
i have tried the PIC16F1829 on general purpose pcb and three different pcb boards but the result is same. Plz help!!
 
Last edited by a moderator:

Apart from dropping the stdio and stdlib includes (they add nothing to your code - in fact nothing to most microcontroller code), beyond what has already been said I can only suggest that you actually set the EUSART and MSSP to disabled - they should come up as disabled but just in case...
I am still not clear on exactly what is happening - as I have said above, a table such as:
- LATB6 low -> pin RB6 0v, RB0 0V, RB1 .5v....
- LATB6 high -> pin RB6 1.5v,RB0 0v.....
so that we can see how individual pins interact would be helpful. Toggling the entire port is not necessarily going to show the problems.
Looking back through this thread I can't see where you have confirmed that you have a good quality and stable power supply and all of the bypass capacitors (etc.) in place.
Susan
 

OK finally i found that if i make the RB5 pin an input, RC6, RC7,RB7,RB6 becomes fixed at 3.3 V constant. No effect of any toggling happens (Neither individual pin toggling nor full port toggling works).
i think this indicates something. why RB5 has such dominance? plz help!!
 

Hi,

Very confusing. I can't think of any situation that causes such a behaviour.
Just an idea: Are you sure you use the correct microcontroller (exact name) with the correct compiler setup?

Show detailed photos of your circuit.

Klaus
 

hello,


How do you measure voltage level on any pins ?

Code:
  while(1){
      LATB=~LATB;
Delay_ms(5000);    // <-- to add
    }

with this runing code .. you get a signal of maybe 1MHz on all pins..
Measuring with a DC volmeter can give a so low composite DC value ..
add a delay of any seconds in the loop..

or use an oscilloscope with large band (100Mhz).
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top