Searching \ for '[PIC]: More 18F252 woes' 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/devices.htm?key=18F
Search entire site for: 'More 18F252 woes'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: More 18F252 woes'
2003\02\18@035237 by Neil Bradley

flavicon
face
part 1 1485 bytes content-type:TEXT/PLAIN; charset=US-ASCIII'm sure you all remember my simple problem of not being able to program
the TRISA/B/C registers to a specific value. Now I'm really, really
confused as to just what is going on!

I'm using a ICD 2 with a PICDEM 2 PLUS board. The 18F252 is plugged in.
I'm using MPLAB 6.10.0.0. Here's what I know so far (I've attached my
code)

* The part is set correctly in MPLAB

* Setting the CCAP1/2 and A to D configuration registers to disabled has
no effect

* Stepping through code yields changes to the WREG, but TRISA/B/C don't
change

* If I reset the target, forcibly zero TRISA/B/C in the debugger, if I
step one instruction, MPLAB shows TRISB as 0x80 (changes from 0)

Do I have the clock source configured incorrectly? I notice that if I set
it to EC-OSC2 as RA6, I can step through code and the W register changes,
but TRIS/A/B/C never get set. IF I set it as HS, stepping through code
works OK, but the W register never changes, nor does the port. Any idea
what I'm supposed to set the PICDEM2 board to?

Please, someone point out that this is idiocy on my part and where and
I'll be forever grateful! Thanks in advance!

-->Neil

-------------------------------------------------------------------------------
Neil Bradley            In the land of the blind, the one eyed man is not
Synthcom Systems, Inc.  king - he's a prisoner.
ICQ #29402898

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.




part 2 2214 bytes content-type:TEXT/PLAIN; charset=US-ASCII; name="CODE.ASM"
(decoded base64)

               LIST                P=18F252

               PROCESSOR        18f252

               RADIX                hex

               INCLUDE                "P18f252.inc"

               

       

; Generic definitions go here



BIT_0                equ                b'00000001'                ; Bit 0

BIT_1                equ                b'00000010'                ; Bit 1

BIT_2                equ                b'00000100'                ; Bit 2

BIT_3                equ                b'00001000'                ; Bit 3

BIT_4                equ                b'00010000'                ; Bit 4

BIT_5                equ                b'00100000'                ; Bit 5

BIT_6                equ                b'01000000'                ; Bit 6

BIT_7                equ                b'10000000'                ; Bit 7



; Specific definitions go here



; Port A definitions



PORTA_OUT        equ                (BIT_0 | BIT_1 | BIT_2 | BIT_3 | BIT_4 | BIT_5)

PORTA_IN        equ                ((~PORTA_OUT) & 0x7f)        ; Leave bit 7 alone!



; Port B definitions



PORTB_OUT        equ                (BIT_1 | BIT_2 | BIT_3 | BIT_4 | BIT_5 | BIT_6 | BIT_7)

PORTB_IN        equ                (~PORTB_OUT)



; Port C definitions



BIT_INH                equ                b'00000001'                ; Inhibit bit definition

BIT_CHA                equ                b'00000010'                ; Channel A definition

BIT_CHB                equ                b'00000100'                ; Channel B definition

BIT_SCLK        equ                b'00001000'                ; Serial clock (SPI)

BIT_SDATA        equ                b'00100000'                ; Serial data (SPI)

BIT_DACK        equ                b'01000000'                ; Data acknowledgement to T89C51RD2



PORTC_OUT        equ                (BIT_INH | BIT_CHA | BIT_CHB | BIT_DACK)

PORTC_IN        equ                (~PORTC_OUT)



; Definitions for startup communication



START_BYTE1        equ                0x5a                        ; Startup byte 1

START_BYTE2        equ                0xa5                        ; Startup byte 2



; Data definition area







; Reset and start



                       org                        0x0

RESET_VECTOR

                       GOTO                START



                       org                        0x6

; Main code entry point



START



; Shut off the A to D and CCP



                       movlw                0x0                        ; Zero value

                       movwf                ADCON1                ; Disable A to D functionality

                       movwf                CCP1CON                ; Disable CCP1

                       movwf                CCP2CON                ; Disable CCP2



; Initialize port A



                       movlw                PORTA_IN        ; Get port A's input setting

                       movwf                TRISA                ; Set up appropriate tristating

                       

; Now port B



                       movlw                PORTB_IN        ; Get port B's input setting

                       movwf                TRISB                ; Set up appropriate tristating



; Now port C



                       movlw                PORTC_IN        ; Get port C's input setting

                       movwf                TRISC                ; Set up appropriate tristating

                       

; Now write 1s to the port



                       movlw                0xff                ; All 1s

                       movwf                PORTA

                       movwf                PORTB

                       movwf                PORTC                

               

               

                       END

               


part 3 2 bytes
-

2003\02\18@053119 by cdb

