Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] PIC complete discussion for all

Status
Not open for further replies.
look for these
**broken link removed**

hahaha.. very good site... this will teach me easily... thank you very much..

Im reading the datasheet of my PIC just to know what are the registers associated with the SPI protocol but in your link they are all give..!!! thanks...
 

Im using PIC18f4550.. let me ask question again if I have question.. :) I just want o learn the SPI protocol..:oops:

Well, you've moved up in the world, using a PIC18F4550?

Be careful, due to the fact this PIC has an USB bus, configuring the oscillator correctly is of up most importance.

I've had to lend assist numerous times to individuals who thought their PIC18F4550 was running a 4MHz when in fact it was running a 48MHz.

Reference the Microchip PIC18F2455/2550/4455/4550 Data Sheet, pg 23, 2.0 OSCILLATOR CONFIGURATIONS

Devices in the PIC18F2455/2550/4455/4550 family
incorporate a different oscillator and microcontroller
clock system than previous PIC18F devices. The addition
of the USB module, with its unique requirements
for a stable clock source, make it necessary to provide
a separate clock source that is compliant with both
USB low-speed and full-speed specifications.
To accommodate these requirements, PIC18F2455/
2550/4455/4550 devices include a new clock branch to
provide a 48 MHz clock for full-speed USB operation.
Since it is driven from the primary clock source, an
additional system of prescalers and postscalers has
been added to accommodate a wide range of oscillator
frequencies. An overview of the oscillator structure is
shown in Figure 2-1.

I hope you've downloaded the datasheet Romel and studied it. Otherwise, you could experience a rocky road.

Ciao
 
wow.. Im afraid, maybe even a simple blinking of LED I cant perform... now Im confused. :)

here I found the OSCON register. what does system clock select bits means? let say for example Im using external crystal at 12Mhz for a blinking LED program..how do I set this register anayway.... hmmm

**broken link removed**

---------- Post added at 01:41 ---------- Previous post was at 01:39 ----------

by the way. even if I have this PIC I will never touch the USB feature of this CHIP... I just want do some practice in register configuration and I know I can practice using this PIC because it is more complicated... :)
 

It can be a little confusing, here are a few cheat sheets:

18F4550 MCU oscillator basics

18F4550 Setup

Using the internal OSC, instead of an external crystal:

Swordfish Code Snippet - Internal Oscillator and PLL

New style of CONFIG for use with the PIC 18F series, also check Hi-Tech User Manual:



These links should give you a little to chew on for a while.

Ciao

---------- Post added at 01:04 ---------- Previous post was at 01:01 ----------

by the way. even if I have this PIC I will never touch the USB feature of this CHIP... I just want do some practice in register configuration and I know I can practice using this PIC because it is more complicated... :)

Coward!

No Pain, No Gain! :grin:
 
Coward!

No Pain, No Gain!

haha.. for now... I know Im a newcomer in this world that is why I will not jump into that level.. :-o
still learning... :)

thanks for your links... :)
 

haha. I dont know how to use the compiler :)

in the HI-tech C18 compiler do I need to manually copy the
#include <p18f4550.h>
file in my project folder?

---------- Post added at 05:29 ---------- Previous post was at 05:03 ----------

im reading now the compiler manual... hehe
 

No, the "<>" indicates the header should be found in the default "include" search path.

Is your compiler balking about not finding it?

If so, please post the error messages.

---------- Post added at 04:36 ---------- Previous post was at 04:33 ----------

I assume you used the project wizard to setup a new C18 or Hi-Tech Compiler project?

By the way, the C18 and Hi-Tech Compiler for the PIC18 are not the same.

---------- Post added at 04:47 ---------- Previous post was at 04:36 ----------

Let me rephrase my initial answer.

It is not necessary to add/copy the p18f4550.h into your project directory. However, if you would like to have it available for reference while coding, which I personally do quite often, you may add it to the project file window. Doing so will not physically move or copy the header file into your project directory, but will place a icon in the project file window which you may click on to open and view at any time.
 
ok.. i found one problem. already solved the problem posted above.

I got a linker error now and then i check the installation folder of my c18 there is no lkr folder where linkers resides..

By the way, the C18 and Hi-Tech Compiler for the PIC18 are not the same.
i dont know this.. I will check the site of HI-tech and download the compiler for pic18..
 

The C18 is Microchip's Compiler, even though Microchip and Hi-Tech are now one big happy family, Microchip bought Hi-Tech sometime ago, they still sell their own compilers.

