Buenos días,
tengo un PIC18F67J50 con puerto USB y bootloader, el del siguiente enlace: http://www.superrobotica.com/S310442.htm
Resulta que he hecho un programa muy sencillo utilizando MPLAB X IDE y XC8, básicamente consiste en configurar 3 salidas digitales, 2 que parpadean alternativamente cada 500ms, y otra activa en todo momento. El código del programa en C es el que sigue:// PIC18F67J50 Configuration Bit Settings
// 'C' source line config statements
// CONFIG1L
#pragma config WDTEN = OFF // Watchdog Timer Enable bit (WDT disabled (control is placed on SWDTEN bit))
#pragma config PLLDIV = 1 // PLL Prescaler Selection bits (No prescale (4 MHz oscillator input drives PLL directly))
#pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable bit (Reset on stack overflow/underflow enabled)
#pragma config XINST = OFF // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode enabled)
// CONFIG1H
#pragma config CPUDIV = OSC1 // CPU System Clock Postscaler (No CPU system clock divide)
#pragma config CP0 = OFF // Code Protection bit (Program memory is not code-protected)
// CONFIG2L
#pragma config FOSC = INTOSCPLL // Oscillator Selection bits (INTOSC with PLL enabled, Port function on RA6 and RA7)
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor enabled)
#pragma config IESO = ON // Two-Speed Start-up (Internal/External Oscillator Switchover) Control bit (Two-Speed Start-up enabled)
// CONFIG2H
#pragma config WDTPS = 32768 // Watchdog Timer Postscaler Select bits (1:32768)
// CONFIG3L
// CONFIG3H
#pragma config CCP2MX = DEFAULT // ECCP2 MUX bit (ECCP2/P2A is multiplexed with RC1)
#pragma config MSSPMSK = MSK7 // MSSP Address Masking Mode Select bit (7-Bit Address Masking mode enable)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#include <xc.h>
#define _XTAL_FREQ 48000000
void main(void) {
TRISA=0;
while(1){
PORTAbits.RA0=1;
PORTAbits.RA3=0;
__delay_ms(500);
PORTAbits.RA0=0;
PORTAbits.RA3=1;
__delay_ms(500);
}
PORTAbits.RA2=1;
return;
}
Hecho esto (el programa en C), compilo (le doy a clean and build) mostrándose el siguiente resultado en la pantallita de abajo:CLEAN SUCCESSFUL (total time: 12ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/Carmen y Javi/MPLABXProjects/pruebas.X'
make -f nbproject/Makefile-default.mk dist/default/production/pruebas.X.production.hex
make[2]: Entering directory 'C:/Users/Carmen y Javi/MPLABXProjects/pruebas.X'
"C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" -mcpu=18F67J50 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/HolaMundo.p1 HolaMundo.c
"C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" -mcpu=18F67J50 -Wl,-Map=dist/default/production/pruebas.X.production.map -DXPRJ_default=default -Wl,--defsym=__MPLAB_BUILD=1 -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -Wl,--memorysummary,dist/default/production/memoryfile.xml -o dist/default/production/pruebas.X.production.elf build/default/production/HolaMundo.p1
Memory Summary:
Program space used 4Eh ( 78) of 1FFF8h bytes ( 0.1%)
Data space used 2h ( 2) of F40h bytes ( 0.1%)
Configuration bits used 3h ( 3) of 3h words (100.0%)
Data stack space used 0h ( 0) of EE0h bytes ( 0.0%)
make[2]: Leaving directory 'C:/Users/Carmen y Javi/MPLABXProjects/pruebas.X'
make[1]: Leaving directory 'C:/Users/Carmen y Javi/MPLABXProjects/pruebas.X'
BUILD SUCCESSFUL (total time: 1s)
Loading code from C:/Users/Carmen y Javi/MPLABXProjects/pruebas.X/dist/default/production/pruebas.X.production.hex...
Loading completed
Y hecho lo cual, tengo ya el código en hexadecimal el cual muestro a continuación::020000040000FA
:04000000D7EFFFF047
:020000040001F9
:10FFAE000001DAEFFFF0000E926E808080961F0E39
:10FFBE00026E710E016E1E0EE82EFED7012EFCD7BC
:10FFCE00022EFAD700D0809080861F0E026E710E20
:10FFDE00016E1E0EE82EFED7012EFCD7022EFAD78A
:0AFFEE0000D0DCEFFFF000EF00F0A0
:06FFF800AEF7C2FFF8F9AC
:00000001FF
Cargo el programa con el bootloader, aparece que todo se ha cargado correctamente pero hago las conexiones con los pin correspondientes y no funciona.
en el único sitio que consigo que se encienda el led que conecto es conectando las patillas a los pines de 3,3V y 0V.
Muchísimas gracias de antemano.