flavicon
face
A couple of things stand out I think, I'll soon be corrected if I'm
wrong :)

; Reset and start



                       org                     0x0

RESET_VECTOR

                       GOTO            START



                       org                     0x6   ????

Interrupts are at 0x0008 for high priority
and 0x0018 for low priority. Might even be a    good idea to bung a
trap in there if you're not using interrupts as goto $

; Main code entry point



START



; Shut off the A to D and CCP



                       movlw           0x0                     ; Zero value

To disable ADC completely it is 0x00000111

                       movwf           ADCON1          ; Disable A to D functionality

       {       movwf           CCP1CON         ; Disable CCP1
               movwf           CCP2CON         ; Disable CCP2}
CCP1 and Two don't need to be disabled as by default Timers 1 ,2 and
3 are off.



; Initialize port A



                       movlw           PORTA_IN        ; Get port A's input setting

I still think you maybe assigning your bits backwards here. EG.:
PORTA Bit 1 is actually 00000010 in your setup it appears to be
01000000

                       movwf           TRISA           ; Set up appropriate tristating



; Now port B



                       movlw           PORTB_IN        ; Get port B's input setting
DITTO
                       movwf           TRISB           ; Set up appropriate tristating



; Now port C

                       movlw           PORTC_IN        ; Get port C's input setting
DITTO
                       movwf           TRISC           ; Set up appropriate tristating



; Now write 1s to the port



                       movlw           0xff            ; All 1s

                       movwf           PORTA

                       movwf           PORTB

                       movwf           PORTC

               END

Colin

--
cdb, spam_OUTbodgy1TakeThisOuTspamoptusnet.com.au on 18/02/2003

I have always been a few Dendrites short of an Axon and believe me it
shows.

Light travels faster than sound. That's why some people appear bright
until they speak!

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@054403 by cdb

flavicon
face
On Tue, 18 Feb 2003 20:29:47 +1000, cdb wrote:
To disable ADC completely it is 0x00000111

Whooops  try 0x07

Colin
--
cdb, .....bodgy1KILLspamspam@spam@optusnet.com.au on 18/02/2003

I have always been a few Dendrites short of an Axon and believe me it
shows.

Light travels faster than sound. That's why some people appear bright
until they speak!

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@100417 by Olin Lathrop

face picon face
> I'm sure you all remember my simple problem of not being able to program
> the TRISA/B/C registers to a specific value.

I'm sure I don't.  I know this may come as a shock, but most people here
have lives outside the PIClist and their own problems to solve.

{Quote hidden}

That depends on how the PIC is wired in the circuit.  Do you have an R/C
connected, a crystal, a resonator?  If so, what frequency?  Is the power
voltage within spec?  Is the chip properly bypassed?  Is the oscillator
running at all?  Are the fuses set for in circuit debugging?

It might be a good idea to first verify your code in the simulator.  Try
something simple that should just produce a square wave on an output pin.
Then program that into a real chip and see if it works with a scope.  If
it doesn't, then its probably related to the oscillator, power, or
configuration fuses.  If it does, try it with the ICD to see if it's
messing things up.  Take things one step at a time so that you know which
piece of the puzzle is causing the trouble.

>   LIST  P=18F252
>   PROCESSOR 18f252
>   RADIX  hex

Bad idea.  Sooner or later you're going to write a decimal number and the
assembler will interpret it as hex.

{Quote hidden}

This is a rather unusual way to declare input and output bits.  One of the
side effects is that unused bits are set to input instead of output.  This
method might be useful for initial learning, but once you know the chip a
bit better, check out my /INBIT and /OUTBIT preprocessor directives.  The
preprocessor and lots of other PIC development stuff can be found at
http://www.embedinc.com/pic.

{Quote hidden}

Note that this can be accomplished with a single CLRF instruction.

However, this sets all A/D pins to analog in, not digital.  You need to
write b'00000110' to ADCON1 to let the A/D pins be digital I/O.

{Quote hidden}

*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@132611 by Neil Bradley

flavicon
face
> > the TRISA/B/C registers to a specific value.
> I'm sure I don't.  I know this may come as a shock, but most people here
> have lives outside the PIClist and their own problems to solve.

Not a shock at all consdering I spammed the list twice about the issue on
accident. ;-|

> > Do I have the clock source configured incorrectly?
> That depends on how the PIC is wired in the circuit.  Do you have an R/C
> connected, a crystal, a resonator?  If so, what frequency?  Is the power
> voltage within spec?  Is the chip properly bypassed?  Is the oscillator
> running at all?  Are the fuses set for in circuit debugging?

It's a PICDEM 2 board. Sorry, but I don't know enough electronics to know
how to translate what I see on a schematic to the 7 or so settings of
crystal operation.

> It might be a good idea to first verify your code in the simulator.  Try

Good idea - I'll do that.

> >   RADIX  hex
> Bad idea.  Sooner or later you're going to write a decimal number and the
> assembler will interpret it as hex.

Thanks for the tip! Very good point.

> > BIT_0  equ  b'00000001'  ; Bit 0
> > PORTC_OUT equ  (BIT_INH | BIT_CHA | BIT_CHB | BIT_DACK)
> > PORTC_IN equ  (~PORTC_OUT)
> This is a rather unusual way to declare input and output bits.

Maybe in PIC land, but it's common everywhere else.

> One of the
> side effects is that unused bits are set to input instead of output.

With the exception of port a which has bit 7 masked off. IIRC, Port B and
Port C didn't have any unused bits in the TRIS register.

> This
> method might be useful for initial learning, but once you know the chip a
> bit better, check out my /INBIT and /OUTBIT preprocessor directives.  The
> preprocessor and lots of other PIC development stuff can be found at
> http://www.embedinc.com/pic.

Great info here - thanks! I've been looking around for something that has
some organized amount of information. Fumbling through the help text in
MPLAB, etc... is not exactly a good way to learn about the PIC!

> >    movlw  0x0   ; Zero value
> >    movwf  ADCON1  ; Disable A to D functionality
> Note that this can be accomplished with a single CLRF instruction.

Good tip - I'm still learning the PIC (obviously), but this isn't my first
embedded CPU. Give it time - I'll be better at it than you! ;-)

> However, this sets all A/D pins to analog in, not digital.  You need to
> write b'00000110' to ADCON1 to let the A/D pins be digital I/O.

I just need to look at the registers a bit closer rather than blindly
following others' advice.

Thanks again!

-->Neil

-------------------------------------------------------------------------------
Neil Bradley            In the land of the blind, the one eyed man is not
Synthcom Systems, Inc.  king - he's a prisoner.
ICQ #29402898

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@171021 by Olin Lathrop

face picon face
> > That depends on how the PIC is wired in the circuit.  Do you have an
R/C
> > connected, a crystal, a resonator?  If so, what frequency?  Is the
power
> > voltage within spec?  Is the chip properly bypassed?  Is the
oscillator
> > running at all?  Are the fuses set for in circuit debugging?
>
> It's a PICDEM 2 board. Sorry, but I don't know enough electronics to
know
> how to translate what I see on a schematic to the 7 or so settings of
> crystal operation.

Then you'd better learn this or stop wasting time on PICs.  You can't just
ignore the oscillator settings and hope everything works out.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@181124 by Neil Bradley

flavicon
face
> > > voltage within spec?  Is the chip properly bypassed?  Is the
> > > running at all?  Are the fuses set for in circuit debugging?
> > It's a PICDEM 2 board. Sorry, but I don't know enough electronics to
> > how to translate what I see on a schematic to the 7 or so settings of
> > crystal operation.
> Then you'd better learn this or stop wasting time on PICs.  You can't just
> ignore the oscillator settings and hope everything works out.

I'm not trying to ignore anything - I'm trying to learn. Remember Olin,
you started out knowing zero about PICs as well, and I hope you weren't
shown the same contempt for beginners that you're showing me. If you'd
like to point me to a specific document to read, a book to read, or any
references at all, I'd gladly go read up and learn, otherwise keep the
attitude to yourself.

-->Neil

-------------------------------------------------------------------------------
Neil Bradley            In the land of the blind, the one eyed man is not
Synthcom Systems, Inc.  king - he's a prisoner.
ICQ #29402898

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@183834 by Olin Lathrop

face picon face
> I'm not trying to ignore anything - I'm trying to learn. Remember Olin,
> you started out knowing zero about PICs as well, and I hope you weren't
> shown the same contempt for beginners that you're showing me. If you'd
> like to point me to a specific document to read, a book to read, or any
> references at all, I'd gladly go read up and learn, otherwise keep the
> attitude to yourself.

Whoa, down boy.

I have no contempt for beginners.  In fact, I've taken a bit of time
responding to your posts and answered some of your questions.  The only
thing I have contempt for is the attitude of "I don't know what it does,
so I'll just ignore it, then neglect to mention this little fact when
asking people to help with why it doesn't work."

Also, keep in mind you are the one asking for a favor.  My life goes on
just fine whether your problem is solved or not, so it's not in your
interest to piss me off (or anyone else that might be willing to give you
something for free).


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@185534 by Neil Bradley

flavicon
face
> I have no contempt for beginners.  In fact, I've taken a bit of time
> responding to your posts and answered some of your questions.  The only
> thing I have contempt for is the attitude of "I don't know what it does,
> so I'll just ignore it, then neglect to mention this little fact when
> asking people to help with why it doesn't work."

I never have had that attitude. The point being is that I currently don't
know enough to translate a schematic into what the PIC needs to have its
configuration bits set to. That doesn't mean that I'm not willing to
learn, nor does it mean that I'm too stupid to learn. It means I need
guidance as to how to figure it out. I don't want people to solve my
problems - as I asked in the email, I'm looking for any ideas that might
lead me to a solution, not for people to solve my problems for me, so
don't treat me as a bonehead beginner who wants his homework done by
others.

> Also, keep in mind you are the one asking for a favor.  My life goes on
> just fine whether your problem is solved or not, so it's not in your
> interest to piss me off (or anyone else that might be willing to give you
> something for free).

So does mine and I'm sure the problem will be solved with or without you,
but I've already received several private emails from listmembers have
tagged you as a valuable yet prickly guy to deal with, and I have often
been labeled the same way. If you truly have no contempt for beginners,
you'd do better to refrain from commenting in a condescending way. I don't
question your value to the list, but I'd much rather stumble around in the
dark and figure it out for myself than to be berated.

-->Neil

-------------------------------------------------------------------------------
Neil Bradley            In the land of the blind, the one eyed man is not
Synthcom Systems, Inc.  king - he's a prisoner.
ICQ #29402898

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@190411 by Dave Dilatush

picon face
part 1 3385 bytes content-type:text/plain; charset=us-ascii (decoded 7bit)

Neil,

Offhand I can't see what the problem might be, just looking at
your code; it's structured very differently from what I'm used to
seeing.

One suggestion: until you get "on your feet" with this PIC stuff,
it might help to write your code by starting with the
Microchip-supplied code template.  In the case of the PIC18F252,
that would be f252temp.asm in the TEMPLATE/CODE directory; a copy
is attached.  By starting out with the template and modifying it
to suit, you might avoid some problems.

I can't tell from your code whether or not you've got the clock
configured correctly; you don't show any __CONFIG statements, so
I assume you're doing it in the IDE.  I always use __CONFIG in
the code to set up the PIC.  But, looking at the PICDEM2 Plus
schematic, it would appear you need the HS oscillator option.

A second suggestion: at least in the beginning, make liberal use
of MPLAB's simulator to step through your code before loading it
into a PIC and attempting to run it.  Go step by step through the
code in the simulator, and verify that it does EXACTLY what you
expected it to do.  Some people don't use the simulator, but I
do; I'm primarily an electrical engineer, and software is a
"necessary evil" I tolerate to get the job done.  I'm OK at it,
but I'm a bit of a plodder- and using the simulator is, for me, a
valuable tool.

A third suggestion: regarding your comment (in another post)
about not knowing much about electronics, let me suggest a book:
The Art of Electronics, by Horowitz & Hill.  It's not quite a
beginners book, but as textbooks go it's probably one of the
least "newbie-hostile".  I recommend it; others will no doubt
have more suggestions.

Do, though, learn at least the basics of electronics- knowing
this stuff is like a "force multiplier" which, combined with
software savvy, makes a very powerful combination.

Dunno whether this'll help any but it's a try...

Dave D.

Neil Bradley wrote...

{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.




part 2 6064 bytes content-type:application/octet-stream; name=f252temp.asm (decode)

part 3 2 bytes
-

2003\02\18@191902 by Neil Bradley

flavicon
face
> Offhand I can't see what the problem might be, just looking at
> your code; it's structured very differently from what I'm used to
> seeing.

It seems the PIC development is very different than what I'm used to
seeing. ;-) I come from a world of MCS-51 family and ARM CPUs, so a LOT of
the PIC stuff is unfamiliar to me.

> One suggestion: until you get "on your feet" with this PIC stuff,
> it might help to write your code by starting with the
> Microchip-supplied code template.

I'll do exactly that - thanks.

> I can't tell from your code whether or not you've got the clock
> configured correctly; you don't show any __CONFIG statements, so
> I assume you're doing it in the IDE.  I always use __CONFIG in
> the code to set up the PIC.  But, looking at the PICDEM2 Plus
> schematic, it would appear you need the HS oscillator option.

That's what I figured (though the HS setting had no effect, it's still
broken). I had asked priorly (privately to others)

> A second suggestion: at least in the beginning, make liberal use
> of MPLAB's simulator to step through your code before loading it
> into a PIC and attempting to run it.

Up until you mentioned it, I hadn't realized the MPLAB stuff actually had
a simulator. I'll play with it tonight.

> A third suggestion: regarding your comment (in another post)
> about not knowing much about electronics, let me suggest a book:

Actually, I know quite a bit about electronics (I'm schooled in EE). I'm
just trying to map the schematic to the PIC nomenclature. I've not yet run
in to a CPU I've used in design that required such a thing. I'm very much
familiar with embedded control (synthesizers, HVAC control, MIDI->CV
converters, fuel injection/ignition, etc...) just none of it with PICs!

> Dunno whether this'll help any but it's a try...

It does - thanks, Dave! I at least have enough knowledge to be dangerous
now. ;-)

