PDA

View Full Version : Set the UCFG register or registers in general



eDub
- 23rd July 2006, 19:46
Someone can probably give me a short answer to this simple question. However, if someone can help me understand this as well that would be doubly appreciated.

CONTEXT:
I have a lot of C# .NET programming experience and I am a PIC noob. I'm using a 18F2455 PIC, Microcode Studio, and MPASM. I've already established that are some version differences regarding __CONFIG with the 18 series and recent MPASM as explained in this thread:

http://www.picbasic.co.uk/forum/showthread.php?t=543

QUESTION:
How do I set the UCFG register bit 7 (UTEYE) ?

This thinking didn't work:

Since I can do this :
SSPCON1.5 = 0
Should I do this? :
UCFG.7 = 1

Since I can do this:
ADCON1 = %00000101
Should I do this? :
UCFG=%10000000


Since I can do this:
__CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H
Should I do this? :
__CONFIG UCFG, UTEYE
Should I do this? :
__CONFIG UCFG, %10000000

Since I can do this :
CONFIG OSCS=OFF,OSC=XT,WDT=ON,WDTPS=128,LVP=OFF
Should I do this ? :
CONFIG UTEYE=ON


In addition I have a working USB program via Easy HID. In it’s ASM it has this line:
#define UCFG_VAL _PUEN|_TRINT|_FS|MODE_PP ; Full-speed

Why is that valid? Where does UCFG_VAL exist? Why are there pipes instead of ampersands?


I think there is a difference between Configuration and Registers that I don’t get. I understand that all these defines are in P18F2455.INC. But the how come:

These are "configuration", but they are registers too right?
; The following is an assignment of address values for all of the
; configuration registers for the purpose of table reads
_CONFIG1L EQU H'300000'
_CONFIG1H EQU H'300001'
_CONFIG2L EQU H'300002'

These registers are not "configuration"? What is the difference?
;----- Register Files -----------------------------------------------------
UFRM EQU H'0F66'
UFRML EQU H'0F66'
UFRMH EQU H'0F67'
UIR EQU H'0F68'
UIE EQU H'0F69'
UEIR EQU H'0F6A'
UEIE EQU H'0F6B'
USTAT EQU H'0F6C'
UCON EQU H'0F6D'
UADDR EQU H'0F6E'
UCFG EQU H'0F6F'


And these bits are defined, but why? Is there a readable way to use them?
;----- UCFG Bits -----------------------------------------------------
PPB0 EQU H'0000'
PPB1 EQU H'0001'
FSEN EQU H'0002'
UTRDIS EQU H'0003'
UPUEN EQU H'0004'
UOEMON EQU H'0006'
UTEYE EQU H'0007'