TODOPIC

Microcontroladores PIC => Todo en microcontroladores PIC => Mensaje iniciado por: gioalex07 en 14 de Octubre de 2017, 03:20:15

Título: Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: gioalex07 en 14 de Octubre de 2017, 03:20:15
Hola comunidad.

Estoy adentrando en mi curso de digitales II usando el PIC18F4550 y llegue a un problema que no entiendo porque sucede.
En MPLAB asigno como salida el puerto B y en un ciclo infinito le digo que a todos los puertos tengan salida de VDD. Nada raro.. es un simple programa para comprobar si dichos pines funcionan correctamente para luego realizar un montaje de visualización dinámica con displays 7 segmentos de dos dígitos. El problema aparece cuando cargo el programa y miro que en los pines RB0 y RB1 no hay NADA.. He revisado el datasheet, apagado toda cosa posible de los pines multiplexados, además de poner en los bits de configuración los pines de salida digital pero NADA...

Si alguien sabe la respuesta les agradeceria mucho


Aca esta el codigo:


// PIC18F4550 Configuration Bit Settings

// 'C' source line config statements

// CONFIG1L
#pragma config PLLDIV = 1       // PLL Prescaler Selection bits (No prescale (4 MHz oscillator input drives PLL directly))
#pragma config CPUDIV = OSC1_PLL2// System Clock Postscaler Selection bits ([Primary Oscillator Src: /1][96 MHz PLL Src: /2])
#pragma config USBDIV = 1       // USB Clock Selection bit (used in Full-Speed USB mode only; UCFG:FSEN = 1) (USB clock source comes directly from the primary oscillator block with no postscale)

// CONFIG1H
#pragma config FOSC = INTOSC_XT  // Oscillator Selection bits (HS oscillator, PLL enabled (HSPLL))
#pragma config FCMEN = OFF      // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor disabled)
#pragma config IESO = OFF       // Internal/External Oscillator Switchover bit (Oscillator Switchover mode disabled)

// CONFIG2L
#pragma config PWRT = OFF       // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOR = ON         // Brown-out Reset Enable bits (Brown-out Reset enabled in hardware only (SBOREN is disabled))
#pragma config BORV = 3         // Brown-out Reset Voltage bits (Minimum setting 2.05V)
#pragma config VREGEN = OFF     // USB Voltage Regulator Enable bit (USB voltage regulator disabled)

// CONFIG2H
#pragma config WDT = OFF        // Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
#pragma config WDTPS = 32768    // Watchdog Timer Postscale Select bits (1:32768)

// CONFIG3H
#pragma config CCP2MX = ON      // CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)
#pragma config PBADEN = OFF      // PORTB A/D Enable bit (PORTB<4:0> pins are configured as analog input channels on Reset)
#pragma config LPT1OSC = OFF    // Low-Power Timer 1 Oscillator Enable bit (Timer1 configured for higher power operation)
#pragma config MCLRE = ON       // MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled)

// CONFIG4L
#pragma config STVREN = OFF      // Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset)
#pragma config LVP = OFF         // Single-Supply ICSP Enable bit (Single-Supply ICSP enabled)
#pragma config ICPRT = OFF      // Dedicated In-Circuit Debug/Programming Port (ICPORT) Enable bit (ICPORT disabled)
#pragma config XINST = OFF      // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode disabled (Legacy mode))

// CONFIG5L
#pragma config CP0 = OFF        // Code Protection bit (Block 0 (000800-001FFFh) is not code-protected)
#pragma config CP1 = OFF        // Code Protection bit (Block 1 (002000-003FFFh) is not code-protected)
#pragma config CP2 = OFF        // Code Protection bit (Block 2 (004000-005FFFh) is not code-protected)
#pragma config CP3 = OFF        // Code Protection bit (Block 3 (006000-007FFFh) is not code-protected)

// CONFIG5H
#pragma config CPB = OFF        // Boot Block Code Protection bit (Boot block (000000-0007FFh) is not code-protected)
#pragma config CPD = OFF        // Data EEPROM Code Protection bit (Data EEPROM is not code-protected)

// CONFIG6L
#pragma config WRT0 = OFF       // Write Protection bit (Block 0 (000800-001FFFh) is not write-protected)
#pragma config WRT1 = OFF       // Write Protection bit (Block 1 (002000-003FFFh) is not write-protected)
#pragma config WRT2 = OFF       // Write Protection bit (Block 2 (004000-005FFFh) is not write-protected)
#pragma config WRT3 = OFF       // Write Protection bit (Block 3 (006000-007FFFh) is not write-protected)