-->Neil

-------------------------------------------------------------------------------
Neil Bradley            In the land of the blind, the one eyed man is not
Synthcom Systems, Inc.  king - he's a prisoner.
ICQ #29402898

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@192116 by Tim Webb

flavicon
face
Olin,

I am not trying to upset you, but I do want to provide you with some feedback about your behavior on this site.
We do appreciate your help, but in the future, if you feel that you have to be a jerk and insult others, please don't even bother to respond.
I am tired of hearing your wise mouth insulting people on this site and wasting bandwidth.  Either you contribute to this site by helping others in a polite way or you keep your mouth shut.

Thanks,

Tim


{Original Message removed}

2003\02\18@193941 by Nate Duehr

face
flavicon
face
Let's see if we can help you out...  you definitely have not provided enough
information to be able to help you, and that's probably what has Olin all
grumpy.  Why Olin's always grumpy is probably a question best left between
him and his therapist.  ;-)

By your own admission you didn't know anything at all about PIC's, so how
you'd know much about the oscillator options, is beyond me... so we'll see
what we can do here...  but if you don't understand the uses of the
different oscillator options at all, you'll really need some remedial
reading to get going.

The PIC has a number of ways to clock it, and all have advantages and
disadvantages.  Everything from a simple external RC circuit for
low-accuracy, to ceramic resonators, to crystals... really there's always
more than one way to skin the cat.  Most beginner projects focus on using a
simple all-in-one ceramic resonator or a crystal and a couple of capacitors.

Now... you also admitted that you can't read schematics, and I can
definitely say this is going to be about the biggest handicap one could
possibly imagine when working on electronics.  That's simply not going to
work out... you should definitely find some beginner electronics material.
That or plan on "letting the smoke out" of an awful lot of expensive parts.

Going on, despite that... I don't have a PICDEM2, nor do I know anything at
all about them, but the link below is the User's Guide, directly from
Microchip's website.

First, looking at...
http://www.microchip.com/download/tools/picmicro/demo/pdem2/30374d.pdf

Which crystal option did you populate the board with?  (Assuming here that
you put it together when it was unpopulated...)
In Figure 1.2, did you populate #10 or #11 or are you planning to use the
on-board RC oscillator?  Is the jumper (J7) for that in the correct
position?

See Table 2.1 - there are only four options listed there, and they're all
dependant on :
a) What speed do you need to run your application at?  (Design question)
b) What do you have on your PICDEM board?

All of the above have different oscillator options that MUST be set in your
software code properly so the options are set appropriately in the PIC
during programming for whatever type of oscillator you choose... after you
determine the requirements and set up the PICDEM board correctly.

I would definitely recommend getting a good readable book on the PIC if this
is your first exposure to them.  Nothing can ever replace the manufacturer's
data sheets and information for the straight dope, but there are a number of
third-party books out there that explain the PIC in plain english that are
great add-ons to the datasheets.

