Not using USB, just want to use them as digital inputs, for some flow sensors. Setting UCON = %00000000.
Not using USB, just want to use them as digital inputs, for some flow sensors. Setting UCON = %00000000.
Code and config fuses will help![]()
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
The only config setting i see that affects USB is VREGEN. Does this have to be off for the USB to be disabled. From what i read in the data sheet only UCON.3 needs to be turned off to change PortC.4 & 5 to digital.
I am using Micro Code Studios boot loader, do you know if they preset bits in the config to enable USB?
RD
Thank You!!
Adding both
UCON var byte EXT
UCFG var byte EXT
to PIC18EXT.BAS
and adding
UCFG.3=1
UCON.3=0
to the code lets PortC.4 and PortC.5 on the 18F2455 operate as inputs.
Now i can sleep tonight!!!!!!!!!!!!!
RD
Actually UCON=0 at power up, so you shouldn't need that line... but who knows... it's never a bad idea to set all registers.
Good night![]()
Last edited by mister_e; - 7th April 2008 at 01:41.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Couldn't go to bed before i hooked up the pulse inputs.
When i hook up the pulse input to PortC.5 i get pulses on PortC.5 and not on PortC.4.
When i hook up the pulse input to PortC.4 i get counts on PortC.4 and PortC.5 as well.
The traces are paralell for awhile but if i was getting cross talk between traces i would think it would be in both directions. But its not. I can eliminate everything in the program that refers to PortC.4, put pulses into PortC.4 and still get pulses on PortC.5. There are no shorts between the traces or anything else on the board. It appears to be internal to the ports.
I did notice that these two ports do not have smitt triggers as most other inputs do. Can this have some thing to do with it.
Also there are internal pullups on these two inputs. I supposedly disabled them by setting UCFG.4 to 0 as well.
My pulse input is from a hall effect switch with a 1K pull up resistor.
Any thoughts????
RD
If you were getting compile errors regarding UCON, then the USB library is probably being included without you realizing it. Your program most likely compiles to a size that seems much larger than it should.
If the file you are compiling is in the same folder as another USB project, then the USB library may be included automatically.
Or if the 18F2455.bas in the PBP folder has been modified for USB it will do the same thing from any folder.
If it is in the same folder as another USB project? Move it to it's own separate folder.
If it's already in it's own folder? Check the 18F2455.bas file in the PBP folder. You should see this in the file...The PBPPIC18 line should NOT be commented, and the PBPUSB18 line should be commented.Code:BANKA $0000, $005F BANK0 $0060, $00FF BANK1 $0100, $01FF BANK2 $0200, $02FF BANK3 $0300, $03FF BANK4 $0400, $04FF BANK5 $0500, $05FF BANK6 $0600, $06FF BANK7 $0700, $07FF 'EEPROM $F00000, $F000FF LIBRARY "PBPPIC18" 'LIBRARY "PBPUSB18"
If you are using PBPL, then look in the 18F2455.BAL file instead.
hth,
DT
Bookmarks