I doubt whether this will continue for much longer.

If you're using the Microchip's C18 compiler, there is nothing wrong with it. I own both versions, I think Microchip has already started to steer people towards the C18 and away from Hi-Tech's version.

---------- Post added at 05:03 ---------- Previous post was at 04:59 ----------

If you stay with embedded systems, the next item you need to put on your shopping list is a nice development board.

Can you or have you purchased anything on eBay?
 
If you stay with embedded systems, the next item you need to put on your shopping list is a nice development board.

yes, Im thinking the same way..

Can you or have you purchased anything on eBay?
nope, I haven't tried purchasing something from ebay..

I just visited ebay and found this stuff:
**broken link removed**
i think I can interface this to my PIC in the future and make a simple mp3 player.. hehe i dont know that's why In trying hard to learn... :)


If you're using the Microchip's C18 compiler, there is nothing wrong with it. I own both versions, I think Microchip has already started to steer people towards the C18 and away from Hi-Tech's version.

Im getting away with C18 now because it dont include the lkr folder.. I dont have the option to include that file during installation

**broken link removed**

---------- Post added at 06:18 ---------- Previous post was at 06:14 ----------

perfect!! hehe I got no problem with HI-TECH C for 18f
 

Im getting away with C18 now because it dont include the lkr folder.. I dont have the option to include that file during installation

perfect!! hehe I got no problem with HI-TECH C for 18f

That's strange, my C18 Compiler installation contains a "lkr" directory with all the linker scripts, "C:\Program Files\Microchip\MPLAB C18\lkr", including a 18f4550.lkr script and I have no problem adding it to the project using the project wizard.
 

hat's strange, my C18 Compiler installation contains a "lkr" directory with all the linker scripts,

yes it was strange.. my experience also in PIC is very strange... :)

I have account now in ebay... I will shop there if I got some money... lol
 

The pickings are a quite slim now, but I regularly see Microchip PICDEM 2 Plus, PICDEM.NET, dsPICDEM, Explorer 16, CAN/LIN and PIC32 Starter Boards even an occasional Explorer 18 Board on eBay and have bought quite a few at very good prices.

Also Microchip has an education discount for students, 25% off all their development products, at least here in this country, the only requirement is an email address from an educational institution, .edu domain.

You might want to look into it.
 

Also Microchip has an education discount for students, 25% off all their development products, at least here in this country, the only requirement is an email address from an educational institution, .edu domain.

wow.. thanks for sharing.. I have my school email im happy to know that..

is that offer from the microchip website?
 

I've learned from years of experience that it is usually more advantageous to purchase development boards, programmers and debuggers that are sold or recommended by the chip's manufacture.

The inexpensive dev boards and clone/knockoff debugger or programmers fall into three categories: they don't function at all, they function properly at times or at limited capacity or they function just fine as advertised. The problem is I do not have the time or temperament to purchase an item and figure out which of these categories it belongs.

The other problem is support and documentation. For example if you have an issue with a Microchip dev board, they will go out of their way to help you and solve or correct the problem.

Thinking I was saving a significant amount of money, I once purchased a FPGA development board from a Chinese company. Upon receiving the item, I soon realized the schematic they provided did not match the actual product. And of course the only technical support was some individual who could only speak Mandarin Chinese.

So the moral of the story is, I now have an expensive FPGA board that without extensive time consuming reverse engineering is ultimately worthless.

Ciao

---------- Post added at 06:23 ---------- Previous post was at 06:15 ----------

wow.. thanks for sharing.. I have my school email im happy to know that..

is that offer from the microchip website?

Sorry for the above rant, the board is hanging on my wall as a reminder not to be tempted in the future and occasionally I have to vent.

Here's the info on Microchip's Academic Discount Program:

**broken link removed**

I believe if you create an account with an .EDU domain email address the discount is automatic.

Hope the info helps.

---------- Post added at 06:27 ---------- Previous post was at 06:23 ----------

By the way, I've bought half a dozen ICD2s and ICD3s on eBay at great savings. The ICD2s usually sell for in the neighborhood of $50 USD or less. The PICDEM 2 Plus boards sell in the $35 to $45 USD range. So depending on the shipping charges, it maybe worth picking up a few items on eBay.
 
hi,

Im trying to blink a led with PIC18f4550 using proteus simulator.
what is the matter with this PIC because the PIC16f series functions in the simulator without setting the MCLR pin to high.

