Log in

View Full Version : PIC18F14K50 USB Not Working



rsocor01
- 29th December 2024, 21:03
Okay, it looks like I'm stuck with the 18F4550 for my USB projects. Nothing else seems to work for me. I'm trying to just compile this program with the Include "descript.bas", but it doesn't work. This descript file works just fine with the 18F4550. I checked the USB_DEV.ASM and USB_HID.ASM files, but I don't know what the problem is. It might be an easy fix, but this assembler language is not my best friend. Any help is appreciated. Thanks, Robert

9884



Include "descript.bas" ' Include the USB & HID descriptors

Define OSC 16
OSCCON = %11110111

#CONFIG
CONFIG CPUDIV = NOCLKDIV ; No CPU System Clock divide
CONFIG USBDIV = OFF ; USB clock comes directly from the OSC1/OSC2 oscillator block; no divide
CONFIG FOSC = IRC ; Internal RC oscillator ??????
CONFIG PLLEN = ON ; Oscillator multiplied by 4
CONFIG PCLKEN = ON ; Primary clock enabled
CONFIG FCMEN = OFF ; Fail-Safe Clock Monitor disabled
CONFIG IESO = OFF ; Oscillator Switchover mode disabled
CONFIG PWRTEN = OFF ; PWRT disabled
CONFIG BOREN = OFF ; Brown-out Reset disabled in hardware and software
CONFIG BORV = 19 ; VBOR set to 1.9 V nominal
CONFIG WDTEN = OFF ; WDT is controlled by SWDTEN bit of the WDTCON register
CONFIG WDTPS = 512 ; 1:512
CONFIG HFOFST = OFF ; The system clock is held off until the HFINTOSC is stable.
CONFIG MCLRE = OFF ; RA3 input pin enabled; MCLR disabled
CONFIG STVREN = OFF ; Stack full/underflow will not cause Reset
CONFIG LVP = OFF ; Single-Supply ICSP disabled
CONFIG BBSIZ = OFF ; 512W boot block size
CONFIG XINST = OFF ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
CONFIG DEBUG = OFF ; Background debugger disabled, RA0 and RA1 configured as general purpose I/O pins
CONFIG CP0 = ON ; Block 0 code-protected
CONFIG CP1 = ON ; Block 1 code-protected
CONFIG CPB = OFF ; Boot block not code-protected
CONFIG CPD = OFF ; Data EEPROM not code-protected
CONFIG WRT0 = OFF ; Block 0 not write-protected
CONFIG WRT1 = OFF ; Block 1 not write-protected
CONFIG WRTC = OFF ; Configuration registers not write-protected
CONFIG WRTB = OFF ; Boot block not write-protected
CONFIG WRTD = OFF ; Data EEPROM not write-protected
CONFIG EBTR0 = OFF ; Block 0 not protected from table reads executed in other blocks
CONFIG EBTR1 = OFF ; Block 1 not protected from table reads executed in other blocks
CONFIG EBTRB = OFF ; Boot block not protected from table reads executed in other blocks
#ENDCONFIG

HenrikOlsson
- 30th December 2024, 09:11
Does that short piece of code (with different CONFIG of course) really compile for the 18F4550 but not for 18F14K50?

There really isn't much actual code there is it?
I see no USBINIT or anything so it might be that the USB libraries aren't included by PBP during compile time and therefor the variables that the assembler is looking for isn't being declared.

tumbleweed
- 30th December 2024, 14:31
+1

What is "Include "descript.bas"?

Ioannis
- 30th December 2024, 16:04
maybe he meant

Include "hid_desc.bas" ?

Ioannis

rsocor01
- 30th December 2024, 20:27
Does that short piece of code (with different CONFIG of course) really compile for the 18F4550 but not for 18F14K50?

There really isn't much actual code there is it?
I see no USBINIT or anything so it might be that the USB libraries aren't included by PBP during compile time and therefor the variables that the assembler is looking for isn't being declared.

Yes, it compiles for the 18F4550 even without the config lines.

rsocor01
- 30th December 2024, 20:33
maybe he meant

Include "hid_desc.bas" ?

Ioannis

Hmm, it works with the "hid_desc.bas" include. The descript.bas file is part of a HidMaker package that I bought before. Apparently, this descript file was made only for the 18F4550. Unfortunately, HidMaker went out of business. His owner Dr. Bob is not even responding to the emails. It is a shame to see a great program like HidMaker to close.

Ioannis
- 31st December 2024, 08:50
Maybe the syntax of the descript file is different than the one expected?

Anyway it is a pity to see that company shutdown.

People are getting old, retired or even die...

Ioannis

rsocor01
- 31st December 2024, 20:04
Maybe the syntax of the descript file is different than the one expected?

Anyway it is a pity to see that company shutdown.

People are getting old, retired or even die...

Ioannis

Also, PBP is getting less popular everyday. I'm going to have to dust off my C language skills again because I think that's what people are using the most today to program the PICs.

Ioannis
- 31st December 2024, 20:27
I hate to admit it but yeah, that is very true. We all should do that.

But I also hate C...

Ioannis

Ioannis
- 31st December 2024, 20:27
I hate to admit it but yeah, that is very true. We all should do that.

But I also hate C...

Ioannis

rsocor01
- 1st January 2025, 21:57
But I also hate C...
Ioannis

I'm not a big fan of C either.