Good suggestions. Am curious to see if low and high bytes are reversed.
Robert
Good suggestions. Am curious to see if low and high bytes are reversed.
Robert
My thoughts exactly Robert.
Little Endian vs Big Endian.
Regards,
TABSoft
If I set the high order byte to 0, word.byte1=0, and send 255 I get 255 in the display, cant send beyond that as 2nd byte is 0. When both bytes set as buff [0], [1] and send 255 or less I get a number begining in 5 or 6 such as 56324, it makes no sense whats going on. I did discover that the terminal prog I was using only sent single bytes only so that if 256 was sent, nothing happened. Took a while to work that out and thought I'd cracked it, noooo of course not. I'm using a VB application to send the number, and on the pic side if I set the high order byte to 0 I do get up to 255 on the lcd, all good so far, when high order byte set as buff [1] I get garbage. I,m not 100% certain though that whats been tx out the VB app is what I,d expect.
I,ve tried reversing the byte order to see if it was high-low rather than low-high but thats not the issue. Any suggestions on how I would go about further testing appreciated,
john
Here is my template for USB and VB6
http://www.picbasic.co.uk/forum/show...812#post106812
I think that value stored in buffer(1) in vb, is value in buffer(0) in PBP...
Values are shifted one place when you compare array on pc and pic.
I'm forget why this is happen, so I'm not sure 100%...
Here is comment from code
PORTA=USBRXBuffer[0]'PC BufferOut(1)
And here is why:
BufferOut(0) = 0 ' first by is always the report ID
' write the data (don't forget, pass the whole array)...
When you send data from PIC to PC, I think that values are on same place...
Hope that this will clear what is going on...
EDIT:
And as you can see from Darrel's post USB buffer are at least 8 byte's
DEFINE USB_INSIZE 64 ; IN report is PIC to PC (8,16,32,64)
Last edited by pedja089; - 10th February 2015 at 23:08.
That might explain why garbage appears on the lcd at switch on, however as its confihured as virtual serial and not pure USB as in hid I would,nt have thought that [0] would be reserved, but it does make me think its worth another look. So you think that the buffer size should be at least 8 bytes?
I'm not sure, but I think it should be at least 8 bytes...
If you are using CDC, than it maybe different... Best choice is that you leave USB variable, as is. Don't change anything.
And for CDC I think that numbers of bytes in packet is not constant... It can be one, it can be more... But again, I'm not sure... I don't have much experience with usb.
Darn, can't remember where I read about buffer length. I would go with 8 bytes too.
It's not going to affect performance much anyways.
Robert
I think it is in USB Complete, but have to search and the book is far away right now...
Ioannis
Bookmarks