Pumpkin, Inc.

Pumpkin User Forums

Problem With the Code !!!

If you can't make Salvo do what you want it to do, post it here.

Problem With the Code !!!

Postby RobinJacob » Sun Dec 07, 2003 2:04 am

Hi
I have a Minor problem with the Code. I have written the code so that both PORTA0 and PORTB0 blinks at the same rate. But when I compiled the code and executed it Then PORTA0 burns continously. Why is it so ?? HT-PIC and Salvo all are Demo version.
code:
#define SYSA
#define MAKE_WITH_FREE_LIB

#include "main.h"
#include "salvo.h"

_OSLabel(TaskA1)
_OSLabel(TaskB1)

void TaskA( void )
{
while(1)
{
PORTA ^= 0x01;
OS_Delay(50, TaskA1);
}
}

void TaskB( void )
{
while(1)
{
PORTB ^= 0x01;
OS_Delay(50, TaskB1);
}
}

void main( void )
{

TRISA = 0X00;
TRISB = 0X00;

Init();

OSInit();

OSCreateTask(TaskA, OSTCBP(1), 10);
OSCreateTask(TaskB, OSTCBP(2), 10);

for (;;)
OSSched();
}


[This message has been edited by aek (edited December 07, 2003).]

RobinJacob
 
Posts: 5
Joined: Thu Oct 16, 2003 11:00 pm
Location: Delhi,Delhi,India

Re: Problem With the Code !!!

Postby aek » Sun Dec 07, 2003 8:44 am

Hello Robin.

1) What does your ISR look like, and is it calling OSTimer() at the right rate?

2) What does your salvocfg.h look like?

3) Some PICs (esp. the ones with analog inputs) require that you explicitly set the analog pins to digital I/O (they default to analog I/O). I suspect this may be your problem -- see the PIC data sheet, A/D converter section for more details.

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

[This message has been edited by aek (edited December 07, 2003).]

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

Re: Problem With the Code !!!

Postby RobinJacob » Mon Dec 08, 2003 1:41 am

Hi Iam Using PIC16F628. I have configured the Analog Module to be off. Still its not working.

My ISR look like

code:
#define SYSA
#define MAKE_WITH_FREE_LIB


#include "isr.h"
#include <salvo.h>

#if defined(USE_INTERRUPTS)

#if defined(SYSA) || defined(SYSH) || defined(SYSF)
|| defined(SYSP)

#if defined(SYSA) || defined(SYSH) || defined(SYSF)
void interrupt IntVector( void )
#elif defined(SYSP)
#pragma vector=0x08
__interrupt void IntVector( void )
#endif
{
if ( T0IE && T0IF ) {
T0IF = 0;
TMR0 -= TMR0_RELOAD;

OSTimer();
}
}


#elif defined(SYSE)

#pragma interrupt ISRHigh save=PROD,section(".tmpdata")

void ISRHigh( void )
{
if ( INTCONbits.TMR0IE && INTCONbits.TMR0IF ) {
INTCONbits.TMR0IF = 0;
TMR0 -= TMR0_RELOAD;

OSTimer();
}
}

#pragma code IntVectorHigh = 0x08
void IntVectorHigh( void )
{
_asm
goto ISRHigh
_endasm
}

[SNIP]


#else /* SYS* not defined */
#error Undefined Salvo test system (SYS*). Definition required.

#endif

#endif


My Salvo config file

code:
/************************************************************ 
Copyright (C) 1995-2002 Pumpkin, Inc. and its
Licensor(s). Freely distributable.

$Source: C:\RCS\d\salvo\tut\tu5\sysa\salvocfg.h,v $
$Author: aek $
$Revision: 3.6 $
$Date: 2003-07-30 17:31:29-07 $

Header file for tutorial programs.

************************************************************/

#if defined(MAKE_WITH_FREE_LIB)
/* */
/* Salvo Lite build */
/* */
#define OSUSE_LIBRARY TRUE
#define OSLIBRARY_TYPE OSF
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSB
#define OSEVENTS 1
#define OSEVENT_FLAGS 0
#define OSMESSAGE_QUEUES 0
#define OSTASKS 2

#elif defined(MAKE_WITH_STD_LIB)
/* */
/* Salvo LE & Pro library build */
/* */
#define OSUSE_LIBRARY TRUE
#define OSLIBRARY_TYPE OSL
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSB
#define OSEVENTS 1
#define OSEVENT_FLAGS 0
#define OSMESSAGE_QUEUES 0
#define OSTASKS 3


#elif defined(MAKE_WITH_SOURCE)
/* */
/* Salvo Pro source-code build */
/* */
#define OSBYTES_OF_DELAYS 1
#define OSENABLE_BINARY_SEMAPHORES TRUE
#define OSEVENTS 1
#define OSLOC_ALL bank1
#define OSTASKS 3


#else

#error No MAKE_WITH_??? symbol defined. See salvocfg.h.

#endif

#if !defined(SYSA)

#error SYSA must be defined for this PICC tutorial project ...

#endif


[This message has been edited by aek (edited December 10, 2003).]

RobinJacob
 
Posts: 5
Joined: Thu Oct 16, 2003 11:00 pm
Location: Delhi,Delhi,India

Re: Problem With the Code !!!

Postby aek » Tue Dec 09, 2003 8:37 am

Hi Robin.

No need to post the entire Salvo file contents ... :-)

Do this to ascertain if it's the hardware or the software -- change the

code:
PORTA ^= 0x01;

line in TaskA() to
code:
PORTB ^= 0x02;

Since you know (if I understand you correctly) that TaskB() is working (because PORTB:0 is toggling), then make TaskA() toggle PORTB:1. If it works, then you have a hardware problem.

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

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


Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron