PDA

View Full Version : interrupt on USB com



Billou
- 3rd March 2006, 00:45
Hi,

I am trying to set-up a USB Interupt on a 18F4550. I want a programm interruption on USB bus activity. My problem it seems that i don't haveset the right register.

Ofr example : how do you access to UIE register in PBP ?


here is my

DEFINE OSC 48 ' oscillateur ‡ 48 Mhz


LEDalim VAR PORTA.4 ' LED alim
USBbuffer var byte
USBcount var byte

USBINIT ' initialise USB...

INTCON = %10000000 ' Enable RB0 interrupt

PIR2=0

ASM
bsf UIE,2 ' Is it right ?
endASM

ON INTERRUPT GOTO myint

loop
USBservice ' a simple loop /keep alive USB
goto loop

disable
myint:
DoUSBIn:
USBCount=1 ; 1 byte
USBSERVICE ' keep connection alive
USBIN 3, USBBuffer,USBCount,DoUSBIn ' read data, if available


DoUSBOut:
USBCount=1 ;
USBSERVICE ' keep connection alive
USBout 3, USBBuffer,1,DoUSBOut ' send data, if available

PIR2=0

resume
enable


Is there something wrong ?

For information : i used CDC comminication ( virtual COMport) and usually the USB communication work fine.