Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Headaches and the PIC18F452

Status
Not open for further replies.

auburnate

New Member
I'm trying my first embedded project with a 18f452. Right now I'm stuck with some weird behavior from my PIC. I'm just trying to get the external osc. to work and having no luck. I hooked up a 20 Mhz crystal and added the 2 decoupling caps and the behavior of the output LEDs on PORTB are erratic. When I switched to a powered osc and changed the configuration to accept a CLK IN, nothing better happens.
So my questions are as following:

1. What am I doing wrong?
2. What is the basic external pin configuration for the PIC to function?
3. What do I need to do to the chip (external connections) to get my blinkanled.asm file to work?


Any help would be greatly appreciated.

n8
 

motion

New Member
1. Those are not bypass caps and have the value from 15-33pf.

2. Please post how you set the configuration fuses. It is the first thing I'd check. For example, the watchdog timers could have been enabled and your code does not have CLRWDT instructions imbedded in it.

3. Please post the "blinkanled.asm" too.
 
Excuse me once again...

i'm trying to understand watchdog timer.. but confusions..

1. is it used for helping controller coming out of infinite loop when it is hanged..?

2. if yes.. then how..?:)
 

philba

New Member
Good point, Gayan, except for one point of forum decorum - don't hijack threads with your unrelated question. Start a new thread. Do you butt into some one's conversation and change the topic? Not a way to make friends.
 
again sorry...

well sorry again...

these days i am making many mistakes..

i shouldnt.. i hope this may not happen from next time...:)
 

blueroomelectronics

Well-Known Member
simrantogether said:
i'm trying to understand watchdog timer.. but confusions..

1. is it used for helping controller coming out of infinite loop when it is hanged..?

2. if yes.. then how..?:)

Yep that's what it does. It's a simple internal R/C oscillator that will reset the processor if a "clrwdt" command is not given before it times out.

The idea is if you program locks up the WDT will reboot it.
 
blueroomelectronics said:
Yep that's what it does. It's a simple internal R/C oscillator that will reset the processor if a "clrwdt" command is not given before it times out.

The idea is if you program locks up the WDT will reboot it.

I got it.. means you should clear before definite time period.. other wise the controller will understand that.. it is hanged and again it will reboot..

I hope i should also have it in my PC... :)
 

Oznog

Active Member
The 18F452 is a "not recommended for new designs" part now, isn't it? That's marketing-speak for "obsolete".

18F4520 is the replacement. 18F4620 if you want expanded capabilities, isn't there an 18F4680 too?
 
18F series...

Oznog said:
The 18F452 is a "not recommended for new designs" part now, isn't it? That's marketing-speak for "obsolete".

18F4520 is the replacement. 18F4620 if you want expanded capabilities, isn't there an 18F4680 too?


I've heard that 16F series are 8 bit controllers , 18 F series are 16 bit controllers and dsPIC are also 16 bit with high frequency microcontrollersthat can be used for DSP puposes..

Am i right..?:)
 

Nigel Goodwin

Super Moderator
Most Helpful Member
simrantogether said:
I've heard that 16F series are 8 bit controllers , 18 F series are 16 bit controllers and dsPIC are also 16 bit with high frequency microcontrollersthat can be used for DSP puposes..

Am i right..?:)

Sort of? - the 16F series are 14 bit, with an 8 bit databus - again 'sort of', the Harvard architecture doesn't really lend itself to that type of description.

The dsPIC are a series of PIC based DSP's, the clue is in their name! :p
 
well..

Again two doubts..:

1. when we are saying we are dealing with 8 bit microcontrollers then.. it means that " it has 8 bit data registers and 8 bit data bus.." then is 14 bit Address bus..( which is not..) or....?:rolleyes:

2. Prescalar means...

3. THERE ARE FOUR REGISTERS : EEDATA , EEADR , EECON1 AND EECON2... Are they for external eeprom memory interfacing..? The reason i'm asking this is ...

in example codes for Flashing an led.. i've never seen controlling these registers for reading or writing data...

this is the picture: picture of register table..


Any help will be appriciated..

Regards,

Simran..:)
 
Last edited:

Oznog

Active Member
The difference is that the lines use a different format for the instruction set. The expanded instruction set required longer words (program space). So the instruction size is different. PIC16 was 14 bits per instruction word. PIC18 is 16 bit instruction words- a few instuctions also need two words, GOTO for example stores part of the destination addr in the second word.

PIC16 has only 8-bit math, thus we call it an 8-bit core.
PIC18 is mostly 8-bit operations, though there's an exception we now have a 8 bit x 8 bit multply that makes a 16-bit result. Still, this is termed an 8-bit core. The Working Registers are 8-bit.

24F/dsPIC30/33F series are 16-bit cores in every way. They have a greatly expanded instruction set and different instruction length once again, 24 bits per instruction word now, but again that doesn't change what we call the core. It's a 16-bit core because all the math, AND/OR, and data move operations have a mode that work on 16-bit data words. The Working Registers are 16 bit long. It also has a 16bitx16bit=32bit multiply, a 32-bit Move, and for the dsPICs a pair of 40-bit Accumulators, but we don't call it a 32-bit core just for that.

Yes a core with 24-bits per instruction can't fit as many instructions into 1K of RAM as 14-bits per instruction. These later cores tend to have a lot more program ROM, and often a given task can be done in quite a bit fewer instructions so it may come out smaller. It'll come out faster for sure.
 
Last edited:
well..

A general electronics man who is dealing with 8 - bit microcontroller .. would not bother whether it is having 14 bit instruction set or 16 bit....

I've also not heard Microchip saying those as 14 bit microcontroller...

Here my question is:

1. why do we take the instructions' size into consideration when all the instructions are decoded by instruction decoder?

and - 2. why do we take the instructions' size into consideration when this is a RISC controller...

Regards,

Simran..:)
 
Last edited:

Nigel Goodwin

Super Moderator
Most Helpful Member
simrantogether said:
A general electronics man who is dealing with 8 - bit microcontroller .. would not bother whether it is having 14 bit instruction set or 16 bit....

I've also not heard Microchip saying those as 14 bit microcontroller...

Here my question is:

1. why do we take the instructions' size into consideration when all the instructions are decoded by instruction decoder?

We don't, it's really of very little interest.

and - 2. why do we take the instructions' size into consideration when this is a RISC controller...

Again, you don't really, unless you're really counting to save individual words.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top