Exact match. Not showing close matches.
PICList
Thread
'[PIC]: 18C452 reset problems'
2002\07\10@083349
by
James.Hyslop
|
I am writing my code in C using the MPLAB-C18 compiler. As a test, and to
learn how the PIC works, I have written a small program that runs in a loop,
reading a voltage from the internal A/D converter, flashes a LED (connected
to PortB) at different rates depending on the voltage that was read, and
then outputs (via TX on port C) the digital value over a serial connection
to a computer. The LED flashes and data is output over the serial port
(although the data is incorrect), but after the program runs for
approximately 3 seconds, the PIC resets, which I believe may attribute to
the bad serial data. I have the watchdog timer set to OFF when I program
the PIC, and i'm running at 4 MHz. I tried taking the A/D and serial
communications out of the loop, so that all it does is set and clear the
TRIS bit and PORT bit, and it still resets after the same amount of time.
Anyone have any ideas of what i could be doing incorrectly? If someone is
willing to help, I can send you my code as well... Thanks!
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender immediately.
This footnote also confirms that this email message has been swept by
MIMEsweeper and Symantec Norton AntiVirus for the presence
of computer viruses.
**********************************************************************
--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuT
mitvma.mit.edu
2002\07\10@084226
by
Carlos Ojea
2002\07\10@084843
by
James.Hyslop
+5 through a 4.7K resistor. Have also tried connecting a .1uF cap between
MCLR and GND but doesn't seem to make a difference. The program loop
actually starts runnning, but will only loop a couple of times before
resetting.
{Original Message removed}
2002\07\10@085045
by
James.Hyslop
+5 V through a 4.7K resistor. Have also tried connecting a .1uF cap between
MCLR and GND but doesn't seem to make a difference. The program loop
actually starts runnning, but will only loop a couple of times before
resetting.
{Original Message removed}
2002\07\10@093242
by
Jennifer L. Gatza
Could it possibly be a stack underflow reset? In assembly, you would have
to check that every CALL has a RETURN. C18 *should* handle that
automatically, but you know how m-chip software is. ;) Try troubleshooting
by disabling stack underflow reset. If this is the problem, you'll probably
see some REALLY strange results when you disable it, but at least you'll
know where the problem lies.
Jen
--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-request
KILLspammitvma.mit.edu
2002\07\10@094458
by
Jennifer L. Gatza
|
Correcting/clarifying myself...
Each call should have exactly one return. If there's an EXTRA return
somewhere, that would cause the reset. The C compiler may or may not scream
at the extra return; if it doesn't, guess what? :)
I'm not sure if that helps or makes things worse, but I'll take a stab at it
anyway.
Jen
{Quote hidden}> Could it possibly be a stack underflow reset? In assembly,
> you would have
> to check that every CALL has a RETURN. C18 *should* handle that
> automatically, but you know how m-chip software is. ;) Try
> troubleshooting
> by disabling stack underflow reset. If this is the problem,
> you'll probably
> see some REALLY strange results when you disable it, but at
> least you'll
> know where the problem lies.
>
> Jen
>
> --
>
http://www.piclist.com hint: To leave the PICList
>
.....piclist-unsubscribe-requestKILLspam
.....mitvma.mit.edu
>
>
--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam_OUT
TakeThisOuTmitvma.mit.edu
2002\07\10@105703
by
John Dammeyer
Make sure, when you program your device, that you haven't enabled the
watchdog.
John Dammeyer
Wireless CAN with the CANRF module.
www.autoartisans.com/documents/canrf_prod_announcement.pdf
Automation Artisans Inc.
Ph. 1 250 544 4950
> {Original Message removed}
2002\07\10@110922
by
Mircea Chiriciuc
2002\07\10@171326
by
Peter L. Peres
2002\07\11@072610
by
James.Hyslop
Is it possible that the watchdog could start running even if I disabled it
in the configuration when I programmed the PIC? I took out all of the
loops, and the chip still resets after about 3 seconds. Going to try
assembly next or else try another chip. Also, I am currently turning on and
off an LED via the below code: I am using the MPLAB C18 compiler.
//set RB1 as output
TRISBbits.TRISB1=0;
//turn on LED on RB1
LATBbits.LATB1 = 0;
PORTBbits.RB1 = 0;
//wait a little
Delay10KTCYx(1);
//turn off LED on RB1
LATBbits.LATB1 = 1;
PORTBbits.RB1 = 1;
The guide was not very specific on how this should really be done. If there
is a better or more efficient way of doing this, could someone please offer
advice? Thanks again!
{Original Message removed}
2002\07\11@094314
by
Andy Jancura
Hello,
you miss a loop and another delay.
A.
while(1)
{
//set RB1 as output
TRISBbits.TRISB1=0;
//turn on LED on RB1
LATBbits.LATB1 = 0;
PORTBbits.RB1 = 0;
//wait a little
Delay10KTCYx(1);
//turn off LED on RB1
LATBbits.LATB1 = 1;
PORTBbits.RB1 = 1;
Delay();
};
_________________________________________________________________
Join the world s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads
More... (looser matching)
- Last day of these posts
- In 2002
, 2003 only
- Today
- New search...