Searching \ for '[PIC] time-scaling problem with PIC 18F2455' 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/time.htm?key=time
Search entire site for: 'time-scaling problem with PIC 18F2455'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] time-scaling problem with PIC 18F2455'
2006\09\03@101658 by Mark Wotton

picon face
Hello,

I'm trying to program a PIC 18F2455 chip. I'm using PicBasic Pro as a
frontend, MPLab v7.30 for the assembler, and MPLab icd 2 for the
programmer. A simple testing program to flash a light on and off at 1
second intervals instead takes 8 seconds:

----------------------------------------
INCLUDE "modedefs.bas"

define OSC 8

TRISA=%00000
TRISB=%00000000
TRISC=%11111111

StatusLED        VAR porta.1

LOOP:
 high StatusLED
 pause 1000
 low StatusLED
 pause 1000
 goto LOOP
------------------------------------------

If I change OSC to 4 (or leave it out), the program takes 4 seconds
per transition, so I initially thought I could just set OSC to 1 and
be done with it - this wouldn't compile in PicBasic Pro, however,
giving me the error "Symbol not previously defined (PAUSEUSL)".

I tried fiddling with some of the constants defined in
C:\pbp\p18f2455.inc, which the generated assembly included:
--------------------------------------------
  INCLUDE "P18F2455.INC"  ; MPASM  Header
       __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L &
_USBDIV_2_1L
       __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
       __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
       __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
       __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
---------------------------------------------

Unfortunately, nothing there seemed to have any effect on the timing
at all. Where do you suggest I look next? I'm at a bit of a loss.

(It's important that the timing be right for this, as I need to use
serial comms to load new data at runtime, and SERIN doesn't seem to
want to work, even when I tried setting the baud rate on the other end
of the serial to 1200 to compensate.)

Please let me know if I've missed describing anything important, I'm
still quite new to PIC programming.

Cheers,
Mark

--
A UNIX signature isn't a return address, it's the ASCII equivalent of a
black velvet clown painting. It's a rectangle of carets surrounding a
quote from a literary giant of weeniedom like Heinlein or Dr. Who.
       -- Chris Maeda

2006\09\03@112903 by Anand Dhuru

flavicon
face
You have defined OSC 8; is the crystal actually 8? If you dont define this
(use the default 4 MHz) does the frequency double?

Also, the LED would be on for 1 second, and off for 1; the cycle would be 2
seconds.

Regards,

Anand

{Original Message removed}

2006\09\03@120337 by Jesse Lackey

flavicon
face
Hi, I haven't used the 2455 but the second __CONFIG line sets the
oscillator to be 4x the crystal - so you should have DEFINE OSC 40 if
you are using a 10mhz crystal.  If you aren't using a crystal, you'll
probably need to change the config settings relating to the oscillator.
 Now it would seem if this is the problem, you'd be running way to
fast, not too slow, but I recommend looking these over for any obvious
problems.

I didn't find any way of changing config settings in a simple manner
with picbasic pro (but I am by no means an expert), so for my project I
commented out all the __CONFIG lines in the picbasic pro header file and
put them in my code.  See:
www.celestialaudio.com/leoProgrammable/index.html
specifically the "library code" link at the bottom.  The settings for
the board I made are near the top of the file.

Hope it helps-
J



Mark Wotton wrote:

{Quote hidden}

2006\09\03@123243 by peter green

flavicon
face

> Hi, I haven't used the 2455
If you haven't used the usb pics please bear in mind before giving advice
that they have a VERY different clock block from the rest of the PIC18
series.

2006\09\03@174620 by Mark Wotton

picon face

On 03/09/2006, at 6:28 PM, Anand Dhuru wrote:

> You have defined OSC 8; is the crystal actually 8?

So my colleague assures me. I'm not using an external crystal -  
there's a default oscillator on the board, isn't there?
(Again, forgive me my naivete, I'm new to this.)

> If you dont define this (use the default 4 MHz) does the frequency  
> double?

Yes - as I mentioned, either setting it to 4 or leaving the OSC  
declaration out gives 4 seconds per transition.

>
> Also, the LED would be on for 1 second, and off for 1; the cycle  
> would be 2
> seconds.

True: I was imprecise. It's currently on for 8 and off for 8, with a  
cycle of 16.

Mark

> Regards,
>
> Anand
>
> {Original Message removed}

2006\09\03@185019 by William Chops Westfield

face picon face

On Sep 3, 2006, at 2:46 PM, Mark Wotton wrote:

>> You have defined OSC 8; is the crystal actually 8?
>
> So my colleague assures me. I'm not using an external crystal -
> there's a default oscillator on the board, isn't there?
>
WHICH board are you talking about?

BillW

2006\09\03@190652 by Jan-Erik Soderholm

face picon face
Mark Wotton wrote :

> define OSC 8

This might be obviouse, but it's worth to be mentioned
anyway...

Defining OSC to some value does NOT change the speed
of the PIC oscillator as such, just the speed the BasicPro
compiler THINKS that the PIC is running in.

> (Again, forgive me my naivete, I'm new to this.)

Now, the 2455 (or any of the other USB PICs) might not
be the best "beginners-PIC". Just the oscillator block is much
more complex then on a "standard" PIC18. It took me a great
time of reading to "get it"...

Finaly, is Basic realy optimum to write USB firmware (I guess
you're ging to use the USB interface, right ?) ?
I'm not saying that it can't be done, but most examples are
in C if I'm not wrong.

Jan-Erik.



2006\09\03@191310 by peter green

flavicon
face

> So my colleague assures me. I'm not using an external crystal -
> there's a default oscillator on the board, isn't there?
> (Again, forgive me my naivete, I'm new to this.)
if you are reffering to the pics internal oscilator then
yes there is
yes it is 8mhz
no it can't be used with the PLL (unlike on other PIC18 chips)
no it can't be used for usb.
and if you wan't to use it you need to select intosc.

if you are reffering to a crystal on the development board you are using
then we need to know what development board that is.

2006\09\04@042702 by Anand Dhuru

flavicon
face
Why dont you leave out the define, and specify the internal oscillator to
rule out other variables?

Then see if the circuit behaves as it should.

Also, for PBP related stuff try posting on http://www.picbasic.co.uk/forum/
; its a very active forum and has some real sharp sparks as well.

Regards,

Anand


{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...