Continue to Site

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.

several questions about 18f452

Status
Not open for further replies.

zhaniko93

New Member
1) what is CCP2MUX and what is it for / why I read that it's some kind of a multiplexor but why and how explain with plain english please :)
2) I use PWM and dont use CCP1CON<5:4> bits I only use CCPR1L (lower 8 ) bits of 10 bit PWM (i dont know whether it's 8 or 10 ) but in datasheet it's written that it's 10 bit and higher 2 bits are CCPR1CON bits so why do I achieve maximum duty having set top bits to 0? I am confused
 
From the data sheet.

1)
CCP2MX: CCP2 Mux bit
1 = CCP2 input/output is multiplexed with RC1
0 = CCP2 input/output is multiplexed with RB3

It selects which pin can be used for the CCP2 module.

2)
PWM duty cycle = (CCPR1L:CCP1CON<5:4>) • TOSC • (TMR2 prescale value)
PWMperiod = [(PR2)+1]•4•TOSC• (TMR2 prescale value)

Now
CCPR1L:CCP1CON<5:4>
means the 8 bits of CCPR1L followed by bits 5 and 4 of CCP1CON. If CCP1CON is not used, those two bits are 00. They are the least significant bits.
Ignoring the prescale,
If PR2 is 255, then the period is 256 x 4 x TOSC = 1024 * TOSC.
If CCPR1L is 255, the duty cycle is 255 x 4 x TOSC = 1020 * TOSC, or almost all the time hight.
 
Diver300
Thank you very much and please don't close this topic so that i can ask more small questions
 
what is hardware multiplier? (8x8 on 18f452)
 
oh and what is postscaler (i know what is prescaler but not postscaler)
 
And 1 more :p why does pic18f452 RA4 is Open drain? I mean, what can it be used for and what is it used for? Can't it operate just like a normal output?
 
It just means that it can multiply two numbers.

0x55 multiplied by 0x63 gives 0x20DF

With a hardware multiplier that takes one instruction cycle. Without, it needs many lines of code, to perform a long multiplication.
 
Ok what about other questions?
 
And 1 more :p why does pic18f452 RA4 is Open drain? I mean, what can it be used for and what is it used for? Can't it operate just like a normal output?

This means it can sink current, but not source it. You can use it as a low side switch, where your component has a resistor connected to a source voltage. This does not have to be the same source as your microcontroller supply.
 
...This does not have to be the same source as your microcontroller supply.

However, the source voltage that the pullup is connected to cannot be more than 0.5V more positive than the PIC's VDD.
 
However, the source voltage that the pullup is connected to cannot be more than 0.5V more positive than the PIC's VDD.

Thought that was the point of open drain... From the 18F452 18F4320, and 18F1220 data sheets:
Voltage on RA4 with respect to Vss ............................................................................................................... 0V to +8.5V
 
Status
Not open for further replies.

Latest threads

Back
Top