// CONFIG6H
#pragma config WRTC = OFF       // Configuration Register Write Protection bit (Configuration registers (300000-3000FFh) are not write-protected)
#pragma config WRTB = OFF       // Boot Block Write Protection bit (Boot block (000000-0007FFh) is not write-protected)
#pragma config WRTD = OFF       // Data EEPROM Write Protection bit (Data EEPROM is not write-protected)

// CONFIG7L
#pragma config EBTR0 = OFF      // Table Read Protection bit (Block 0 (000800-001FFFh) is not protected from table reads executed in other blocks)
#pragma config EBTR1 = OFF      // Table Read Protection bit (Block 1 (002000-003FFFh) is not protected from table reads executed in other blocks)
#pragma config EBTR2 = OFF      // Table Read Protection bit (Block 2 (004000-005FFFh) is not protected from table reads executed in other blocks)
#pragma config EBTR3 = OFF      // Table Read Protection bit (Block 3 (006000-007FFFh) is not protected from table reads executed in other blocks)

// CONFIG7H
#pragma config EBTRB = OFF      // Boot Block Table Read Protection bit (Boot block (000000-0007FFh) is not protected from table reads executed in other blocks)

// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.


#include <xc.h>
#define _XTAL_FREQ 4000000

void main(void) {
   
    OSCCONbits.SCS = 11;
    OSCCONbits.IRCF = 110;
   
    ADCON1bits.PCFG0 = 1;
    ADCON1bits.PCFG1 = 1;
    ADCON1bits.PCFG2 = 1;
    ADCON1bits.PCFG3 = 1;
   
    TRISBbits.RB0 = 0;
    TRISBbits.RB1 = 0;
    TRISBbits.RB2 = 0;
    TRISBbits.RB3 = 0;
    TRISBbits.RB4 = 0;
    TRISBbits.RB5 = 0;
    TRISBbits.RB6 = 0;
    TRISBbits.RB7 = 0;


    TRISDbits.RD0 = 1;
    TRISDbits.RD1 = 1;
    TRISDbits.RD2 = 0;
    TRISDbits.RD3 = 0;
   
   
   


    //int leds_unidad [10] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x67};
    int leds_unidad [10] = {0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x18};
    int uni,dec,contador = 0;
   
    while(1){
       
       PORTDbits.RD2 = 1;
       PORTDbits.RD3 = 0;
       
       LATBbits.LATB0 = 1;
       LATBbits.LATB1 = 1;
       LATBbits.LATB2 = 1;
       LATBbits.LATB3 = 1;
       LATBbits.LATB4 = 1;
       LATBbits.LATB5 = 1;
       LATBbits.LATB6 = 1;
       
       __delay_ms(15);
       
       PORTDbits.RD2 = 0;
       PORTDbits.RD3 = 1;
       
       LATBbits.LATB0 = 1;
       LATBbits.LATB1 = 1;
       LATBbits.LATB2 = 1;
       LATBbits.LATB3 = 1;
       LATBbits.LATB4 = 1;
       LATBbits.LATB5 = 1;
       LATBbits.LATB6 = 1;
       __delay_ms(15);
       
       
       /*
       RA2 = 1;
       RA3 = 0;
       PORTB = leds_unidad[uni];
       __delay_ms(15);
       
       RA2 = 0;
       RA3 = 1;
       PORTB = leds_unidad[dec];
       __delay_ms(15);
       
       
       
       
       if((RA0 == 0) && (RA1 == 1)){
           __delay_ms(20);
           
           if((RA0 == 0) && (RA1 == 1)){
               __delay_ms(1000);
               
               if((RA0 == 0) && (RA1 == 1)){
                   
                   if(contador<99){
                       contador++;
                   }
                   else{
                       contador = 0;
                   }
               }
           }
       }
       
       if((RA0 == 1) && (RA1 == 0)){
           __delay_ms(20);
           
           if((RA0 == 1) && (RA1 == 0)){
               __delay_ms(1000);
               
               if((RA0 == 1) && (RA1 == 0)){
                   
                   if(contador>0){
                       contador--;
                   }
                   
                   else{
                       contador = 99;
                   }
               }   
           }
       }
       */
     
       dec = contador/10;
       uni = contador%10;
       
    }
    return;
}
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: KILLERJC en 14 de Octubre de 2017, 13:41:55
Las cosas que veo en tu programa son:

