MSP430F2274 端口操作Word下载.docx
- 文档编号:21179639
- 上传时间:2023-01-28
- 格式:DOCX
- 页数:42
- 大小:829.82KB
MSP430F2274 端口操作Word下载.docx
《MSP430F2274 端口操作Word下载.docx》由会员分享,可在线阅读,更多相关《MSP430F2274 端口操作Word下载.docx(42页珍藏版)》请在冰豆网上搜索。
i>
0;
i--);
//延时
P1OUT^=
//LED翻转
}
12274——1.C
1.//******************************************************************************
2.//
MSP430F22x4
Demo
-
Software
Toggle
P1.0
3.//
4.//
Description;
by
xor'
ing
inside
of
a
software
loop.
5.//
ACLK
=
n/a,
MCLK
SMCLK
default
DCO
~1.2MHz
6.//
7.//
8.//
-----------------
9.//
/|\|
XIN|-
10.//
|
11.//
--|RST
XOUT|-
12.//
13.//
P1.0|-->
LED
14.//
15.//
A.
Dannenberg
16.//
Texas
Instruments
Inc.
17.//
April
2006
18.//
Built
with
CCE
Version:
3.2.0
and
IAR
Embedded
Workbench
3.41A
19.//******************************************************************************
20.#include
"
21.
volatile
unsigned
int
i;
//
to
prevent
optimization
22.
void
main(void)
23.{
24.
WDTPW
+
WDTHOLD;
Stop
watchdog
timer
25.
P1DIR
|=
0x01;
Set
output
direction
26.
for
(;
;
)
27.
{
28.
P1OUT
^=
using
exclusive-OR
29.
i
50000;
Delay
30.
do
(i--);
31.
while
(i
!
0);
32.
}
33.}
22274-VLO.C
P1.0,
VLO/8
Pulse
1/100
active
duty
cycle
software.
Ultra-low
frequency
~
1.5kHz,
ultra-low
power
mode
demonstrated.
VL0,
~1.5kHz,
n/a
October
19.//
20.//******************************************************************************
21.#include
23.volatile
25.void
26.{
BCSCTL3
LFXT1S_2;
LFXT1
VLO
IFG1
&
~OFIFG;
Clear
OSCFault
flag
__bis_SR_register(SCG1
SCG0);
BCSCTL2
SELM_3
DIVM_3;
LFXT1/8
0xFF;
All
P1.x
outputs
33.
reset
34.
P2SEL
P2.x
GPIO
function
35.
P2DIR
36.
P2OUT
37.
P3DIR
P3.x
38.
P3OUT
39.
P4DIR
P4.x
40.
P4OUT
41.
42.
43.
44.
set
45.
10;
>
1x
46.
~0x01;
47.
1000;
100x
48.
49.}
32274_ADC10_1
42274_ADC10_2.C
ADC10,
Sample
A0,
1.5V
Ref,
if
A0
0.2V
Description:
A
single
sample
is
made
on
reference
internal
Vref.
sets
ADC10SC
start
conversion
automatically
cleared
at
EOC.
ADC10
oscillator
times
(16x)
conversion.
In
Mainloop
MSP430
waits
in
LPM0
save
until
complete,
ADC10_ISR
will
force
exit
from
reti.
If
0.2V,
set,
else
reset.
---|P2.0/A0
20.//
21.//
22.//
23.//******************************************************************************
24.#include
26.void
27.{
WDT
ADC10CTL0
SREF_1
ADC10SHT_2
REFON
ADC10ON
ADC10IE;
TACCR0
30;
allow
Ref
settle
TACCTL0
CCIE;
Compare-mode
interrupt.
TACTL
TASSEL_2
MC_1;
TACLK
SMCLK,
Up
mode.
__bis_SR_register(CPUOFF
GIE);
LPM0,
TA0_ISR
~CCIE;
Disable
Interrupt
ADC10AE0
P2.0
ADC
option
select
ENC
ADC10SC;
Sampling
(ADC10MEM
<
0x88)
ADC10MEM
0.2V?
off
47.}
49.//
interrupt
service
routine
50.#pragma
vector=ADC10_VECTOR
51.__interrupt
ADC10_ISR(void)
52.{
53.
__bic_SR_register_on_exit(CPUOFF);
CPUOFF
bit
0(SR)
54.}
55.
56.#pragma
vector=TIMERA0_VECTOR
57.__interrupt
TA0_ISR(void)
58.{
59.
60.
LPM0_EXIT;
Exit
return
61.}
5
2274_ADC10_3.C
A10
Temp,
Temp
++
~2C
the
integrated
temperature
sensor
detect
gradients.
The
voltage
sampled
every
120ms
compared
defined
delta
values
an
ISR.
(ADC10OSC/4)/64
determines
time
which
needs
be
greater
than
30us
sensor.
operated
repeat-single
channel
convert
trigger
sourced
Timer_A
CCR1.
ADC10IFG
end
each
converstion
~1.2MHz,
ADC10CLK
ADC10OSC
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- MSP430F2274 端口操作 端口 操作