I assume so, maybe someone can try usb_msd with the code I provided. Matt.
On Tuesday, April 29, 2014 11:34:41 PM UTC-4, Sunish Issac wrote: > > Does it mean that USB can be made to work on 16F chips ? > > Sunish > > > On Wed, Apr 30, 2014 at 12:37 AM, mattschinkel > <[email protected]<javascript:> > > wrote: > >> I found time to work on this a bit, and I got usb_msd to work without >> POSTINC1. I don't see why the other USB samples don't work with this. This >> code can be added at the top of usb_drv_core.jal >> >> -- >> -------------------------------------------------------------------------------------- >> -- Some PICs do not support the memory_pointer1 library since they don't >> have >> -- the POSTINC1 or FSR1 registers. >> -- >> -------------------------------------------------------------------------------------- >> if !defined(POSTINC1) then >> >> ;Store the next array read/write location >> var word usb_buff_address >> >> ;The current endpoint to read/write to. >> var byte endpoint_array_selected >> const byte USB_EP0_OUT = 0 >> const byte USB_EP0_IN = 1 >> const byte USB_EP1_OUT = 2 >> const byte USB_EP1_IN = 3 >> const byte USB_EP2_OUT = 4 >> const byte USB_EP2_IN = 5 >> const byte USB_EP3_OUT = 6 >> const byte USB_EP3_IN = 7 >> >> ;Set the array address to read/write to next >> procedure mem_pointer1_address'put(word in address) is >> usb_buff_address = address >> >> ;Find what endpoint the memory address is in, and set the array >> address. >> if (address >= USB_EP0_OUT_ADDR) & (address < USB_EP0_OUT_ADDR + >> USB_EP0_OUT_SIZE) then >> endpoint_array_selected = USB_EP0_OUT >> usb_buff_address = address - USB_EP0_OUT_ADDR >> end if >> if (address >= USB_EP0_IN_ADDR) & (address < USB_EP0_IN_ADDR + >> USB_EP0_IN_SIZE) then >> endpoint_array_selected = USB_EP0_IN >> usb_buff_address = address - USB_EP0_IN_ADDR >> end if >> if (address >= USB_EP1_OUT_ADDR) & (address < USB_EP1_OUT_ADDR + >> USB_EP1_OUT_SIZE) then >> endpoint_array_selected = USB_EP1_OUT >> usb_buff_address = address - USB_EP1_OUT_ADDR >> end if >> if (address >= USB_EP1_IN_ADDR) & (address < USB_EP1_IN_ADDR + >> USB_EP1_IN_SIZE) then >> endpoint_array_selected = USB_EP1_IN >> usb_buff_address = address - USB_EP1_IN_ADDR >> end if >> if defined(usb_ep2out_buf) then >> if (address >= USB_EP2_OUT_ADDR) & (address < USB_EP2_OUT_ADDR + >> USB_EP2_OUT_SIZE) then >> endpoint_array_selected = USB_EP2_OUT >> usb_buff_address = address - USB_EP2_OUT_ADDR >> end if >> if (address >= USB_EP2_IN_ADDR) & (address < USB_EP2_IN_ADDR + >> USB_EP2_IN_SIZE) then >> endpoint_array_selected = USB_EP2_IN >> usb_buff_address = address - USB_EP2_IN_ADDR >> end if >> end if >> if defined(usb_ep3out_buf) then >> if (address >= USB_EP3_OUT_ADDR) & (address < USB_EP3_OUT_ADDR + >> USB_EP3_OUT_SIZE) then >> endpoint_array_selected = USB_EP3_OUT >> usb_buff_address = address - USB_EP3_OUT_ADDR >> end if >> if (address >= USB_EP3_IN_ADDR) & (address < USB_EP3_IN_ADDR + >> USB_EP3_IN_SIZE) then >> endpoint_array_selected = USB_EP3_IN >> usb_buff_address = address - USB_EP3_IN_ADDR >> end if >> end if >> end procedure >> >> ;Put data into the correct endpoint, and increment to the next array >> location. >> procedure mem_pointer1'put(byte in data) is >> if endpoint_array_selected == USB_EP0_OUT then >> usb_ep0out_buf[usb_buff_address] = data >> elsif endpoint_array_selected == USB_EP0_IN then >> usb_ep0in_buf[usb_buff_address] = data >> elsif endpoint_array_selected == USB_EP1_OUT then >> usb_ep1out_buf[usb_buff_address] = data >> elsif endpoint_array_selected == USB_EP1_IN then >> usb_ep1in_buf[usb_buff_address] = data >> end if >> if defined(usb_ep2out_buf) then >> if endpoint_array_selected == USB_EP2_OUT then >> usb_EP2out_buf[usb_buff_address] = data >> elsif endpoint_array_selected == USB_EP2_IN then >> usb_EP2in_buf[usb_buff_address] = data >> end if >> end if >> if defined(usb_ep3out_buf) then >> if endpoint_array_selected == USB_EP3_OUT then >> usb_EP3out_buf[usb_buff_address] = data >> elsif endpoint_array_selected == USB_EP3_IN then >> usb_EP3in_buf[usb_buff_address] = data >> end if >> end if >> usb_buff_address = usb_buff_address + 1 >> end procedure >> >> function mem_pointer1'get() return byte is >> var byte data >> if endpoint_array_selected == USB_EP0_OUT then >> data = usb_ep0out_buf[usb_buff_address] >> elsif endpoint_array_selected == USB_EP0_IN then >> data = usb_ep0in_buf[usb_buff_address] >> elsif endpoint_array_selected == USB_EP1_OUT then >> data = usb_ep1out_buf[usb_buff_address] >> elsif endpoint_array_selected == USB_EP1_IN then >> data = usb_ep1in_buf[usb_buff_address] >> end if >> if defined(usb_EP2out_buf) then >> if endpoint_array_selected == USB_EP2_OUT then >> data = usb_EP2out_buf[usb_buff_address] >> elsif endpoint_array_selected == USB_EP2_IN then >> data = usb_ep2in_buf[usb_buff_address] >> end if >> end if >> if defined(usb_ep3out_buf) then >> if endpoint_array_selected == USB_EP3_OUT then >> data = usb_EP3out_buf[usb_buff_address] >> elsif endpoint_array_selected == USB_EP3_IN then >> data = usb_EP3in_buf[usb_buff_address] >> end if >> end if >> >> usb_buff_address = usb_buff_address + 1 >> return data >> end function >> else >> include memory_pointer1 >> end if >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jallib" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/jallib. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/jallib. For more options, visit https://groups.google.com/d/optout.
