ဒီ Program ကေတာ့ C, C++ Programming Language နဲ႔ RS232 (COM) ကို ေရး၊ ဖတ္တဲ့ Program ေလးပါ။ သူ႕ကိုေရးဖို႔ဆိုရင္ bios.h (Header file) လုိပါတယ္။ bios.h အတြက္ download လုပ္ဖို႔လည္းေပးထားပါတယ္။ bioscom(..., ..., ...) ဆိုတဲ့ Command ေလးကိုသံုးၿပီးေရးထားတာပါ။ ဒါေပမယ့္ Display ျပဖို႔အတြက္ေတာ့ LEDs ဒါမွမဟုတ္ LCD display လုိပါလိမ့္မယ္။
#include "bios.h"
#include "conio.h"
#include "dos.h"
#define COM1 0
#define DATA_READY 0x100
#define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00)
int main(void)
{
int in, out, status;
bioscom(0, SETTINGS, COM1); /*initialize the port*/
cprintf("Data sent to you: ");
while (1)
{
status = bioscom(3, 0, COM1); /*wait until get a data*/
if (status & DATA_READY)
if ((out = bioscom(2, 0, COM1) & 0x7F) != 0) /*input a data*/
putch(out);
if (kbhit())
{
if ((in = getch()) == 27) /* ASCII of Esc*/
break;
bioscom(1, in, COM1); /*output a data*/
}
}
return 0;
}
Download : bios.h
#include "bios.h"
programming အေၾကာင္း သိုးေလး သင္ဖူးတယ္သိလား။ အခုေတာ့ ဘာမွမသိေတာ့ဘူး။ ေလးႏွစ္ေလာက္ရွိၿပီေလ။ ဘာဆိုဘာမွကို မသိေတာ့တာ။ အခုထက္ပို ရွင္းရွင္းေလး ေရးေပးရင္ သိုးေလးလို လူၿပိန္း နားလည္တာေပါ့ရွင္
ReplyDeletevery nice blog for engineers. i am also engineer in motor design and analysis. especially inverter-fed frequency controlled induction motors. ur post are precious. i love to read it. please write abot PWM. i am just a pure EP so sometime i need time to study electronic devices. and please come and visit my blog. there also trying to write about designing an induction motor. later may be about analysis and heat calculation.
ReplyDeletehttp://www.bluephoenix4mm.blogspot.com