Pumpkin, Inc.

Pumpkin User Forums

Salvo v2.2

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®).

Salvo v2.2

Postby Unregistered User » Sat Mar 23, 2002 7:16 am

I have discovered your WEB site and Salvo following an ad in Circuit Cellar
magazine and immediately got attracted to Salvo. In order to evaluate Salvo I've
downloaded the demo version and tried to write a simple program.

Following the trial we have a couple of questions:

1. Does Salvo support PIC18F452 ? We could not find any references.

2. Our simple program worked OK except for one thing: printf.
This is what we've discovered:

the program is extremely simple. There are 3 tasks. Task 1 flashes red LED
once every 1 sec. Task 2 flashes green LED once every 250 ms. Task 3
should read a real-time clock (PCF8583) and display it on LCD every 1 sec.
code:
void UpdateLCD(void) {
for (;;) {
OS_Delay(100,UpdateLCD1);
curx = 0;
cury = 0;
printf("Current time is:%2u:%2u", hours, minutes);
OS_Yield(UpdateLCD2);
}
}



A standard flavour of this program works OK on the same hardware.
Task 1 & 2 work ok in Salvo. Task 3 starts and then PIC crushes/hangs and re-starts.
We found that by reducing the string in printf to 2-3 characters we can get it work.
Any more characters and it doesn't. Any ideas why this might be happening?

I am looking forward to hearing from you.

[This message has been edited by Unregistered User (edited March 23, 2002).]

Unregistered User
 
Posts: 36
Joined: Thu Aug 09, 2001 11:00 pm

Re: Salvo v2.2

Postby Salvo Tech Support » Sat Mar 23, 2002 7:23 am

Hello.

quote:
Does Salvo support PIC18F452 ? We could not find any references.

Yes. From Salvo's point of view there is no difference between a PIC18C452 and a PIC18F452. Just use the library for the 18C452.

quote:
[SNIP] ...Any ideas why this might be happening?

Your UpdateLCD() task looks fine. It could be two things:

1) There might be something strange in your putch() routine. Try a simple printf() string without any format specifiers. There is a simple putch() in salvodemod1sysaserial.c in your Salvo Lite installation.

2) I think this is more likely: With PICC-18, you must correctly specify the printf() library you're using, or you will have printf()-related errors when using a format specifier that the library does not support. In MPLAB, edit the Node Properties of the project's .hex file, and ensure that under "Printf Library" you have selected "Long" or "Full". I suspect this is your problem -- it has bitten me before.

------------------
--------
Salvo Technical Support
Please request all tech support through the Forums.

[This message has been edited by Salvo Tech Support (edited March 23, 2002).]

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Re: Salvo v2.2

Postby Unregistered User » Sat Mar 23, 2002 7:25 am

Thank you for your reply. Nothing helped so far.
Actually we are using PIC16F877 at the moment. We are
planning to migrate to 18F452 within the next 2-3 months - hence
the rush.
The printf function does work OK without Salvo. I have checked it
many times. After I have received your message I re-compiled the program without
Salvo parts and it worked OK. I looks as if printf does not want to stop at at the
end of the char string but continues and eventually crushes. I'll keep digging.
Unregistered User
 
Posts: 36
Joined: Thu Aug 09, 2001 11:00 pm

Re: Salvo v2.2

Postby Salvo Tech Support » Sat Mar 23, 2002 7:27 am

That is odd. We've used printf() with 16C77, 16F877 and 18C452 without any real problems (except remembering to link to the right version of printf() for long and unsigned vars).

Keep in mind that on a 16F877, your stack is only 8 deep, and printf() is a few levels deep itself. You may want to take a look at the call graph that PICC generates in the .map file and see if perhaps you're exceeding the allowed depth. There is a comment in salvodemod1sysamain.c that alludes to this problem -- but that's because we wanted to call OSRpt() from inside a task, and the fact that OSRpt() uses printf() caused us to exceed the 16X77's call depth. On an 18C452, with a 32-level-deep call...return stack, it's not an issue.

Also, one can reduce Salvo's call...return usage by 2 (one for OSSched() and one for OSTimer()) with Salvo Pro by inlining those two calls via OSUSE_INLINE_OSSCHED and OSUSE_INLINE_OSTIMER. But these are not available to Salvo Lite users.

So I would suggest you look at the call depth issue next ...

------------------
--------
Salvo Technical Support
Please request all tech support through the Forums.

[This message has been edited by Salvo Tech Support (edited March 23, 2002).]

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Re: Salvo v2.2

Postby Unregistered User » Sat Mar 23, 2002 7:28 am

You were absolutely right. It was the stack-related error.
I've re-written the LCD subritunes and it works OK now.
As you pointed out this problem should not exsist on
18F485. [SNIP]

Thank you for your help. Salvo looks great and could be our
next choice should we decide to go ahead with the 18FXXX series.

Sincerely yours,

[This message has been edited by Unregistered User (edited March 23, 2002).]

Unregistered User
 
Posts: 36
Joined: Thu Aug 09, 2001 11:00 pm

Re: Salvo v2.2

Postby Salvo Tech Support » Sat Mar 23, 2002 7:31 am

Glad to be of service.

BTW, be sure to check our App Note AN-12. In it you'll see that HI-TECH PICC-18 has advanced to the point where it generates somewhat smaller code than PICC. So, you may be pleasantly surprised if / when you port over to the PIC18F452.

------------------
--------
Salvo Technical Support
Please request all tech support through the Forums.

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am


Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 2 guests

cron