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.
wow awesome!!! I will also do that... hehe


Any other challenges, up your sleeve?

I will ask you for sure If I encounter another one.. hehe

thanks...

I have now my PIC18f4550 and tomorrow I will try to blink a LED in actual hardware... hehe
 
Last edited:

This forum really a valuable. It's like a classroom, students sharing thoughts, their knowledge and understanding to any topic discussion.

yes... for this is more than a class room... :)

I learn a lot and directly here compared to school... hehe
 

i have only 20Mhz crystal here..

Actualy im learning to read and write to mmc/sd card because later if i know how then i will try to stream a wave file from card. I want to make simple music player.

That is why im learning basics of pic little by little.

Im hoping that i can do that project. Hehe
 

Ok,

Well here's a similar PIC18F/WAV project you may find of interest:

PIC18F SD WAV Audio Player

You may also want to consider off loading the decoding to a peripheral decoding device, for better performance and MIDI capabilities as well:

Breakout Board for VS1103 MIDI Decoder

Interesting project, keep me posted as to your progress.

Ciao
 

sure. Sure. For now i will not use any module but that will be the next part i will add for enhancement purposes.

Yes, its interesting project for me if ever this is done it will will inspire me more if i hear the music comes from my project. Hehehe

---------- Post added at 02:38 ---------- Previous post was at 02:27 ----------

by the way is it possible to do this project using 20mhz crystal? The max clock would be 20/4 =5Mhz right?

I think it would be better if i maximize my clock. Hehe i dont know.

---------- Post added at 02:40 ---------- Previous post was at 02:38 ----------

we have now a whole day power interruption here. Huhuhu i cant start working this day. Im on mobile.
 

by the way is it possible to do this project using 20mhz crystal? The max clock would be 20/4 =5Mhz right?

I think it would be better if i maximize my clock. Hehe i dont know.

Actually using a 4MHz crystal the PLL can generate up to a 48MHz Fosc, which I believe is the maximum clock for the 18F4550. Maximum Fosc, clock, would be vital for audio applications.

we have now a whole day power interruption here. Huhuhu i cant start working this day. Im on mobile.

Wow, that must be frustrating! What do you do when the cell phone battery dies? Can you charge it in a vehicle?
 

Wow, that must be frustrating!
What do you do when the cell
phone battery dies? Can you
charge it in a vehicle?
nope. :) i dont have a car :)

Actually using a 4MHz crystal the
PLL can generate up to a 48MHz
Fosc,
i dont understand this. I thought we can achieve max clock by using external 48mhz crystal. I cant get exact explaination about that PLL Thing in google how to use that.

Yes. The max clock is 48Mhzcant get exact explaination about that PLL Thing in google how to use that.

Yes. The max clock is 48Mhz.
 
Last edited:

PLL - Phase Locked Loop:

Phase Locked Loops (PLL)
circuits are used for frequency
control. They can be
configured as frequency
multipliers, demodulators,
tracking generators or clock
recovery circuits. Each of
these applications demands
different characteristics but
they all use the same basic
circuit concept.




I have additional information if you want it.
 

is that an external clocking circuit? I cant browse properly here in mobile. I will surely search about that soon.

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

battery is dead. :) better to sleep now. Hehe
 

is that an external clocking circuit? I cant browse properly here in mobile. I will surely search about that soon.

No,

The PIC 18F4550 has a PLL incorporated into its design. By using an external 4MHz crystal or the device's internal oscillator, a Fosc/Clock frequency of 48MHz can be generated.

Reference: PIC18F4550 Datasheet, pg 27, 2.2.4 PLL FREQUENCY MULTIPLIER

PIC18F2455/2550/4255/4550 devices include a Phase
Locked Loop (PLL) circuit. This is provided specifically
for USB applications with lower speed oscillators and
can also be used as a microcontroller clock source.


PIC18F4550 Datasheet

The information to setup the PLL is contained in the datasheet as well.

Hope your power comes back on.

Ciao
 
