Hey, this is my first post here to forgive me if I mess up. I am working with a 18f2550 running at 48 Mhz uising HSPLL. I succesfully used the CDC sample from PBP. MY problem is that I cant get it to work if I change the way I allocate the buffer array. I am simply taking a decimal number, converting it to a string, and sending it to the computer. Can someone tell me what I am doing wrong. It is the simplest thing and I dont understand whats wrong. The Terminal program just freezes as soon as I send something to the pic. I want to use this program to do ADC and send them to my computer.

Code:
@    __CONFIG    _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
define LOADER_USED 1        ' USB Boot loader
define RESET_ORG 1000h 
Define  OSC     48

buffer var byte[16]
x var byte
y var byte
cnt	Var	Byte
LED	Var	PORTB.0


Pause 10

	USBInit
	Low LED		' LED off

' Wait for USB input
idleloop:
	USBService	' Must service USB regularly
	cnt = 16	' Specify input buffer size
	USBIn 3, buffer, cnt, idleloop
	
		Toggle LED


y = 123 ; just a random number for test
goto convert


outloop:
	USBService	' Must service USB regularly
	USBOut 3, buffer ,6 , outloop

	Goto idleloop	' Wait for next buffer
	

convert:
	
for x = 2 to 0 step -1
buffer[x]=(y dig x) + $30' find digit & convert to ASCII
next x
end 
buffer[3]=13
buffer[4]=10
buffer[5]=0

goto outloop