If you look to the numbers, you are only 22 bytes short (or program locations) and it's in the function u9603_int. I'm not exactly sure what that function is, I guess by looking at the name, it either is a serial port bitbang routine (9600 baud) or an integer math routine. Your main loop might be as long as this because you are using some library functions. Easiest way out is to split the loop up into a few parts and #seperate them (as Shawn already wrote). If you're short on execution time, it's best to leave the main loop as intact as possible, but maybe you can move all the initialization stuff out and #seperate that part. You indeed have to be carefull on the stack on a PIC16, but if you're working with large programs on these devices, it's always a battle between RAM, ROM and stack. Another nice try might be to put local variables into the global area, all the way up to the start of the program. CCS isn't too clever (read: dumb) with RAM allocation, it just allocates as it goes. Open up the SYM file in notepad and take a peek at variables you are using together a lot. If you do some math, and the variables are in different banks, you're code is probably filled with bank switching statements. Try to move them around a bit, you could see some major changes in ROM use, especially if you're using arrays. So, if you're not cramped for memory, try to make everything global. I don't know if you already use it, but by using #device*=16 as the first line under the include <16blabla.h>, you open up the higher two banks of registers as well. But again, for a price of more bank switching. BTW, I don't want to be rude, but this is a RTM question :) Regards, Claudio -----Oorspronkelijk bericht----- >Compiling MAIN.C: >Command line: "C:\PROGRA~1\PICC\CCSC.EXE +FM +T D:\B_MORAN\USBN\PICC\USBPICC\MAIN.C" >Error[71] D:\B_MORAN\USBN\PICC\USBPICC\MAIN.C 676 : Out of ROM, A segment or the program is too >large. > u9603_int > Seg 0000-07FF, 05D9 left, need 0765 > Seg 0800-0FFF, 0800 left, need 0822 > Seg 1000-17FF, 0800 left, need 0822 > Seg 1800-1FFF, 0800 left, need 0822 -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.