Hi Emil,

On 29.11.14 18:50, Emil Johnsen wrote:


I'm trying to get a 18f24k50 to work with USB and the internal
oscillator. The chips will arrive next week, in the mean time I'm
working on my code.

At first I got a lot of compile errors in the usb_drv library, but I
found this post from 21st June, by Jim Gregory:

"The usb_drv library is not compatible with the newer k50 parts
(18f24k50/18f25k50/18f45k50).  The library assumes the USB interrupt
flag and enable bit addresses are PIE2_USBIF  and PIE2_USBIE,
respectively, but on these parts the address are PIE3_USBIF and
PIE3_USBIE. This causes compilers errors when attempting to use any USB
protocol with these parts."

I added two lines to 18f24k50.jal and the compiler errors went away:
var volatile bit PIE2_USBIE at PIE3 : 2
var volatile bit PIR2_USBIF at PIR3 : 2

I have no experience with the USB libraries myself, but this seems a reasonable short term solution. Nevertheless I would do it a little differently. I would not modify the device file because you have to redo the modification with every new version of the device file, and you may have to do that also when you decide to use a different PIC with your program. A more generic approach is to add to the program itself (after the include of the device file) the following statements:

if !defined(pie2_usbie) then
  alias pie2_usbie is pie3_usbie
  alias pir2_usbif is pir3_usbif
end if

An even better (long term) solution would be to put something like this in the USB libraries. But I leave that to the maintainer of these libraries.

Regards, Rob.


--
R. Hamerling, Netherlands --- http://www.robh.nl

--
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.

Reply via email to