Autor Tema: ayuda hola mundo dspic33fj12mc201 mplab x  (Leído 2150 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado plcisrael

  • PIC10
  • *
  • Mensajes: 8
ayuda hola mundo dspic33fj12mc201 mplab x
« en: 22 de Mayo de 2017, 19:49:23 »
saludos mundo intento realizar el primer programa en un dspic la compilacion es correcta y la simulacion en proteus es normal el problema es al cargar el micro no hace nada intente varios metodos (un dsp nuevo, cambiar cristal, uso de cristal interno) pero nada. Espero que puedan ayudarme esta en mplab x xc16 adjunto el codigo

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


// DSPIC33FJ12MC201 Configuration Bit Settings

// 'C' source line config statements

#include <xc.h>
#include <libpic30.h>

// FBS
#pragma config BWRP = WRPROTECT_OFF     // Boot Segment Write Protect (Boot Segment may be written)
#pragma config BSS = NO_FLASH           // Boot Segment Program Flash Code Protection (No Boot program Flash segment)

// FGS
#pragma config GWRP = OFF               // General Code Segment Write Protect (User program memory is not write-protected)
#pragma config GSS = OFF                // General Segment Code Protection (User program memory is not code-protected)

// FOSCSEL
#pragma config FNOSC = FRC              // Oscillator Mode (Internal Fast RC (FRC))
#pragma config IESO = ON                // Internal External Switch Over Mode (Start-up device with FRC, then automatically switch to user-selected oscillator source when ready)

// FOSC
#pragma config POSCMD = NONE            // Primary Oscillator Source (Primary Oscillator Disabled)
#pragma config OSCIOFNC = ON            // OSC2 Pin Function (OSC2 pin has digital I/O function)
#pragma config IOL1WAY = ON             // Peripheral Pin Select Configuration (Allow Only One Re-configuration)
#pragma config FCKSM = CSDCMD           // Clock Switching and Monitor (Both Clock Switching and Fail-Safe Clock Monitor are disabled)

// FWDT
#pragma config WDTPOST = PS32768        // Watchdog Timer Postscaler (1:32,768)
#pragma config WDTPRE = PR128           // WDT Prescaler (1:128)
#pragma config WINDIS = OFF             // Watchdog Timer Window (Watchdog Timer in Non-Window mode)
#pragma config FWDTEN = OFF             // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software)

// FPOR
#pragma config FPWRT = PWR128           // POR Timer Value (128ms)
#pragma config ALTI2C = OFF             // Alternate I2C  pins (I2C mapped to SDA1/SCL1 pins)
#pragma config LPOL = ON                // Motor Control PWM Low Side Polarity bit (PWM module low side output pins have active-high output polarity)
#pragma config HPOL = ON                // Motor Control PWM High Side Polarity bit (PWM module high side output pins have active-high output polarity)
#pragma config PWMPIN = ON              // Motor Control PWM Module Pin Mode bit (PWM module pins controlled by PORT register at device Reset)

// FICD
#pragma config ICS = PGD1               // Comm Channel Select (Communicate on PGC1/EMUC1 and PGD1/EMUD1)
#pragma config JTAGEN = OFF             // JTAG Port Enable (JTAG is Disabled)

/*
 *
 */


int main() {
    TRISA = 0;

    while (1) {
        PORTA = 0;
        __delay32(15000000);
        PORTA = 1;
        __delay32(15000000);
    }

    return 0;
}

Desconectado KILLERJC

  • Colaborador
  • DsPIC33
  • *****
  • Mensajes: 8242
Re:ayuda hola mundo dspic33fj12mc201 mplab x
« Respuesta #1 en: 22 de Mayo de 2017, 22:37:56 »
Citar
la simulacion en proteus es normal

Nunca le creo a ese simulador, es bueno en algunas cosas.. pero lamentablemente en muchas falla.

¿A los pines Los pasaste a digital ?:
Citar
The AD1PCFGL register has a default value of 0x0000; therefore, all pins that share ANx functions are analog (not digital) by default.


Desconectado plcisrael

  • PIC10
  • *
  • Mensajes: 8
Re:ayuda hola mundo dspic33fj12mc201 mplab x
« Respuesta #2 en: 23 de Mayo de 2017, 11:06:03 »
AD1PCFGL = 0x0000;

ahora si trabaja.

Muchas gracias.
« Última modificación: 23 de Mayo de 2017, 11:11:51 por plcisrael »

Desconectado Pinolillo16

  • PIC18
  • ****
  • Mensajes: 324
Re:ayuda hola mundo dspic33fj12mc201 mplab x
« Respuesta #3 en: 28 de Junio de 2017, 21:12:24 »
plcisrael, deberias seguir posteando tus ejemplos en los que trabajas para alimentar mas este foro de DSP ya que casi no hay información ni ejemplos de los DSPIC mas actuales.

Saludos


 

anything