Autor Tema: Simular pic32  (Leído 2892 veces)

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

Desconectado aleix111

  • PIC10
  • *
  • Mensajes: 14
Simular pic32
« en: 15 de Noviembre de 2012, 13:30:02 »
Buenas,
Estoy usando el PIC32MX250F128B. Tengo el siguiente código, y lo quiero simular:
Código: [Seleccionar]
#include <p32mx250f128b.h>                // include chip specific header file
#include <plib.h>                   // include peripheral library functions
 
// Configuration Bits
#pragma config FNOSC = FRCPLL       // Internal Fast RC oscillator (8 MHz) w/ PLL
#pragma config FPLLIDIV = DIV_2     // Divide FRC before PLL (now 4 MHz)
#pragma config FPLLMUL = MUL_20     // PLL Multiply (now 80 MHz)
#pragma config FPLLODIV = DIV_2     // Divide After PLL (now 40 MHz)
                                    // see figure 8.1 in datasheet for more info
#pragma config FWDTEN = OFF         // Watchdog Timer Disabled
#pragma config ICESEL = ICS_PGx1    // ICE/ICD Comm Channel Select
#pragma config JTAGEN = OFF         // Disable JTAG
#pragma config FSOSCEN = OFF        // Disable Secondary Oscillator
 
#define SYSCLK 40000000L
 
int main( void)
{
int a=5;

     ANSELB = 0;                     // PortB digital
     TRISBbits.TRISB3 = 1;           // RB3 -> Input

    while(1)
    {
if (PORTBbits.RB3)
{
a=1;
}
else
{
a=2;
}
   }
    return 1;
}
1)Con Debugger > Select tool > MPLAB SIM: Haciendo "Stimulus" de RB3, no hace nada. La variable "a" siempre vale 2. Imagino que no me funciona porque no está implementado el MPLAB SIM para pic32. (En Configure > Select Device esta marcado MPLAB SIM de color amarillo).

2)Con Debugger > Select tool > MPLAB ICD3: Se me conecta bien, pero cuando intento hacer "Run", se me cuelga el PC. Al quitar la alimentación de mi placa, o al desconectar el ICD3 de mi placa, se descuelga el PC inmediatamente. Creo que no es problema de las conexiones de mi PIC, ya que lo puedo programar bien con el ICD3, solo hay error al hacer el debugger.

Alguien sabe como lo puedo hacer?
Muchas gracias.
« Última modificación: 15 de Noviembre de 2012, 13:47:08 por aleix111 »

Desconectado aleix111

  • PIC10
  • *
  • Mensajes: 14
Re: Simular pic32
« Respuesta #1 en: 29 de Noviembre de 2012, 07:58:06 »
Buenas. Ya la solucioné:
1)los pic32 no están completamente implementados en MPLAB SIM. Por este motivo los "stimulus" en los puertos donde hay ADC no los reconoce, encambio a los otros puertos si.

2)Para utilizar el debugger con MPLAB ICD3 se tiene que seguir el siguiente orden:
Citar
1)Abro mi programa con el código
2)selecciono "debug" en vez de "release"
3)Programer>select program>MPLAB ICD3
4)Built all
5)Program
6)Programer>select programer>none
7)Debugger>select tool>MPLAB ICD3 (AHORA NO SE CUELGA!!)
8)Built all
9)Program
10)run: no se ha cuelga, y funciona


 

anything