There are a number of them out there.  I started with Myke Predko's book
(http://www.myke.com) and there are others.  Your favorite online bookstore will
return a number of results with "Microchip" or "PIC".

Also note that there is a zip file from Microchip with all the demo programs
and information on how to build the demos with the PICDEM2... building a few
already "known to work" projects on the PICDEM might be more useful if
you're a "learn by doing" type of learner.  I'm in a hurry here, but I think
the link is:
http://www.microchip.com/1010/pline/tools/picmicro/demo/pdem2/8336/  And I'm
not sure that's the best way to go... just another resource for you.  You
have to determine what works for your learning style.

I would highly recommend trolling the list for a while or going through the
archives for some of the web links to various websites kind folks here have
produced with tons of useful information -- almost every site leads to
another one via links.

Although I will admit that PICDEM2 User's Guide from Microchip is a really
bad way to learn PIC's, but I don't think that was the intended audience.

Keep on learning and have fun... we'll give Olin some more tranquilizers...
Maybe we need a [MEAN]: tag?  Sheesh.

Nate Duehr, natespamKILLspamnatetech.com

{Original Message removed}

2003\02\18@200404 by Neil Bradley

flavicon
face
> By your own admission you didn't know anything at all about PIC's, so how
> you'd know much about the oscillator options, is beyond me... so we'll see
> what we can do here...  but if you don't understand the uses of the
> different oscillator options at all, you'll really need some remedial
> reading to get going.

I'm familiar with the standard resonator and crystal/cap combo, but not
the others. My problem (at the time) was basically understanding the gamut
of options available in the PICs. Now that I understand them (as a
listmember emailed me privately and gave a very succinct definition of
each), it's no big deal. I've got that part set as I'm supposed to.

> Now... you also admitted that you can't read schematics,

Actually, I overstated my ignorance. I can read schematics with no
problems (I've even designed a few!), it's just knowing that I had to set
a clocking option in the PIC that caused the problem. I didn't know the
PIC nomenclature.

> Which crystal option did you populate the board with?  (Assuming here that
> you put it together when it was unpopulated...)
> In Figure 1.2, did you populate #10 or #11 or are you planning to use the
> on-board RC oscillator?  Is the jumper (J7) for that in the correct
> position?

In there I believe lies my problem. The oscillator I'm going to use is a
40Mhz part rather than the onboard *4Mhz* part. Supposedly (according to
the data sheet), the part runs all the way down to DC, with the exception
of the PLL option (which I'm not using).

It still doesn't explain the odd behavior of MPLAB, though. It'll step
through code all day and load up WREG with the appropriate values, but no
amount of code that writes to PORTA/B/C will change them. I can go in to
MPLAB's IDE and manually change the values, though.

Though I'm beginning to doubt the problem is related to the clock. Even if
things aren't working properly clock-wise, one would think it would be
able to single step through each instruction and do the proper thing. I'm
almost suspecting a defective PIC or debugger. Using the provided
simulator is next...

> There are a number of them out there.  I started with Myke Predko's book
> (http://www.myke.com) and there are others.  Your favorite online bookstore will
> return a number of results with "Microchip" or "PIC".

I'm going to head down to Powell's tech books and see what I can find.
Thanks kindly fo rthe advice!

> I would highly recommend trolling the list for a while or going through the
> archives for some of the web links to various websites kind folks here have
> produced with tons of useful information -- almost every site leads to
> another one via links.

Yeah, I've been trolling for a few weeks now and unfortunately my problem
seems to be unique. ;-(

Thanks again!

> Keep on learning and have fun... we'll give Olin some more tranquilizers...
> Maybe we need a [MEAN]: tag?  Sheesh.

Just be sure to give me some if you pass them on to Olin. I could use them
after spending so much time on a (seemingly) simple problem!

-->Neil

-------------------------------------------------------------------------------
Neil Bradley            In the land of the blind, the one eyed man is not
Synthcom Systems, Inc.  king - he's a prisoner.
ICQ #29402898

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@201646 by ACTION

flavicon
face
i'm with you tim !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@205142 by Dave Dilatush

picon face
Neil Bradley wrote...

>It seems the PIC development is very different than what I'm used to
>seeing. ;-) I come from a world of MCS-51 family and ARM CPUs, so a LOT of
>the PIC stuff is unfamiliar to me.

That's normal.  PICs are a little... different.

>Up until you mentioned it, I hadn't realized the MPLAB stuff actually had
>a simulator. I'll play with it tonight.

Oh, my.  I wouldn't want to leave home without it.

>Actually, I know quite a bit about electronics (I'm schooled in EE). I'm
>just trying to map the schematic to the PIC nomenclature.

Oh, OK.  The way your comment was worded, it seemed to imply that
you didn't, and were having trouble getting started.  Glad that's
not the case!

Dave D.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@205529 by Dave Dilatush

picon face
Neil Bradley wrote...

>In there I believe lies my problem. The oscillator I'm going to use is a
>40Mhz part rather than the onboard *4Mhz* part. Supposedly (according to
>the data sheet), the part runs all the way down to DC, with the exception
>of the PLL option (which I'm not using).

You substituted a 40 MHz crystal for the onboard 4 MHz crystal???

If that's what you did, that may be the problem: the maximum
crystal frequency for the 18Fxx2 parts is 25 MHz.  Above that
frequency, you must use a lower frequency crystal and engage the
4X PLL clock option.  I'm in the middle of several 18F252
projects right now, both using a 10 MHz resonator with the PLL to
give a 40 MHz internal clock rate.  They work fine.

But as far as I know, you CANNOT just hook up a 40 MHz crystal to
the PIC and get reliable operation.

Dave D.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@211412 by Tony Nixon

flavicon
picon face
Dave Dilatush wrote:

> I'm in the middle of several 18F252
> projects right now, both using a 10 MHz resonator with the PLL to
> give a 40 MHz internal clock rate.  They work fine.

Has anyone had trouble using the F series at this rate. I want to
convert a 16F876 project to 18Fxxx for more processing speed.


--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
.....salesKILLspamspam.....bubblesoftonline.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@213736 by Dave Dilatush

picon face
Tony Nixon wrote...

>Dave Dilatush wrote:
>
>> I'm in the middle of several 18F252
>> projects right now, both using a 10 MHz resonator with the PLL to
>> give a 40 MHz internal clock rate.  They work fine.
>
>Has anyone had trouble using the F series at this rate. I want to
>convert a 16F876 project to 18Fxxx for more processing speed.

FWIW, the projects I mentioned are using ECS, Inc. ZTT-10.00MT
resonators with built-in caps.

Dave D.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@221335 by cdb

flavicon
face
One place worth looking is http://www.picbook.com now I know I have
mentioned them before, but so far the Georgia Institute of Technology
in the guise of John Peatman, seems to be the only person to have
produced a book and some example code for the 18F series.

The book is not cheap, well not to Australia anyway, and the only
minor confusion is that he uses a GIT developed structured
preprocessor for the ASM file that runs through MPLAB. OTOH if you
already know how to convert LOOP-WHILE and REPEAT-UNTIL's to btfs*
whatever then away you go.

The early copies came with a lab board.

As an additional note for those in Australia, I purchased the book
last year and Pearson Education would only deal through booksellers
and Dymocks, Angus and Robertson and McGills refused to order it for
me - had to purchase it via Amazon.

Colin
--
cdb, EraseMEbodgy1spam_OUTspamTakeThisOuToptusnet.com.au on 19/02/2003

I have always been a few Dendrites short of an Axon and believe me it
shows.

Light travels faster than sound. That's why some people appear bright
until they speak!

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\19@013621 by Brian Smith

picon face
Dave Dilatush wrote:
> A third suggestion: regarding your comment (in another post)
> about not knowing much about electronics, let me suggest a
> book: The Art of Electronics, by Horowitz & Hill.  It's not
> quite a beginners book, but as textbooks go it's probably one
> of the least "newbie-hostile".  I recommend it; others will
> no doubt have more suggestions.

I disagree with the "not quite a beginners book".  Other than
some basic knowledge of electronics such as Ohm's law and a
vague knowledge of what a transistor does, most of what I know
of electronics (admittedly far from having an EE degree) comes
from this excellent book.  I found it to be very clear on basic
concepts, and it quickly proceeds to very useful and in-depth
subjects.  A very practical book, but it does not stint on
necessary theory.  It is the best textbook I have ever read.

It is not a book for most pre-college level people, however.
In that sense, I agree with you, Dave.  If project books at
Radio Shack are tough for someone, then this book will most
likely not be a good investment for them.

Brian Smith

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@025410 by Wouter van Ooijen

face picon face
> I'm not trying to ignore anything - I'm trying to learn.

In that case it would be wise to read and learn a lot before you exect
to get a PIC running by thinking it all up yourself. Do you have an 'art
of electronics'? Read it and read it again. And read the datasheet of
the PIC(s) you are using, and keep reading until you nearly all of it.

Or maybe start in copycat mode. Take a blink-a-led program from
somewhere on the web, build exactly the same cicrcuit, and when that
works go on, but take small steps.

And do read http://www.voti.nl/swp, and I have blink-a-led programs and
circuits at http://www.voti.nl/wisp628.

And yes, Olin does have an attitute, which is even more irritating
because he is most often right ;)

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email @spam@listservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@030305 by Neil Bradley

flavicon
face
> > I'm not trying to ignore anything - I'm trying to learn.
> In that case it would be wise to read and learn a lot before you exect
> to get a PIC running by thinking it all up yourself.

I don't think I could've been clearer - I'm using a PICDEM 2 board with
the stock hardware configuration attempting 8 lines of assembly language.
Not a lot of thinking required, here, and as I stated the problem has to
do with the debugger/ICE, not the default oscillator that comes with the
PICDEM 2 board! I think my chances are higher being successful with a
product that comes from Microchip than a board of my own design, wouldn't
you think?

-->Neil

-------------------------------------------------------------------------------
Neil Bradley            In the land of the blind, the one eyed man is not
Synthcom Systems, Inc.  king - he's a prisoner.
ICQ #29402898

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email KILLspamlistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@031331 by Wouter van Ooijen

face picon face
> Why Olin's always grumpy

I don't recall Olin ever being grumpy about a sensible question. That is
probably due to my interpretation of sensible?

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@032408 by Mike Singer

picon face
Nate Duehr wrote:
> ... Why Olin's always grumpy is probably a question best
> left between him and his therapist.  ;-)...

Tim Webb wrote:
> ... We do appreciate your help, but in the future, if you feel
> that you have to be a jerk and insult others, please don't
> even bother to respond.
> I am tired of hearing your wise mouth insulting people on
> this site and wasting bandwidth.  Either you contribute to
> this site by helping others in a polite way or you keep your
> mouth shut.

What part of Globe you were brought up guys?
Forcing to shut-up, compulsory psychiatric treatment,
special jails. Better kill him right now, him and those
who are unpleasant, though helpful. Stay with those
who always are nice and say what you want.
And you'll get finally what we've got - ex-USsr countries.

  Mike.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spamBeGonelistservspamBeGonespammitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@034108 by hael Rigby-Jones

picon face
> -----Original Message-----
> From: Neil Bradley [SMTP:TakeThisOuTnbEraseMEspamspam_OUTSYNTHCOM.COM]
> Sent: Wednesday, February 19, 2003 8:02 AM
> To:   RemoveMEPICLISTspamTakeThisOuTMITVMA.MIT.EDU
> Subject:      Re: [PIC]: More 18F252 woes
>
> > > I'm not trying to ignore anything - I'm trying to learn.
> > In that case it would be wise to read and learn a lot before you exect
> > to get a PIC running by thinking it all up yourself.
>
> I don't think I could've been clearer - I'm using a PICDEM 2 board with
> the stock hardware configuration attempting 8 lines of assembly language.
> Not a lot of thinking required, here, and as I stated the problem has to
> do with the debugger/ICE, not the default oscillator that comes with the
> PICDEM 2 board! I think my chances are higher being successful with a
> product that comes from Microchip than a board of my own design, wouldn't
> you think?
>
I have the PICDEM 2 board.  I'm guessing you are using the 4MHz canned
oscillator that comes with the board?  If so then you should be using either
EC or ECIO options (EC=external clock).  In practice it should work with
either XT or HS and probably even with the PLL enabled, but it would be a
good idea to stick to the options specified for an external clock.

Regards

Mike

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservEraseMEspam.....mitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@085130 by Olin Lathrop

face picon face
> In there I believe lies my problem. The oscillator I'm going to use is a
> 40Mhz part rather than the onboard *4Mhz* part.

You can't use more than a 20MHz crystal.  To get clock frequencies from
20-40MHz, you have to use a crystal from 5-10MHz with the PLL enabled.
Please read the oscillator configurations section of the manually again
very carefully.  I think some of your problems come from confusions in
this area.

> It still doesn't explain the odd behavior of MPLAB, though. It'll step
> through code all day and load up WREG with the appropriate values, but
no
> amount of code that writes to PORTA/B/C will change them. I can go in to
> MPLAB's IDE and manually change the values, though.
>
> Though I'm beginning to doubt the problem is related to the clock. Even
if
> things aren't working properly clock-wise, one would think it would be
> able to single step through each instruction and do the proper thing.
I'm
> almost suspecting a defective PIC or debugger. Using the provided
> simulator is next...

You keep stating the same problems and asking for advice.  I have at least
twice now asked you specific questions about your setup which you have not
answered.  Asking them again would apparently be pointless.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspammitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@085515 by Olin Lathrop

face picon face
> > I'm in the middle of several 18F252
> > projects right now, both using a 10 MHz resonator with the PLL to
> > give a 40 MHz internal clock rate.  They work fine.
>
> Has anyone had trouble using the F series at this rate. I want to
> convert a 16F876 project to 18Fxxx for more processing speed.

I have a 18F252 with 10MHz crystal and 4x PLL working just fine.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservEraseMEspamEraseMEmitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@115418 by Mark Samuels

flavicon
face
According to the datasheet, you can however use a 40MHz oscillator, or
other external 40MHz clock source.  You just can't use a crystal over 25MHz.



At 01:54 AM 2/19/03 +0000, you wrote:
{Quote hidden}

-------------------------------------------
Mark Samuels
ARMA Design
Tel:(858) 373-1320 x115
Fax:(858) 373-1325
Email: RemoveMEmarkspam_OUTspamKILLspamarmanet.com
Web: http://www.armanet.com



The information contained in this electronic message is private and may
contain privileged, confidential or inside information.  Any distribution,
copying or forwarding or use of this communication by anyone other than the
intended recipient(s) is strictly prohibited and may be unlawful.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTspamspammitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@130057 by Neil Bradley

flavicon
face
> > things aren't working properly clock-wise, one would think it would be
> > able to single step through each instruction and do the proper thing.
> > almost suspecting a defective PIC or debugger. Using the provided
> > simulator is next...
> You keep stating the same problems and asking for advice.  I have at least
> twice now asked you specific questions about your setup which you have not
> answered.  Asking them again would apparently be pointless.

I did answer them. The bottom line is it turned out to be a malfunctioning
ICD 2 and the fact that one cannot set "reserved" bits in the TRISA/B/C
registers to be tristated if those bits (say, RA6 for example) is used for
OSC2 output.

So I'm glad I could teach you something, as apparently you didn't know
this. You're welcome.

-->Neil

-------------------------------------------------------------------------------
Neil Bradley            In the land of the blind, the one eyed man is not
Synthcom Systems, Inc.  king - he's a prisoner.
ICQ #29402898

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspamspamspamBeGonemitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@221009 by Dmitriy A. Kiryashov

picon face
Greetings Olin and Piclisters.

Any underwater stones with 18F252/258 which you guys faced ?


WBR Dmitry.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body

2003\02\20@080728 by Olin Lathrop
face picon face
> Any underwater stones with 18F252/258 which you guys faced ?

I haven't used the 18F258 yet, although I've done a preliminary design
with one.  I have used the 18F252 without any surprises, although they
were rev 5 silicon.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestSTOPspamspamspam_OUTmitvma.mit.edu>

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