On Thu, Sep 29, 2011 at 11:19 AM, Harold Hallikainen wrote: > I built a "logic analyzer" many years ago. I used the printer port on a > Cromemco CP/M computer as the logic inputs. I watched for a change in the > byte I read from the port, then saved the new value to memory and bumped = a > pointer. Once I had finished a capture, I printed out all the data in > binary, one byte per line. I used this to reverse engineer the serial bus > on a Commodore 1541 floppy disk drive. > > For your application, I think it'd be easier to add external RAM to use > during capture, then send the data after capture. I've got a project usin= g > a 1MB static RAM that's easy to interface to. I used it on a PIC24 which > did not have the parallel master port, so I bit banged it. On the PIC32, > you could use the PMP for a fair amount of the work (though you'd have to > manually control higher address lines). > > Here's some of my UsbTask code from a project: > > if(!USBHandleBusy(USBGenericOutHandle)){ // If it's safe to look at > the receive buffer > if(count=3DUSBHandleGetLength(USBGenericOutHandle)){ // if there'= s > something in the receive buffer > if(count<=3DpUsbRxFifo->BytesFree){ // we have room in the fifo > index=3D0; > while(count--){ > PutFifo(pUsbRxFifo,OUTPacket[index++]); // get data from > usb buffer to fifo > } > USBGenericOutHandle =3D > USBGenRead(USBGEN_EP_NUM,(BYTE*)&OUTPacket,USBGEN_EP_SIZE); // > ok to read more > }// endif we had room > }// endif there was something there > }// endif not busy > if(!USBHandleBusy(USBGenericInHandle)){ // 0 if ok to transmit > if(count=3DpUsbTxFifo->BytesInBuf){ // we have something to send > if(count>=3Dsizeof(INPacket)){ > count=3Dsizeof(INPacket); // limit how many bytes we sen= d > to size of output buffer > } > index=3D0; > NumBytes=3Dcount; // remember how many bytes we're sending > while(count--){ > INPacket[index++]=3DGetFifo(pUsbTxFifo); // fill the transmit > buffer from the fifo > } > USBGenericInHandle =3D > USBGenWrite(USBGEN_EP_NUM,(BYTE*)&INPacket,NumBytes); // send the > bytes > } > } > > Thanks for the reply. Your code is pretty similar to my code. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .