📄 ad71.c
字号:
#pragma option v;
/*
These routines may be adapted for any purpose when
used with the MPC Code Development system. No
warranty is implied or given as to their usability
for any purpose.
(c) Copyright 1995,96
Byte Craft Limited
Waterloo, Ontario
Canada N2J 4E4
(519) 888-6911
Sherif Abdel-Kader
This example demonstrates the use of the A/D module on
the PIC16C71. The technique is the same for all PIC16C7x
having 4 channel A/Ds.
This is part of the BCLINK example project and should only
be compiled using DO-AD.BAT.
*/
#include <16c71.h>
#include <ad71.h>
#include <delay14.h>
void main()
{
INIT_A2D(ANA4_VDD, FRC); // RA0 - RA3 in analog mode
// Internal RC Oscillator
// A/D module ON
TRISA = 0x0F; // RA0 - RA3 in input mode
while(1)
{
Select_A2D_Ch(Ch0); // Select channel 0
Delay_10xUs_4MHz(20); // Delay 20 us
TRISB = 0x00;
PORTB = ConvertAD(); // Convert and display result
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -