AN2475 Freescale Semiconductor / Motorola, AN2475 Datasheet - Page 22

no-image

AN2475

Manufacturer Part Number
AN2475
Description
Generating a PWM Signal Modulated by an Analog Input Using the MC68HC908QY4 Microcontroller
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
AN2475/D
initCfg2: equ
;
;
;
;
;
;
;
;
;
initAD: equ
;
;
;
;
;
;
;
;
;
initTim: equ
;
;
;
;
;
;
;
;
;
periodH: equ
periodL: equ
InitpwmH: equ
InitpwmL: equ
ADclkval: equ
tsc0Val: equ
;
;
;
;
;
;
;
;
;
22
%00000000
%00100011
%00110000
%00000000
%11111111
%00000000
%10000000
%10000000
%00101010
||||||||
|||||||+-RSTEN
||||||+--R
|||||+---R
||||+----OSCOPT0 - 0 Set oscillator option as internal
|||+-----OSCOPT1 - 0 Set oscillator option as internal
||+------R
|+-------IRQEN
+--------IRQPUD
||||||||
|||||||+-CH0
||||||+--CH1
|||||+---CH2
||||+----CH3
|||+-----CH4
||+------ADCO
|+-------AIEN
+--------COCO
||||||||
|||||||+-PS0
||||||+--PS1
|||||+---PS2
||||+----0
|||+-----TRST
||+------TSTOP
|+-------TOIE
+--------TOF
||||||||
|||||||+-CH0MAX
||||||+--TOV0
|||||+---ELS0A
||||+----ELS0B
|||+-----MS0A
||+------MS0B
|+-------CH0IE
+--------CH0F
Generating a PWM Signal Modulated by an Analog Input
Freescale Semiconductor, Inc.
For More Information On This Product,
Using the MC68HC908QY4 Microcontroller
;Config2 Register value
CONFIG2 is a write once register
;AD configuration value
ADC Status and Control Register
;Timer Status and control Reg. value
TIM Status and Control Register
;TIM Counter Modulo Registers
;Set period high register value
;Initial Period value
;Set period to 256
;Initial PWM duty cycle value
;Set PWM duty cycle to 50%
;AD clock configuration
;ADC Clock prescaler bit
;TSC0 Initial Value
TIM Channel Status and Control Register
- 0 Reset function inactive in pin
- 0 Reserved bit
- 0 Reserved bit
- 0 Reserved bit
- 0 disable IRQ function
- 0 Internal pullup conecte IRQ and VDD
- 1 Mux to select ADC channel
- 1 Mux to select ADC channel
- 0 Mux to select ADC channel
- 0 Mux to select ADC channel
- 0 Channel 3 selected
- 1 Set ADC as continuous conversion
- 0 disable ADC interrupt
- 0 Conversions Complete Bit
- 0 Prescaler select bit
- 0 Prescaler select bit
- 0 Tim clock source int. bus / 8
- 0
- 1 TIM reset bit
- 1 TIM counter stopped
- 0 disable TIM overflow interrupts
- 0 TIM overflow flag bit
- 0 Channel 0 Maximum Duty Cycle bit
- 1 Channel 0 toggle on overflow
- 0 |
- 1 |
- 0 |
- 1 |-> Config TIM as buffered PWM
- 0 disable Channel 0 CPU interrupt
- 0 No input capture or output compare
Go to: www.freescale.com
MOTOROLA

Related parts for AN2475