This is from the datasheet:
PIC18F2455/2550/4255/4550 devices include a Phase
Locked Loop (PLL) circuit. This is provided specifically
for USB applications with lower speed oscillators and
can also be used as a microcontroller clock source.
The PLL is enabled in HSPLL, XTPLL, ECPLL and
ECPIO Oscillator modes. It is designed to produce a
fixed 96 MHz reference clock from a fixed 4 MHz input.
The output can then be divided and used for both the
USB and the microcontroller core clock. Because the
PLL has a fixed frequency input and output, there are
eight prescaling options to match the oscillator input
frequency to the PLL.
There is also a separate postscaler option for deriving
the microcontroller clock from the PLL. This allows the
USB peripheral and microcontroller to use the same
oscillator input and still operate at different clock
speeds. In contrast to the postscaler for XT, HS and EC
modes, the available options are 1/2, 1/3, 1/4 and 1/6
of the PLL output.
The HSPLL, ECPLL and ECPIO modes make use of
the HS mode oscillator for frequencies up to 48 MHz.
The prescaler divides the oscillator input by up to 12 to
produce the 4 MHz drive for the PLL. The XTPLL mode
can only use an input frequency of 4 MHz which drives
the PLL directly.

This clearly tells you of the PLL incorporated in the PIC18F4550.
Read the datasheet carefully and for more information, there's always Google! :grin:

Hope this helps.
Tahmid.
 
Hope your power comes back on.

ok Im back.. it's getting late


The PLL is enabled in HSPLL, XTPLL, ECPLL and
ECPIO Oscillator modes. It is designed to produce a
fixed 96 MHz reference clock from a fixed 4 MHz input.
The output can then be divided and used for both the
USB and the microcontroller core clock. Because the
PLL has a fixed frequency input and output, there are
eight prescaling options to match the oscillator input
frequency to the PLL.
There is also a separate postscaler option for deriving
the microcontroller clock from the PLL. This allows the
USB peripheral and microcontroller to use the same
oscillator input and still operate at different clock
speeds. In contrast to the postscaler for XT, HS and EC
modes, the available options are 1/2, 1/3, 1/4 and 1/6
of the PLL output.

96Mhz clock? It's fast than I expected. from the MMC manual I have read that during operation we need to lower the clock up to 400Khz. I think in the initialization part of MMC(not sure) and switch to higher clock during read/write. so How do I reach that clock rate if my system is running very fast at 96Mhz? and the available postscaler are 1/2, 1/3, 1/4 and 1/6..I think I cant get lower up to 400Khz in this mode.. not sure just my idea... hehe




This clearly tells you of the PLL incorporated in the PIC18F4550.
Read the datasheet carefully and for more information, there's always Google!
sad to say Power here just resumed that's why I cant ask google properly :)
 

96Mhz clock? It's fast than I expected. from the MMC manual I have read that we need to lower the clock up to 400Khz so How do I reach that clock rate if my system is running very fast at 96Mhz? and the available postscaler are 1/2, 1/3, 1/4 and 1/6..I think I cant get lower up to 400Khz in this mode.. not sure just my idea... hehe

The actual maximum Fosc or system clock is 48MHz, due to the postscaler options of which the 1/2 is the small divisor. In other words 96MHz divided by 2 is 48MHz, the stated maximum Fosc in the devices datasheet.


Glad your power is back up.
 
from SD card SPI mode manual:

During the reset state, the card clock frequency should be between 10–400 KHz. After the reset
state, the maximum clock frequency can be increased to 25 MHz (20 MHz for the MMC).
3.18 Summary

I think I cant use the PLL because even I use the largest scaler the clock still 98*1/6 = 16Mhz.... Am I correct? hehe
 

Actually the 400kHz you are referring to is the SPI interface clock, not the Fosc or system clock.

Reference PIC18F4550 Datasheet, pg 197, 19.0 MASTER SYNCHRONOUS SERIAL PORT (MSSP) MODULE

19.3 SPI Mode

The SPI mode allows 8 bits of data to be synchronously
transmitted and received simultaneously. All four
modes of the SPI are supported. To accomplish
communication, typically three pins are used:
• Serial Data Out (SDO) – RC7/RX/DT/SDO
• Serial Data In (SDI) – RB0/AN12/INT0/FLT0/SDI/SDA
• Serial Clock (SCK) – RB1/AN10/INT1/SCK/SCL
Additionally, a fourth pin may be used when in a Slave
mode of operation:
• Slave Select (SS) – RA5/AN4/SS/HLVDIN/C2OUT
Figure 19-1 shows the block diagram of the MSSP
module when operating in SPI mode.

