Prescale

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Emanuel Lourenco
Posts: 63
Joined: Mon Dec 23, 2013 5:51 pm
Been thanked: 8 times

Prescale

Post by Emanuel Lourenco »

Good Morning

I am amateur in the area and I am not understanding what is the prescale.
For example when adding the SPI component.
Could you possibly can explain me grateful.

Greetings
Emanuel Lourenço

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Prescale

Post by Benj »

Hello,

The SPI prescale is a division of the master instruction clock. So say the oscillator is running at 4MHz.

PIC 8-Bit & dsPIC30 = Instruction clock = Osc / 4 = 1MHz

PIC24 / dsPIC33 = Instruction clock = Osc / 2 = 2MHz

AVR = Instruction clock = Osc = 4MHz

So an 8-bit PIC with an Osc speed of 4MHz and a prescaler of 4 the SPI clock would be equal to 250K bits per sec when sending or receiving data.

Emanuel Lourenco
Posts: 63
Joined: Mon Dec 23, 2013 5:51 pm
Been thanked: 8 times

Re: Prescale

Post by Emanuel Lourenco »

Benj wrote:Hello,

The SPI prescale is a division of the master instruction clock. So say the oscillator is running at 4MHz.

PIC 8-Bit & dsPIC30 = Instruction clock = Osc / 4 = 1MHz

PIC24 / dsPIC33 = Instruction clock = Osc / 2 = 2MHz

AVR = Instruction clock = Osc = 4MHz

So an 8-bit PIC with an Osc speed of 4MHz and a prescaler of 4 the SPI clock would be equal to 250K bits per sec when sending or receiving data.
Thanks for the explanation
I think I understood.
So if I have a dsPIC33 clocked at 4 MHz, and a prescale of osc / 4.
I'll take 500 kbits per second right?

Greetings

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Prescale

Post by Benj »

So if I have a dsPIC33 clocked at 4 MHz, and a prescale of osc / 4.
I'll take 500 kbits per second right?
Sounds right to me :D

4MHz / 2 / 4 = 500KHz.

Emanuel Lourenco
Posts: 63
Joined: Mon Dec 23, 2013 5:51 pm
Been thanked: 8 times

Re: Prescale

Post by Emanuel Lourenco »

Benj wrote:
So if I have a dsPIC33 clocked at 4 MHz, and a prescale of osc / 4.
I'll take 500 kbits per second right?
Sounds right to me :D

4MHz / 2 / 4 = 500KHz.
Thanks for the explanation :D
Very good explanation

Post Reply