#include <18f2550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=20000000)
#use rs232(baud=19200, xmit=PIN_C6, rcv=PIN_C7)
#define SELECTOR PIN_A0
#define LEDV PIN_B6
#define LEDR PIN_B7
#define LED_ON output_high
#define LED_OFF output_low
#include <usb_cdc.h>
char c=0x00;
char rec=0x00;
void menu (void);
////******************************************************************************************
//#build(reset=0x800)
// #build(interrupt=0x808)
// #org 0x0000,0x07ff
// void bootloader() {
// #asm
// nop
// #endasm
//} // Reserve space for the bootloader
//******************************************************************************************
void menu (void){
printf(usb_cdc_putc,"\r\n");
printf(usb_cdc_putc,"Menu:\r\n");
printf(usb_cdc_putc," [R] Leer DATO\r\n");
printf(usb_cdc_putc," [C] Configurar Canal\r\n");
printf(usb_cdc_putc," [X] Salir\r\n\n");
printf(usb_cdc_putc,"\r\n");
printf(usb_cdc_putc,"\r\n");
printf(usb_cdc_putc,"Comando: ");
rec=toupper(usb_cdc_getc());
}
//********************************************************************************************
void main() {
LED_OFF(LEDV);
LED_ON(LEDR);
usb_cdc_init();
usb_init();
while (TRUE) {
usb_task();
// if(usb_enumerated()){
if (input (SELECTOR)){
LED_ON(LEDR);
LED_OFF(LEDV);
printf(usb_cdc_putc,"Prendio el Led ROJO \r\n");
Delay_ms(300);
}
else{
LED_OFF(LEDR);
LED_ON(LEDV);
printf(usb_cdc_putc,"Prendio el Led VERDE \r\n");
Delay_ms(300);
menu();
// }
}
}
}
#include <18F2550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=48000000)
#include <usb_cdc.h>
#include <usb_desc_cdc.h>
void main() {
usb_cdc_init();
usb_init(); //inicializamos el USB
while (!usb_cdc_connected()) {}
while (true)
{
usb_task();
if(usb_enumerated())
{
usb_cdc_putc(0x41);
}
}
}
Te has confundido al teclear Diego, es la 3.242.
Y con la 3.249 ya se podían compilar programas con USB? Yo estoy ahora liao (y bien liao) en lo del USB y compilando con la 4.058 de momento los que he hecho no me han dado problemas (tanto en CDC como en BULK).