Different clock, details of configuring the SPI interface are contained in the section reference above in the datasheet. Basically there nothing to be to concerned about, you can run a 48MHz Fosc and still use the SPI interface if it is properly configured.
 
Actually the 400kHz you are referring to is the SPI interface clock, not the Fosc or system clock.
okay I think I got it.. :)

Different clock, details of configuring the SPI interface are contained in the section reference above in the datasheet. Basically there nothing to be to concerned about, you can run a 48MHz Fosc and still use the SPI interface if it is properly configured.




page 197. MSSP module:

SSPM3:SSPM0: Master Synchronous Serial Port Mode Select bits
0101 = SPI Slave mode, clock = SCK pin, SS pin control disabled, SS can be used as I/O pin(3)
0100 = SPI Slave mode, clock = SCK pin, SS pin control enabled(3)
0011 = SPI Master mode, clock = TMR2 output/2(3)
0010 = SPI Master mode, clock = FOSC/64(3)
0001 = SPI Master mode, clock = FOSC/16(3)
0000 = SPI Master mode, clock = FOSC/4(3)

let say for example:
if I use PLL then use 1/6 scaler I will get 16Mhz system clock(96*1/16).
to be able to reach the max of 400Khz during on reset of SD card in SPI mode I will configure my SPI to run at FOSC/64 to have 250Khz speed for SPI during initialization.. I hope I am corect.. hehe

---------- Post added at 14:14 ---------- Previous post was at 14:09 ----------

the link you have posted is awesome... hehe the project file is also there and the hex file... hekhekhkehe lol


**broken link removed**

---------- Post added at 14:17 ---------- Previous post was at 14:14 ----------

The author of this project is from Philippines.. I can Understand the backgroud noise in this video... hehe it's my language... hehe lol

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

The audio of this project has a lot of noise.. In that part where can we enhance the audio part? I think in the hardware part..
 

Yes and No.

You will need to setup the Fosc for 48MHz due to the audio decoding requirements, the project blog actually discusses this point.

Attached is the source code, download it, if you have not already and study it, particularly the main.c which contains the setup of the Fosc and spi_pic18.c and the associated header file.

They should give you some insight as to how to setup the SPI interface and Fosc. I believe the project uses a 20MHz Crystal, but similar results should be achieve with a 4MHz Crystal.
 

Attachments

  • PIC18 SD WAV Audio Player.rar
    479.1 KB · Views: 65
I have lost track of the thread but if i scroll back.... Interfacing SD card is too early for romel... maybe you may have do a ot of basics program and develop sd card once you are familiar with SPI..... Going too fast is also tooo bad... i dont see any point in giving you so many advanced topic source code so soon by other members.....

If you have asked for it .. but i feel a slow approach is always good, and i wonder how some of the experienced people missed to tell you and are helping you....

I am not harsh nor degrade your learning speed.. but learn slowly, as there is no hurry to finish things.......
 
I have lost track of the thread but if i scroll back.... Interfacing SD card is too early for romel... maybe you may have do a ot of basics program and develop sd card once you are familiar with SPI..... Going too fast is also tooo bad... i dont see any point in giving you so many advanced topic source code so soon by other members.....

If you have asked for it .. but i feel a slow approach is always good, and i wonder how some of the experienced people missed to tell you and are helping you....

I am not harsh nor degrade your learning speed.. but learn slowly, as there is no hurry to finish things.......

actually your correct.. but I will do it slowly(my style).. my first target is just to do simple read/write in sd card.. the wav player is for the future.. :) hehe

I have some of the information, source code and e-books here about sd card interfacing all I need is to study this things... Honestly I dont understand this all but I have only a very little idea which I know I can develop this in the near future...

---------- Post added at 14:54 ---------- Previous post was at 14:51 ----------

I have a source code here to write a simple txt file to sd card but I want to understand this whole thing why it is written like this... I will study all this stuff chunk by chunk..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top