Pumpkin, Inc.

Pumpkin User Forums

Tutorial TU3 Tasks not running

For issues specific to Microchip's PICmicro® MCUs, including compilers (e.g. HI-TECH PICC & PICC-18, Microchip MPLAB®-C18) and IDEs (e.g. Microchip MPLAB®).

Tutorial TU3 Tasks not running

Postby jtnum » Mon Jun 26, 2006 6:55 am

Using the TULite version and free libraries for initial eval
After getting the tu3 to build under:
MP-LAB IDE v7.40
MCC-18 v3.03
Using PIC18F4520

Demo1 runs and blinks Port B
Tu3, however, runs to OSSched(), as confirmed by breakpoints along the way, but breakpts at count++ in TaskCount() or InitPORT() in TaskShow() never trigger, and there is no LED activity on PortB.

I am using sfc18sna.lib.

What else do I need to do?

jtnum
 
Posts: 6
Joined: Sun Jun 25, 2006 11:00 pm
Location: Woodinville, WA, USA

Re: Tutorial TU3 Tasks not running

Postby jtnum » Tue Jun 27, 2006 1:11 am

I finally figured it out.....
main() calls init(), defined in main.h, which sets INTCONbits.TMR0IE, which should not be done, since TMR0 is not being used.

The problem is resolved by deleting init() in main().

Now the LEDS show the up-counting.

jtnum
 
Posts: 6
Joined: Sun Jun 25, 2006 11:00 pm
Location: Woodinville, WA, USA

Re: Tutorial TU3 Tasks not running

Postby aek » Tue Jun 27, 2006 7:22 am

General things to check:

1) Is OSTASKS in salvocfg.h set to 3?

2) Are you building without warnings?

3) Often MPLAB will not properly break on certain lines (it gets confused by macros, etc.). Ideally, add a NOP line and break on it.

4) This does not apply to tu3 -- which does not use interrupts -- but in general, applications that use interrupts have more places to go wrong. Therefore I always place a breakpoint in the beginning of main (e.g. on the call to OSInit()) to trap interrupt- and other related problems, like WDT issues.

5) Many of Salvo's services return error codes. On the PIC -- with its single working register, W -- it's very easy to examine these return codes without adding extra code. Just watch W in a watch window and break immediately after the function of interest. For tu3, if OSTASKS were still set to 1, you'd see that W is non-zero after the second and third calls to OSCreateTask().

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Tutorial TU3 Tasks not running

Postby jtnum » Tue Jun 27, 2006 8:38 am

quote:
Originally posted by aek:
General things to check:

1) Is OSTASKS in salvocfg.h set to 3?
It was 2, but I set it to 3
2) Are you building without warnings?
Warnings and messages are on....it builds without any errors
3) Often MPLAB will not properly break on certain lines (it gets confused by macros, etc.). Ideally, add a NOP line and break on it.

4) This does not apply to tu3 -- which does not use interrupts -- but in general, applications that use interrupts have more places to go wrong. Therefore I always place a breakpoint in the beginning of main (e.g. on the call to OSInit()) to trap interrupt- and other related problems, like WDT issues.

5) Many of Salvo's services return error codes. On the PIC -- with its single working register, W -- it's very easy to examine these return codes without adding extra code. Just watch W in a watch window and break immediately after the function of interest. For tu3, if OSTASKS were still set to 1, you'd see that W is non-zero after the second and third calls to OSCreateTask().


The WREG = 0x0A at OSCreateTask(TaskCount...
The WREG = 0x0A at OSCreateTask(TaskShow...
The WREG = 0x00 at counter = 0

PS I changed the PIC back to an 18F452 just for grins.

EX1 still works, blinking the LEDs as expected.

Still no LED activity with TU3???

jtnum
 
Posts: 6
Joined: Sun Jun 25, 2006 11:00 pm
Location: Woodinville, WA, USA


Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 2 guests

cron