Hi,
I am still stuck with my proplem, therefore, I modified the cdc_demo.bas to be able to change the outbuffer contents:
I continued testing and found out:Code:' USB sample program for PIC18F4550 CDC serial port emulation ' Requires PBP 2.60 or later ' Compilation of this program requires that specific support files be ' available in the source directory. For detailed information, see ' the file PBP\USB18\USB.TXT. Include "cdc_desc.bas" ' Include the HID descriptors Define OSC 48 inbuffer Var Byte[15] outbuffer Var Byte[15] icnt Var Byte ocnt Var Byte OSCTUNE.6 = 1 ' Enable PLL for 18F87J50 family Pause 10 USBInit ' Get USB going ' Wait for USB input idleloop: icnt = 6 ' Specify input buffer size USBService ' Must service USB regularly USBIn 3, inbuffer, icnt, idleloop ' Message received outbuffer[0] = inbuffer[0] outbuffer[1] = inbuffer[1] outbuffer[2] = inbuffer[2] outbuffer[3] = inbuffer[3] outbuffer[4] = 0 outbuffer[5] = icnt outbuffer[6] = 0 outbuffer[7] = $AA outbuffer[8] = $BB outbuffer[9] = $CC outbuffer[10] = $DD outbuffer[11] = 0 outbuffer[12] = inbuffer[0] outbuffer[13] = inbuffer[1] outbuffer[14] = inbuffer[2] outloop: USBService ' Must service USB regularly ocnt = 14 USBOut 3, outbuffer, ocnt, outloop Goto idleloop ' Wait for next buffer
With ocnt = 14
The first USBOut after com port open in PC test program is actually
outbuffer[0]....outbuffer[12] -> in total 13 bytes
from the second output it is always the same
outbuffer[13], outbuffer[0], outbuffer[1]...., outbuffer[12] ->in total 14 bytes
I suspect in the appended .inc and .asm files might be a definition mistake, but since I do not understand the code written there, I really need the help of an USB specialist in this Forum to overcome this problem.
To all the USB experts in this Forum, please Help.




Bookmarks