Skip to content

Instantly share code, notes, and snippets.

@Enchan1207
Created April 23, 2021 06:02
Show Gist options
  • Save Enchan1207/87eeae967d23a8b96a761038bbc03055 to your computer and use it in GitHub Desktop.
Save Enchan1207/87eeae967d23a8b96a761038bbc03055 to your computer and use it in GitHub Desktop.
標本化定理の実験
//
// 標本化定理の実験
//
#include <pc.h>
#define BASE 0x01C0
int main(int argc, char const *argv[]){
// define
unsigned char ad_h, ad_l;
// configuration
outportb(BASE + 1, 0x02);
outportb(BASE + 5, 0x02);
// loop
while(1){
// ad
outportb(BASE + 0, 0x00); // start conversion
while(inportb(BASE +2) & 0x01){}
ad_h = inportb(BASE + 1);
ad_l = inportb(BASE + 0);
// da
while(inportb(BASE+2) & 0x02){}
outportb(BASE + 6, ad_l);
outportb(BASE+7, ad_h);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment