Pumpkin, Inc.

Pumpkin User Forums

LEDs wont light

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

LEDs wont light

Postby ryanjpcush » Wed Jul 14, 2004 4:26 am

Hi I am an Msc student and I have started using Salvo Lite (before I buy main version)for my dissertation. I have gone through all the tutorials which come with it and understand them fully.

My problem is that whenever I try to use the code that is used for tutorial 3 to light some leds (I'm using a FLASH-LAB 77 board) they wont light. In debug mode on MPLAB v6.4 the Port pins are being set correctly but when I download the code to the PIC18f452 using ICD2 the leds wont come on - is there something simple I'm not doing??

Thanks in advance ryanjpcush@hotmail.com

Here is the code:

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

$Source: C:\RCS\d\salvo\tut\tu3\main.c,v $
$Author: aek $
$Revision: 3.7 $
$Date: 2003-06-13 17:05:13-07 $

Source for tutorial programs.

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

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

_OSLabel(TaskCount1)
_OSLabel(TaskShow1)

unsigned int counter;

void TaskCount( void )
{
for (;;) {

PORTC=0xff;

OS_Yield(TaskCount1);
}
}

void TaskShow( void )
{
for (; ;) {

PORTB=0xff;

OS_Yield(TaskShow1);
}
}

void main( void )
{
Init();

OSInit();


PORTB=0x00;
TRISB=0x00;

PORTC=0x00;
TRISC=0x00;


OSCreateTask(TaskCount, OSTCBP(1), 5);
OSCreateTask(TaskShow, OSTCBP(2), 5);


for (;;)
OSSched();
}



[This message has been edited by aek (edited July 14, 2004).]

ryanjpcush
 
Posts: 3
Joined: Mon Jun 14, 2004 11:00 pm
Location: Ireland

Re: LEDs wont light

Postby aek » Wed Jul 14, 2004 7:52 am

I believe another user (CharChar) had the same problem -- most likely, thhere's an additional peripheral initialization that you need to do for your particular chip to get it working.

For example, some PICs default to analog inputs on certain ports -- therefore you'd need to change them to digital I/O in your init before you can drive LEDs from those ports.

So, carefully review your PIC's datasheet for everything associated with your I/O ports.

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

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


Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 5 guests

cron