Re: M16C Micro timer pwm port
- From: Buddy Smith <nullset.spamtrap@xxxxxxxxxx>
- Date: Wed, 28 Sep 2005 13:43:21 +0000 (UTC)
Nav2u <navdeep2u@xxxxxxxxx> wrote:
> Hey Guys,
> im trying 2 generate a pwm signal to drive a stepper motor, got hold of
> Mitsubishi's example code which goes like this...
Please use things words, like "to". Usenet does not charge by the
byte.... oh, and I think they're going by "Renesas" now ;)
> void initPorts(void)
> {
> pd0 = 0xFF; // output mode
> pd1 = 0xFF; // output mode
"PD" is a direction register, so I guess on the M16C a 0 means input, a
1 means output. (p = port, d = direction)
> pu00 = 0; // no pull up for P0_0 to P0_3
> pu01 = 0; // no pull up for P0_4 to P0_7
> pu02 = 0; // no pull up for P1_0 to P1_3
"pu" is pull up. Pull up means that the microcontroller connects the
output to Vcc, through a resistor. So if you set P0_0 to '1', and the
internal pullup is enabled, Vcc will come out. If the pull up is not
enabled, you'll need one external to the chip on that port.
> Now using this code i get a signal on my pin p7.2 which is nearly 50us
> but i dont understand the initports function.....it changes port 0,1
> and 7 to o/p mode thats ok but what is up with the "pull up" part makes
> no sense. For the sake of understanding i changed all the settings to
> port2 from port7 but that has made no difference i still get a signal
> at p7.2
I hope I answered your question.
I would recommend that you get the Renesas datasheets and sample code
from their website.
--buddy
.
- References:
- M16C Micro timer pwm port
- From: Nav2u
- M16C Micro timer pwm port
- Prev by Date: Bit manipulation
- Next by Date: 8051 Speed Optimization
- Previous by thread: M16C Micro timer pwm port
- Next by thread: Re: MIDI spec question
- Index(es):