Estas usando PORTx en ves de LATx:

Código: C
  1. PORTDbits.RD2 = 1;
  2.        PORTDbits.RD3 = 0;
Código: C
  1. PORTB = leds_unidad[uni];

Para usar el PORTA como digital, como bien dice el datasheet debes: poner 0xF en ADCON1, lo cual estas haciendo, pero tambien poner 0x07 en CMCON que es lo que falta.
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: gioalex07 en 14 de Octubre de 2017, 15:50:59
Gracias por la indicación pero estoy usando es el puerto B.. El puerto A solo lo uso para pulsadores y visualización dinámica (4 puertos) aún así, al colocar ese registro dio un 0 en RB1 pero nada en RB0... El problema radica en esos dos pines.. En cuanto a la aplicación e información que me indicas ya hice las modificaciones

Gracias y espero tu respuesta ya que no se que más hacer para que funcionen correctamente esos dos puertos

** Donde esta /* desde ahí esta comentado para compilador



// PIC18F4550 Configuration Bit Settings

// 'C' source line config statements

// CONFIG1L
#pragma config PLLDIV = 1       // PLL Prescaler Selection bits (No prescale (4 MHz oscillator input drives PLL directly))
#pragma config CPUDIV = OSC1_PLL2// System Clock Postscaler Selection bits ([Primary Oscillator Src: /1][96 MHz PLL Src: /2])
#pragma config USBDIV = 1       // USB Clock Selection bit (used in Full-Speed USB mode only; UCFG:FSEN = 1) (USB clock source comes directly from the primary oscillator block with no postscale)

// CONFIG1H
#pragma config FOSC = INTOSC_XT  // Oscillator Selection bits (HS oscillator, PLL enabled (HSPLL))
#pragma config FCMEN = OFF      // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor disabled)
#pragma config IESO = OFF       // Internal/External Oscillator Switchover bit (Oscillator Switchover mode disabled)

// CONFIG2L
#pragma config PWRT = OFF       // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOR = ON         // Brown-out Reset Enable bits (Brown-out Reset enabled in hardware only (SBOREN is disabled))
#pragma config BORV = 3         // Brown-out Reset Voltage bits (Minimum setting 2.05V)
#pragma config VREGEN = OFF     // USB Voltage Regulator Enable bit (USB voltage regulator disabled)

// CONFIG2H
#pragma config WDT = OFF        // Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
#pragma config WDTPS = 32768    // Watchdog Timer Postscale Select bits (1:32768)

// CONFIG3H
#pragma config CCP2MX = ON      // CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)
#pragma config PBADEN = OFF      // PORTB A/D Enable bit (PORTB<4:0> pins are configured as analog input channels on Reset)
#pragma config LPT1OSC = OFF    // Low-Power Timer 1 Oscillator Enable bit (Timer1 configured for higher power operation)
#pragma config MCLRE = ON       // MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled)

// CONFIG4L
#pragma config STVREN = OFF      // Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset)
#pragma config LVP = OFF         // Single-Supply ICSP Enable bit (Single-Supply ICSP enabled)
#pragma config ICPRT = OFF      // Dedicated In-Circuit Debug/Programming Port (ICPORT) Enable bit (ICPORT disabled)
#pragma config XINST = OFF      // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode disabled (Legacy mode))

// CONFIG5L
#pragma config CP0 = OFF        // Code Protection bit (Block 0 (000800-001FFFh) is not code-protected)
#pragma config CP1 = OFF        // Code Protection bit (Block 1 (002000-003FFFh) is not code-protected)
#pragma config CP2 = OFF        // Code Protection bit (Block 2 (004000-005FFFh) is not code-protected)
#pragma config CP3 = OFF        // Code Protection bit (Block 3 (006000-007FFFh) is not code-protected)

// CONFIG5H
#pragma config CPB = OFF        // Boot Block Code Protection bit (Boot block (000000-0007FFh) is not code-protected)
#pragma config CPD = OFF        // Data EEPROM Code Protection bit (Data EEPROM is not code-protected)

// CONFIG6L
#pragma config WRT0 = OFF       // Write Protection bit (Block 0 (000800-001FFFh) is not write-protected)
#pragma config WRT1 = OFF       // Write Protection bit (Block 1 (002000-003FFFh) is not write-protected)
#pragma config WRT2 = OFF       // Write Protection bit (Block 2 (004000-005FFFh) is not write-protected)
#pragma config WRT3 = OFF       // Write Protection bit (Block 3 (006000-007FFFh) is not write-protected)

// CONFIG6H
#pragma config WRTC = OFF       // Configuration Register Write Protection bit (Configuration registers (300000-3000FFh) are not write-protected)
#pragma config WRTB = OFF       // Boot Block Write Protection bit (Boot block (000000-0007FFh) is not write-protected)
#pragma config WRTD = OFF       // Data EEPROM Write Protection bit (Data EEPROM is not write-protected)

// CONFIG7L
#pragma config EBTR0 = OFF      // Table Read Protection bit (Block 0 (000800-001FFFh) is not protected from table reads executed in other blocks)
#pragma config EBTR1 = OFF      // Table Read Protection bit (Block 1 (002000-003FFFh) is not protected from table reads executed in other blocks)
#pragma config EBTR2 = OFF      // Table Read Protection bit (Block 2 (004000-005FFFh) is not protected from table reads executed in other blocks)
#pragma config EBTR3 = OFF      // Table Read Protection bit (Block 3 (006000-007FFFh) is not protected from table reads executed in other blocks)

// CONFIG7H
#pragma config EBTRB = OFF      // Boot Block Table Read Protection bit (Boot block (000000-0007FFh) is not protected from table reads executed in other blocks)

// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.


#include <xc.h>
#define _XTAL_FREQ 4000000

void main(void) {
   
    OSCCONbits.SCS = 11;
    OSCCONbits.IRCF = 110;
   
    ADCON1bits.PCFG0 = 1;
    ADCON1bits.PCFG1 = 1;
    ADCON1bits.PCFG2 = 1;
    ADCON1bits.PCFG3 = 1;
   
    CMCON = 0x07;
   
    TRISBbits.RB0 = 0;
    TRISBbits.RB1 = 0;
    TRISBbits.RB2 = 0;
    TRISBbits.RB3 = 0;
    TRISBbits.RB4 = 0;
    TRISBbits.RB5 = 0;
    TRISBbits.RB6 = 0;
    TRISBbits.RB7 = 0;


    TRISDbits.RD0 = 1;
    TRISDbits.RD1 = 1;
    TRISDbits.RD2 = 0;
    TRISDbits.RD3 = 0;
   
   
   


    //int leds_unidad [10] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x67};
    int leds_unidad [10] = {0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x18};
    int uni,dec,contador = 0;
   
    while(1){
       
       LATDbits.RD2 = 1;
       LATDbits.RD3 = 0;
       
       LATBbits.LATB0 = 1;
       LATBbits.LATB1 = 1;
       LATBbits.LATB2 = 1;
       LATBbits.LATB3 = 1;
       LATBbits.LATB4 = 1;
       LATBbits.LATB5 = 1;
       LATBbits.LATB6 = 1;
       
       __delay_ms(15);
       
       LATDbits.RD2 = 0;
       LATDbits.RD3 = 1;
       
       LATBbits.LATB0 = 1;
       LATBbits.LATB1 = 1;
       LATBbits.LATB2 = 1;
       LATBbits.LATB3 = 1;
       LATBbits.LATB4 = 1;
       LATBbits.LATB5 = 1;
       LATBbits.LATB6 = 1;
       __delay_ms(15);
       
       
       /*
       RA2 = 1;
       RA3 = 0;
       PORTB = leds_unidad[uni];
       __delay_ms(15);
       
       RA2 = 0;
       RA3 = 1;
       PORTB = leds_unidad[dec];
       __delay_ms(15);
       
       
       
       
       if((RA0 == 0) && (RA1 == 1)){
           __delay_ms(20);
           
           if((RA0 == 0) && (RA1 == 1)){
               __delay_ms(1000);
               
               if((RA0 == 0) && (RA1 == 1)){
                   
                   if(contador<99){
                       contador++;
                   }
                   else{
                       contador = 0;
                   }
               }
           }
       }
       
       if((RA0 == 1) && (RA1 == 0)){
           __delay_ms(20);
           
           if((RA0 == 1) && (RA1 == 0)){
               __delay_ms(1000);
               
               if((RA0 == 1) && (RA1 == 0)){
                   
                   if(contador>0){
                       contador--;
                   }
                   
                   else{
                       contador = 99;
                   }
               }   
           }
       }
       */
     
       dec = contador/10;
       uni = contador%10;
       
    }
    return;
}
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: KILLERJC en 14 de Octubre de 2017, 17:45:00
Esto deberia funcionar correctamente:

Código: C
  1. void main(void) {
  2.    
  3.     OSCCONbits.SCS = 11;
  4.     OSCCONbits.IRCF = 110;
  5.    
  6.     ADCON1 = 0x0F;
  7.     CMCON = 0x07;
  8.    
  9.     TRISB = 0;
  10.     TRISD = 0x3;
  11.  
  12.     LATB = 0xEF;
  13.    
  14.     while(1){
  15.        
  16.        LATDbits.LATD2 = 1;
  17.        LATDbits.LATD3 = 0;
  18.      
  19.        __delay_ms(15);
  20.        
  21.        LATDbits.LATD2 = 0;
  22.        LATDbits.LATD3 = 1;
  23.        
  24.        __delay_ms(15);
  25.     }
  26. }

Es lo mismo que tenes vos, el PORTB no cambia para nada en tu codigo. Siguen todas las salidas en 1.
Si queres que cambien, ahi te paso el codigo que cambia todos los pines del PORTB juntos:

Código: C
  1. void main(void) {
  2.    
  3.     OSCCONbits.SCS = 11;
  4.     OSCCONbits.IRCF = 110;
  5.    
  6.     ADCON1 = 0x0F;
  7.     CMCON = 0x07;
  8.    
  9.     TRISB = 0;
  10.     TRISD = 0x3;
  11.  
  12.     while(1){
  13.        
  14.        LATDbits.LATD2 = 1;
  15.        LATDbits.LATD3 = 0;
  16.  
  17.        LATB = 0xFF;
  18.        
  19.        __delay_ms(15);
  20.        
  21.        LATDbits.LATD2 = 0;
  22.        LATDbits.LATD3 = 1;
  23.        
  24.        LATB = 0x00;
  25.        
  26.        __delay_ms(15);
  27.     }
  28. }
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: gioalex07 en 14 de Octubre de 2017, 17:59:14
Cargue el programa que me facilitaste pero nada resulta.. Uso la punta lógica para mirar si en rb0 y rb1 hay 5V pero no..
En RB0 no hay nada y RB1 carga un 0 lógico como si fuese entrada..

