PIC18F14K50 and USBin
Hi!
I'm trying to use an internal USB-port (PIC18F14K50) in CDC-mode (USB-COM emulation). It is strange but the USBIN command reads only the first byte sent from the host. The other bytes are I don't know where from.
I tried to write to the buffer initial meanings. It is seen that the buffer changes. But the result is very strange.
Of course I could send byte-after-byte but I wonder why the USB-port functions not properly, not as described in the PBPpro manual.
The part of the program:
Variant 1
-----------
inloop:
cnt = 1
USBService
USBIn 3, buffer, cnt, inloop
outloop:
USBService
USBOut 3, buffer, 1, outloop
Goto inloop
I send "ABC" via USB-COM-port and receive "ABC" back.
Variant 2
-----------
inloop:
cnt = 3
USBService
USBIn 3, buffer, cnt, inloop
outloop:
USBService
USBOut 3, buffer, 3, outloop
Goto inloop
I send "ABC" via USB-COM-port and receive "AÆBÆCÆ" back. It can be seen that every right symbol accompanied with some others. It looks like USBIN receives all the rest symbols in the buffer after the first byte is sent from the host.
Does this apply only to the PIC18F14K50? I looked through the forum and didn't find anything like my problem.
-------------------
Everybody wants to have a job but nobody wants to work.
Bookmarks