Source Code Files
Contents
USB08 Evaluation Board
Designer Reference Manual
MOTOROLA
Source Code Files
117
U08ADC.C
//============================================================================
// File: U08ADC.C
// Func: Software ADC for USB08
// Ver.: 1.00
// Auth: (C)2000,2001 by Oliver Thamm, MCT Elektronikladen GbR
// http://hc08web.de/usb08
// Rem.: View/Edit this File with TAB-Size=4
//============================================================================
#include "hc08jb8.h"
#include "u08adc.h"
//----------------------------------------------------------------------------
void initSADC() {
// disable internal Pull-Ups on PTE
POCR &= ~0x80;// disable PTE20P
}
//----------------------------------------------------------------------------
unsigned scaleSADC(unsigned t1, unsigned t2) {
t1 >>= 4;
t2 <<= 4;
_asm("lda 5,sp");
_asm("psha");
_asm("pulh");
_asm("ldx 2,sp");
_asm("lda 6,sp");
_asm("div");
// A = H:A/X
_asm("clrx");
// 0:A = t2/t1
}
//----------------------------------------------------------------------------
int getSADC(char channel) {
unsigned t0, t1, t2;
unsigned char p;
unsigned volatile zz;
// convert channel # 1/2/3 to 0x01/0x02/0x04
if(channel == 3) +;
Содержание MC68HC908JB8
Страница 2: ...blank ...
Страница 6: ...Designer Reference Manual USB08 Evaluation Board 6 List of Sections MOTOROLA List of Sections ...
Страница 16: ...Designer Reference Manual USB08 Evaluation Board 16 List of Tables MOTOROLA List of Tables ...
Страница 42: ...Designer Reference Manual USB08 Evaluation Board 42 Hardware Description MOTOROLA Hardware Description ...
Страница 88: ...Designer Reference Manual USB08 Evaluation Board 88 USB08 Descriptors MOTOROLA USB08 Descriptors ...
Страница 243: ...blank ...