I mean I just noticed that it's different from PIC16f877a because during simulation it still function without setting the MCLR.. but this PIC it needs to pull the MCLR to high for everything to function...I know that in the real hardware it needs to pull to high.

just asking.. :)

---------- Post added at 15:48 ---------- Previous post was at 100:200 ----------

ang also I found this lines after compiling my code.. I search on google about this but it does not give me exact explanation i want.. :)

Advisory[1233] Employing 18F4550 errata work-arounds:
Advisory[1234] * Corrupted fast interrupt shadow registers


---------- Post added at 16:24 ---------- Previous post was at 15:49 ----------

1 thing I get confused about the PORT and LAT register of PIC18 series . :)

**broken link removed**

so I have this code to blink a specific bit :)

if I use LAT to blink a led then it blinks the led and also if I used PORT it also blink the LED.. what's the difference of the two? hmm

after a seach in google i fount this one answer based on the experienced of someone. let me quote his answer.

There are a few situations where they can be different. The one that I've encountered most frequently is if you have a pin (accidentally) shorted to ground. If you set the latch high, the latch will read high, but the port will read low because the voltage on the pin is still approximately ground.




PHP:
void main()
{
   //Initialize PORTD
   //PD0 as Output
   TRISD=0b11101111;

   //Now loop forever blinking the LED.
   while(1)
   {
      	PORTD=0B00000000;  //PORTD0 = HIGH	
	//	LATD=0B00000000;  //PORTD0 = HIGH

      Wait();

      	PORTD=0B00010000;  //PORTD0 = LOW
	//	LATD=0B00010000;  //PORTD0 = LOW
      Wait();
   }
}
 
Last edited:

hi,

Im trying to blink a led with PIC18f4550 using proteus simulator.
what is the matter with this PIC because the PIC16f series functions in the simulator without setting the MCLR pin to high.

I mean I just noticed that it's different from PIC16f877a because during simulation it still function without setting the MCLR.. but this PIC it needs to pull the MCLR to high for everything to function...I know that in the real hardware it needs to pull to high.

just asking.. :)

I have to say my experience with Proteus is quite limited, I was contractually obligated to purchase the professional version due to a client stipulation.

That being said, a simulation is only as good as the models and the simulation platform. I'm sure you have notice by now that hooking up the Vdd, Vss and even the crystal or external clock is not required for the simulation to run. So it would surprise me if correctly pulling the MCLR high wasn't a necessity as well.

As far as the Advisory notices, I have not come across them before, most likely due to lack of building a simulation with a 18F4550. Most of the error messages enable you to click on them at which point a help system provides additional information.

Have you attempted to click on the Advisory Messages?

I'll see what I can find out concerning the messages, if I come across anything I will let you know.

Ciao
 
are you not sleeping? hehe your always online here.. :)

---------- Post added at 16:35 ---------- Previous post was at 16:32 ----------

As far as the Advisory notices, I have not come across them before, most likely due to lack of building a simulation with a 18F4550. Most of the error messages enable you to click on them at which point a help system provides additional information.

Have you attempted to click on the Advisory Messages?

It not clickable... I think this is not a warning nor an error msg...

---------- Post added at 16:36 ---------- Previous post was at 16:35 ----------

anyway let's let it be.. I think it's not causing any problem(for now).. :)
 

Basically reading a value from LATB is actually retrieving the values contained in the PORTB Latch, while reading a value from PORTB is retrieving the current state of each pin in PORTB. So, yes there are times when the values could be different due to a shorted line either to Vdd or Vss. Also an overloaded line with high capacitive values, could delay the pin from reaching its intended level, due to the RC values. Do you remember exponential charge and decay circuits?

Does this help explain the difference?

---------- Post added at 15:43 ---------- Previous post was at 15:37 ----------

By the way, the difference of values between LATB and PORTB is referred to as a Read-Write-Modify Problem/Issue.


are you not sleeping? hehe your always online here.. :)

I only sleep four hours a day, sometimes in two separate two hour naps! I been this way since my teenage years.
 
Does this help explain the difference?

yes a bit clearer now.. I will just use PORTB instead in my future I/O programs...

I only sleep four hours a day, sometimes in two separate two hour naps! I been this way since my teenage years.

It's not good :) you need some rest to have a good health :)

---------- Post added at 17:24 ---------- Previous post was at 17:21 ----------

I love the way we discuss here.. :grin: I feel much better here than in the four walls of my class room and listening the lectures of my teacher.. :)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top