PDA

View Full Version : How do we flag a record as processed in EasyHID?



Demon
- 19th August 2006, 20:24
Hi,

I can send 30 bytes of data from the PC down to the PIC. The problem is that the logic as it is keeps processing DoUSBIn. I get my first 'good' 30 bytes, but then it keeps on trucking and keeps getting garbage.

Do we have a flag available that we can set to indicate RECORD PROCESSED so that DoUSBIn can just sit there and wait like it did at the beginning?

Robert
:)

Demon
- 19th August 2006, 21:50
I can't find a flag in the 18F2550 datasheet that would do what I want.

What about the Byte Count in BDnSTAT and BDnCNT? Has anyone used that yet?

Robert
:)

Demon
- 20th August 2006, 02:39
I found something skimming through Jan's book; ACKnowledge is a likely candidate. I'm just not really good at reading books and understanding C.

Robert
:)

Demon
- 20th August 2006, 03:06
Hmm, Jan mentions returning a zero length packet as an ACKnowledge. I tried this without success:


ProgramStart:

DoUSBIn:
USBBufferCount = USBBufferSizeRX
USBService
USBIn 1, USBBuffer, USBBufferCount, DoUSBIn

... display USBBuffer data on LCD...

DoACKIn:
USBBufferCount = 0
USBService
USBOUT 1, USBBuffer, USBBufferCount, DoACKIn

goto ProgramStart
END


Darn, this is frustrating. I'm sure it's something real easy too.

Robert
:(

Demon
- 20th August 2006, 03:21
Jan says that an acknowledge is part of endpoint handshaking. The 18F2550 datasheet says endpoint handshaking is disabled by default. So I tried enabling it but this register is not defined (not using this syntax anyways):

UEP1.4 = 1

Robert
:(

EDIT: Ok, I give up. I emailed Mécanique and hope they'll be able to give me an answer on Monday...

Demon
- 20th August 2006, 21:58
Awe man, I'm so embarassed, I've been chasing my own tail all weekend on this problem. I'm an idiot... :(

It was my VB routine all along that sent more than one transaction. I misunderstood the comment in the EasyHID generated code that said to "make sure to pass the whole array" when we write to the PIC.

So I did, I had one write for each and every element, the PIC was just doing its job and reading everything the PC was sending.

Robert
:(

mister_e
- 20th August 2006, 22:00
LMAO! maudit francais :D

Now i'm sure you'll never ever made the same mistake ;)