Panasonic MN103S User Manual page 448

Panaxseries
Hide thumbs Also See for MN103S:
Table of Contents

Advertisement

Chapter 14
A/D Converter
(10) Set the AD2: Set the AN2CTR0 register
Set the operation mode
AN2CTR0(0x0000A480)
bp1-0: AN2MD1-0=00
Set the conversion clock
AN2CTR0(0x0000A480)
bp4-2: AN2CK2-0=010
Set the external trigger A conversion start
enabled
AN2CTR0(0x0000A480)
bp5: AN2TRG=1
Set the conversion channel
AN2CTR0(0x0000A480)
bp101-8: AN2CH3-0=0100
Set the power-down mode
AN2CTR0(0x0000A480)
bp6: AN2OFF=1
Set the sample/hold cycle
AN2CTR1(0x0000A484)
bp5-4: AN2SHC1-0=10
(11) Set the AD2: Set the ADST2 register
Select the external trigger factor
ADST2(0x0000A488)
bp2-0: AD2ST2-0=101
(12) Set the AD2: Set the AN2CTREGA register
AN2CTREGA(0x0000A48C)
bp7-4: AN2ACNT3I-0I=0000
bp3-0: AN2ACNT3-0=0011
(13) Set the AD0: Disable the AD0 complete
interrupt
G26ICR(0x00008968)
bp8: G26IE0=1 bp9: G26IE1=1
Set the AD2: Disable the AD2 complete
interrupt
G28ICR(0x00008970)
bp8: G28IE0=1
(14) Start the PWM0 and 1
PWMMD0(0x0000A300)
bp1: TCEN0=1
PWMMD1(0x0000A330)
bp1: TCEN1=1
(15) Read the A/D value
AN0BUF0 (0x0000A410)
AN1BUF2 (0x0000A450)
XIV - 42
Operation
Setup Procedure
(10) Set the AN2MD1-0 flags of the AN2CTR0 register to
"00" to set "any channels/one-time conversion for each"
to operation mode.
Set the AN2CK2-0 flags of the AN2CTR0 register to
"010I" to set 3 dividing of IOCLK to the conversion
clock.
Set the AN2TRG flag of the AN2CTR0 register to "1" to
enable the external trigger factor A starting.
Set the AN2CH3-0 flags of the AN2CTR0 register to
"0100" to set "channel10" to the conversion channel of
the external trigger factor A.
Set the AN2OFF flag of the AN2CTR0 register to "1" to
set operation mode to the power-down mode flag.
*After shifted to operation mode, more than 100nsec
wait time is necessary until A/D conversion start.s
(11) Set the AD2ST2-0 flags of the A/D2 start trigger
selection register (ADST2) to "101" to set the PWM1
underflow to start factor.
(12) Set the AN2ACNT3I-0I flags to "0000" to start AD
conversion after the first time of the trigger factor is
counted.
Set the AN2ACNT3-0 flags to "0011" to start AD
conversion every time the trigger factor is generated
two times.
(13) Set the IE flags of the G26ICR and G28ICR registers to
"0" to enable the AD0 and 2 conversion complete
interrupts.
*In this set-up example, AD1 and AD0 interrupts are
generated at the same time; so, the interrupt of AD1 is
disabled at this point.
(14) Start the PWM0 and 1.
(15) Read the A/D0 conversion data buffer 00 and A/D1
conversion data buffer 02 (AN0BUF00, AN1BUF02) by
the AD0 complete interrupt processing after the A/D0
conversion is completed.
Description

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mn103sa7dMn103sa7g

Table of Contents