Que pena contigo enserio pero no entiendo que pasa..
Adjunto imagen del puerto RB1 (verde significa el 0 lógico) .. en RB0 no alumbra ningún led asi que..

Gracias
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: KILLERJC en 14 de Octubre de 2017, 18:26:34
Disculpa pense que lo estabas viendo en una simulacion. Si observas tenes 15ms de delay, algo que no vas a ver con una punta logica.

Un '0 logico' no significa que este como entrada, si esta como entrada significa que tenes una alta impedancia, y no un '0 logico', la unica forma que tengas un 0 logico es que este como salida y este el bit del LATB en 0. Aumentale el delay, asi podes ver algo:

Código: C
  1. void main(void) {
  2.    
  3.     OSCCONbits.SCS = 11;
  4.     OSCCONbits.IRCF = 110;
  5.    
  6.     ADCON1 = 0x0F;
  7.     CMCON = 0x07;
  8.    
  9.     TRISB = 0;
  10.     TRISD = 0x3;
  11.  
  12.     while(1){
  13.        
  14.        LATDbits.LATD2 = 1;
  15.        LATDbits.LATD3 = 0;
  16.  
  17.        LATB = 0xFF;
  18.        
  19.        __delay_ms(500);
  20.        
  21.        LATDbits.LATD2 = 0;
  22.        LATDbits.LATD3 = 1;
  23.        
  24.        LATB = 0x00;
  25.        
  26.        __delay_ms(500);
  27.     }
  28. }

PD: No me fije pero espero que tengas una resistencia en el MCLR a VDD
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: gioalex07 en 14 de Octubre de 2017, 18:32:22
Si claro .. configuración básica para el funcionamiento del pic

Cargue el programa y pues ahora pasa que se cambio ... En RB1 no hay nada y en RB0 esta verde mi punta lógica

