Buenas,
Estoy usando el PIC32MX250F128B. Tengo el siguiente código, y lo quiero simular:
#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.