View previous topic :: View next topic |
Author |
Message |
mbro131
Joined: 22 May 2006 Posts: 9
|
USB Example Code Compile Error |
Posted: Mon May 22, 2006 8:08 pm |
|
|
Hi,
I have just been trying to get the CCS USB example code compiled and I am getting the following errors. My C is a little rusty but as they are examples I thought that perhaps someone else had come across this before.
Could someone explain the 'Warrning 216' messages? Line 240 is the end of file.
I am using CCS 3.233
Thanks in advance
Matt
Executing: "C:\Program files\Picc\CCSC.exe" "ex_usb_mouse.c" +FH +DF +LN +T -A +M +Z +Y=9 +EA
>>> Warning 203 "C:\...\pic18_usb.h" Line 416(1,1): Condition always TRUE
>>> Warning 203 "C:\...\ex_usb_mouse.c" Line 220(1,1): Condition always TRUE printf
>>> Warning 216 "C:\...\ex_usb_mouse.c" Line 240(0,1): Interrupts disabled during call to prevent re-entrancy: usb_token_reset delay_ms
>>> Warning 216 "C:\...\ex_usb_mouse.c" Line 240(0,1): Interrupts disabled during call to prevent re-entrancy: usb_flush_in
Memory usage: ROM=13% RAM=21% - 23%
0 Errors, 4 Warnings.
Executing: "C:\Program files\Picc\CCSC.exe" "USB.C" +FH +DF +LN +T -A +M +Z +Y=9 +EA
*** Error 128 "C:\...\usb.h" Line 259(1,11): A #DEVICE required before this line
Halting build on first failure as requested.
BUILD FAILED: Tue May 23 11:53:03 2006 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon May 22, 2006 8:38 pm |
|
|
Don't add USB.C to the MPLAB project. There must be only one C
source file in the project. All other files must be #include files.
Your Project window should look like this:
Code: |
-Ex_usb_mouse.mcp
- Source Files
- Ex_usb_mouse.c
-Header Files
- 18F4550.h
- pic18_usb.h
- usb.h
- usb_desc_mouse.h
-Other Files
|
This assumes that you selected 18F4550 as the PIC to use, in the MPLAB
project wizard.
Just turn off the warnings. Go to the Project /Build Options menu in
MPLAB. Select the project name (Ex_usb_mouse) and a pop-up window
will appear. Un-check the box for "Show warnings". |
|
|
mbro131
Joined: 22 May 2006 Posts: 9
|
interrupt warnings |
Posted: Mon May 22, 2006 8:45 pm |
|
|
Ahh thats better. Should I be concerned about the 'Interrupts disabled during call to prevent re-entrancy' warnings?
Does this basically mean that the compiler disables interupts until these routines are finished? and if so should I be doing this explicitly?
Matt |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon May 22, 2006 10:05 pm |
|
|
The usb_token_reset() function is called by:
usb_isr_rst()
usb_detach()
usb_attach()
The usb_task() function calls usb_attach(). This call is made outside
of an interrupt service routine.
The usb_isr() function calls usb_isr_rst(). This call is made from
within the #int_usb interrupt service routine.
There is only one instance of the usb_token_reset() function and it
is not re-entrant. Therefore, the compiler automatically inserts code
at compile-time to disable interrupts while usb_token_reset() is
executing. |
|
|
mbro131
Joined: 22 May 2006 Posts: 9
|
|
Posted: Mon May 22, 2006 10:08 pm |
|
|
Thankyou for clearing that up for me, much appreciated
Matt |
|
|
|