No se la verdad que sucede... No me indica el alto en ningún momento.. en cambio desde RB2 hasta RB7 están perfectos

Es que literal simplifiquemos el dilema y si me ayudas.. Solo quiero usar RB0 y RB1 como salidas para prender un LED. Si esto funciona ya puedo avanzar sin problemas pero es lo único que no me ha funcionado

Gracias
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: KILLERJC en 14 de Octubre de 2017, 19:18:13
Bueno entonces es un problema de RB0 y RB1..

Mirando que funciones tienen los pines:

RB1/AN10/INT1/SCK/SCL
RB0/AN12/INT0/FLT0/SDI/SDA

- La funcion ANx sabemos que ya lo quitamos al poner el ADCON1 a 0xF
- Los INTx no afectan en el funcioanmiento del pin en digital.
- SCK/SCL/SDI/SDA son del I2C, por las dudas vamos a setear el registro SSPCON1 a 0. A pesar que en el reset deberian estar a 0.
- FLT0 es del PWM, por las dudas vamos a deshabilitarlo, para eso ponemos CCP1CON a 0

Y ya no tenemos nada que nos afecte, si aun asi no funciona. Seguramente tengas quemado esos pines. Si posees otro PIC para probar mejor.

Código: C
  1. void main(void) {
  2.    
  3.     OSCCONbits.SCS = 11;
  4.     OSCCONbits.IRCF = 110;
  5.    
  6.     ADCON1 = 0x0F;
  7.     CMCON = 0x07;
  8.     SSPCON1 = 0;
  9.     CCP1CON = 0;
  10.    
  11.     TRISB = 0;
  12.     TRISD = 0x3;
  13.  
  14.  
  15.     while(1){
  16.        
  17.        LATDbits.LATD2 = 1;
  18.        LATDbits.LATD3 = 0;
  19.  
  20.        LATB = 0xFF;
  21.        
  22.        __delay_ms(500);
  23.        
  24.        LATDbits.LATD2 = 0;
  25.        LATDbits.LATD3 = 1;
  26.        
  27.        LATB = 0x00;
  28.        
  29.        __delay_ms(500);
  30.     }
  31. }

PD: Los fuses dicen que RB0 a RB3 estan como digitales, y RB2/RB3 funcionan, entonces estan bien.
PD2: Sino usa otro pin. Nada evita que
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: gioalex07 en 14 de Octubre de 2017, 19:21:16
Pues siguió igual... Entonces hablaré con un compañero que también tiene el PIC para corroborar si los tengo quemados

Muchas gracias y estaré preguntando de nuevo si esto no cambia en otro PIC.


*********

Nueva sorpresa

Cargue mi programa inicial y en RB0 y RB1 ahora me aparece el bajo (verde de mi punta lógica)... Ahora que será ?
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: pablomanieri en 14 de Octubre de 2017, 23:56:45
Hola, la fuente de 5v es de buena calidad?
Agrega capacitores de 100nf entre los pines VDD y VSS.
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: KILLERJC en 15 de Octubre de 2017, 00:29:12
Ahora esta entre la fuente, el PIC y la punta logica  :D
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: gioalex07 en 15 de Octubre de 2017, 00:55:51
Jajaja pues se los agrego pero de igual forma no están dando la salida de 5V en RB0 y RB1

No se que más hacer porque esto no tiene ningún sentido..

Probé cargando un nuevo programa y nada solo arroja un 0 en vez del 1 .. :(
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: thegame en 17 de Octubre de 2017, 03:16:44
Bueno, buscando comprobar los pines, he creado un programa sencillo que hace parpadear los pines RB0 y RB1 del PIC, ya que tengo ese PIC he podido probar físicamente su funcionamiento, carga el .HEX que adjunto, si no te parpadea, olvidalo estan dañados.

Quita el oscilador externo si tienes alguno, mi programa funciona con el oscilador interno, solo deja la resistencia del MCLR y la alimentacion, coloca unos leds en RB0 y RB1 si lo deseas, o mide con multimetro o punta logica.

Saludos
Título: Re:Declaración de salida pines RB0 Y RB1 PIC18F4550
Publicado por: gioalex07 en 17 de Octubre de 2017, 19:26:49
Pues cargue tu programa y nada.. no registra ningún dato. Esta semana probare con otro pic de un compañero y si funciona es que el mio esta dañado y nada que hacer

MUCHAS GRACIAS !!!