Thanks in advanced for your help

jjw
Moderator: Benj
Once the user has chosen which program to boot, you can re-initialize the microcontroller by resetting the I/O pins to whatever it is you want (as long as it doesn't conflict with the USART/USB hardware).PIC 18F252 Bootloader v0.0:
(Press corresponding number to boot a program)
1) Program 1
2) Program 2
3) Program 3
... Waiting user input ...
Code: Select all
// main
IO_Init(); // initialise IO for USB
USBSerial_Init(); // initialise USB Serial
USBSerial_SendString("PIC 18F252 Bootloader v0.0:\n(Press corresponding number to boot a program)\n ...etc"); // send string throug USB Serial
// main loop
while (1)
{
user_response = USB_waitForUserInput(); // loop in function while no char received
switch(user_response)
{
case '1': // if user pressed 1
bootProgram1(); // call program 1
break;
case '2': // if user pressed 2
bootProgram2(); // call program 2
break;
case '3': // if user pressed 3
bootProgram3(); // call program 3
break;
default: // if user sent anything else than 1, 2 or 3
// error, received char not recognized
}
}