Searching \ for '[PIC] problems with delays (long newbie posting)' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/begin.htm?key=delay
Search entire site for: 'problems with delays (long newbie posting)'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] problems with delays (long newbie posting)'
2002\08\05@055241 by jumanji

flavicon
face
Hello everybody,

My first post if it works (tried one before but it didn't)
Ok, here we go,
I just got into PICs (with very very limited electronic background tbh, but
I've soldered a LED before so to say) & my programming skills are .. well I
had some basic,pascal,c but so long ago that it is all neglectable.

It took me a while to gather enough info & tools to get started, but now I
have gotten  a few programs running.
Finding its features the most appealing compared to other boards I have been
looking at, I
went for the LAB-X1 experimenter board (PIC16F877-20/P included) together
with
the EPIC programmer. I didn't want to spend much time on putting together
circuits myself to get to learn programming PICs. I also didn't get the
BASIC
compiler though. After a while I think I'll be using some C package (still
have to investigate which) to  program them, but at the moment I'm
experimenting with MPASM, I never looked into assembly language before, but
I find it quite interesting, maybe I'll just stick to it after all.
The hardware seems to work ok, it took me a while to get it running, but now
the included test hexfiles load & execute just fine (it seems to me, anyway)
and -more important- I have gotten a few programs working on it.
But... unfortunately (but to be expected), this success didn't last for
long.

I'm trying to control some LEDs (what else :), with the aid of online
examples, like the ones on piclist (great resource btw)
The 'lite-a-led' eperiment was a great success.
The 'flash-a-led' gave me some problems, I found a 'nested-loop'-delay that
I used but somehow it didn't work right. The LED's either were on or off, no
action at all. It was actually a PIC16F84 example & I thought it might have
something todo with that. I messed a bit with the code without knowing what
I was doing (moved the positions of call delay & clear carry flag around
etc), but didn't get anything to work & so I gave up.
The 'move-a-led' also didnt work properly, it uses a similar delay.
I went looking for other delay methods & I found this great 'delay
generator' on the piclist, so I guess the code just had to be correct.
Meanwhile I got to know MPLAB a bit better & yes, the debugger shows that 1
bit of PORTD 'moves'

The experiment is done on a 10 LED bargraph, but 8 r used. The idea is that
1 lit LED 'moves' from position 1 to 8 & repeats (with RLF PORTD or RRF
PORTD) but, it doesn't do that, I get all kind of strange things, like it
moves 1-4 & then resets. When I fill in other delay times I get different
effects, like a skipping a few positions.
Then I used a 0.25sec generated code & to my amazement it works perfect.

I kept this one & extend the program with a BTFSS instruction on the last
bit of PORTD to make it go down again.
But.... it doesn't, it just toggles between position 1 & 8, other delay
values make it just stick on position 1, or skip a few places on the way
back.
I have replaced the delay code with a NOP &  watched PORTD with the
debugger, it seems to work perfect, 1 bit moves from pos1 to pos8 & back.

So I think I should find the problems somewhere else, but I don't
knowwhereto look.
Possible issues I could think of myself to check:
*All ports are configured as output & set Low, delivered clock is 4MHz
(jumper setting)
*Power supply shud be sufficient (using 2warts, 1 for the expboard
15VDC/500mA & 1 for the programmer12VDC/800mA)
*The programmer stays connected & powered while executing the program on the
expboard, I have tried without it on working & nonworking programs, it never
changed anything.
*the LEDs share the PORTD with the LCD controller, but the documentation
says it is to be ignored.
* Maybe it has something todo with 'jitter', I found some thing on
www.piclist.com/techref/microchip/timer.htm
but this gets ways too technical for me.

I would like to ask if there is anybody out there who could point me out wat
todo next? Maybe someppl have similar hardware (&similar problems?)

Further I would like to know, these flashPICs like 877, can they be
reprogrammed a certain limited amount of times, or are they forever
reprogrammable ?

Oh, & did anybody ever order anything from epemag in uk ? I did, I got some
obscure java-order routine inside a webpage.The order was confirmed on the
webpage, but I didn't get any email confirmation, not even after I mailed
them again to ask for it. Epemag doesn't seem very trustworthy to me, are
they to be avoided or has anybody had good experiences with them ?

thanks a bunch in advance & sorry for the long post
best regards

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\08\05@062732 by Jinx

face picon face
> The 'flash-a-led' gave me some problems, I found a 'nested-loop'-
> delay that I used but somehow it didn't work right. The LED's either
> were on or off, no action at all. It was actually a PIC16F84 example
> & I thought it might have something todo with that

Could be - RAM starts at 0x0c in the F84 and at 0x20 in the F877.
Assuming the delay used RAM counters and the addresses weren't
corrected............

Post the listing for the bit(s) giving you trouble, probably easily fixed.
Make sure to include any references to memory, variable and port
declarations, the problem may not be where you think it is. Curiously
though, it is always in the last place you look

> So I think I should find the problems somewhere else, but I don't
> knowwhereto look.

> *the LEDs share the PORTD with the LCD controller, but the
> documentation says it is to be ignored

More than likely that's true. You can use the LCD data lines
for other things. Nothing will happen to the LCD display if
you aren't sending it commands over RS, R/W and E

> * Maybe it has something todo with 'jitter', I found some thing on
> www.piclist.com/techref/microchip/timer.htm
> but this gets ways too technical for me.

Jitter is just a measure of accuracy of the delay, it won't make a
difference to the execution of the delay itself, especially not one
of many milliseconds

> Further I would like to know, these flashPICs like 877, can they
> be reprogrammed a certain limited amount of times, or are they
> forever reprogrammable ?

Around about 1000 times

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