04.03.2013 Views

RL78/D1A User's Manual: Hardware - Renesas

RL78/D1A User's Manual: Hardware - Renesas

RL78/D1A User's Manual: Hardware - Renesas

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Under development<br />

Preliminary document<br />

Specifications in this document are tentative and subject to change.<br />

<strong>RL78</strong>/<strong>D1A</strong> CHAPTER 15 STEPPER MOTOR CONTROLLER/DRIVER<br />

15.3 Operation<br />

In the following, the operation of the Stepper Motor Controller/Driver module as a driver for external meters is described.<br />

15.3.1 Stepper motor controller/driver operation<br />

This section describes the generation of PWM signals of the driver k for driving external meters. Further, the<br />

explanation about the duty factor, operation of 1-bit addition circuit, detecting zero points and digital noise filter is shown.<br />

Remark k = 1 to 4<br />

(1) Driving meters<br />

External meters can be driven both in full bridge configuration and in half bridge configuration:<br />

Driving meters in full bridge configuration<br />

Deflection of the needle of a meter in full bridge configuration is determined by the sine and cosine value of its<br />

desired angle. Since the PWM signals do not inherit a sign, separate signals for positive and negative sine and<br />

cosine values are generated.<br />

The four signals at pins SMk1 to SMk4 of the driver k are:<br />

– sine side, positive (sin +)<br />

– sine side, negative (sin –)<br />

– cosine side, positive (cos +)<br />

– cosine side, negative (cos –)<br />

Two output control circuits select which signal (sign) for sine side and cosine side is output (bits<br />

MCMPCk.DIR[1:0]). At the remaining two output pins, the signal is set to low level.<br />

To drive meter k in full bridge mode, set bit MCMPCk.AOUT to 0.<br />

Driving meters in half bridge configuration<br />

In this mode, the same signal is sent to both sine pins (SMk1 and SMk2) and both cosine pins (SMk3 and SMk4),<br />

respectively. The setting of output control bits MCMPCk.DIR[1:0] is neglected.<br />

To drive meter k in half bridge mode, set bit MCMPCk.AOUT to 1.<br />

(2) Generation of PWM signals<br />

Bit data corresponding to the length of the PWM pulses has to be written to the compare registers MCMPk0 (sine<br />

side) and MCMPk1 (cosine side).<br />

A timer counter is counting up. The rising edge of the PWM pulse is initiated at the overflow of the counter. The<br />

falling edge of the PWM pulse is initiated when the counter value equals the contents of the compare register.<br />

The absolute pulse length in seconds is defined by the timer count clock (fMC0). Various cycle times can be set via the<br />

timer mode control register MCNTC0.<br />

Instruction<br />

When writing data to compare registers, proceed as follows:<br />

1. Confirm that MCMPCk.TEN = 0.<br />

2. Write 8-bit PWM data to MCMPk0 and MCMPk1.<br />

3. Set MCMPCk.ADB0 and MCMPCk.ADB1 as desired.<br />

4. Set MCMPCk.TEN = 1 to start the counting operation.<br />

The data in MCMPk0/MCMPk1 will automatically be copied to the compare slave register when the counter<br />

overflows. The new pulse width is valid immediately.<br />

Bit MCMPCk.TEN is automatically cleared to 0 by hardware.<br />

R01UH0317EJ0004 Rev. 0.04 959<br />

Feb. 22, 2013

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!