钻石会员
主题
回帖0
积分23707
阅读权限50
注册时间2011-1-20
最后登录1970-1-1
在线时间 小时
|
M128的10bit ADC过采样到14bit,实测数据非常稳,推荐各位使用!- $regfile = "m128def.dat"
- $crystal = 8000000
- $baud = 9600
- '$sim
- Config Adc = Single , Prescaler = Auto , Reference = Internal
- On Adc Adc_isr
- Enable Adc
- Enable Interrupts
- Dim W As Word , V As Long , Y As Single , I As Word , S As String * 5
- I = 0
- V = 0
- Cursor Off Noblink
- Cls
- Lcd " ADC: /16384"
- Lowerline
- Lcd " VOL:"
- Do
- Start Adc
- Idle
- Stop Adc
- If I = 256 Then
- Shift V , Right , 4
- Y = V / 16384
- Y = Y * 2.56
- Locate 1 , 7
- S = Str(v)
- S = Format(s , " ")
- Lcd S
- Locate 2 , 7
- Lcd Y
- I = 0
- V = 0
- End If
- Loop
- End
- Adc_isr:
- W = Getadc(0)
- V = V + W
- I = I + 1
- Return
复制代码 |
评分
-
查看全部评分
|