Berawal dari program yang sudah saya buat untuk mencatat data temperature sensor di dos dengan clipper dan bisa berjalan dengan baik. Saya ingin mencoba apakah di linux ( saya pake Debian ) juga bisa berjalan dengan baik dengan dosemu. Step by step saya mulai prosesnya :
pertama, install dosemu (diasumsikan source list sudah diset ):
# apt-get install dosemu-freedos
setelah dosemu terinstallasi dengan baik, selanjutnya setting konfigurasi dosemu untuk menyesuaikan dengan enviroment program. Karena program saya menggunakan port com 1 sebagai komunikasi dengan alat sensornya.
Read the rest of this entry »
No Comments »
FUNCTION SayRupiah(par)
LOCAL nTot,nRp,cRp,cRupiah
ntot = 0
cRupiah=”"
lExit = .F.
nTot = par
cTotal= ALLTRIM(STR(nTot))
FOR i=1 TO LEN(cTotal)
nRp= (LEN(SUBSTR(cTotal,i)))
cRp= SUBSTR(cTotal,i,1)
DO CASE
CASE nRp > 0
GetDetailRupiah(nRp,cRp,@cRupiah)
CASE nRp < 0
nRp= nRp + 3
GetDetailRupiah(nRp,cRp,@cRupiah)
CASE nRp = 0
cRupiah = cRupiah
ENDCASE
NEXT
IF nTot - INT(nTot) > 0
cRupiah = cRupiah
ENDIF
RETURN cRupiah + “RUPIAH
Read the rest of this entry »
No Comments »
This sample code for get data temperature in clipper :
FUNCTION GetTemperature()
LOCAL buff_size,com_ok,init_ok,c_input,l_send, t01,a01,b01,VAL_01
a01 := 0
b01 := 0
t01 := 0
buff_size := 4000 && 4000 byte buffer
com_ok := COM_OPEN(1,buff_size) && COM1: open
DO WHILE .T. .and. INKEY()<> K_ESC
IF .NOT. com_ok
? “It was not possible to open interface.”
ELSE
init_ok = COM_INIT(1, 9600, “N”, 8, 1)
IF .NOT. init_ok
alert(”It was not possible to initialize the interface”)
ELSE
** SENSOR 01
l_send = COM_SEND(1,”:01R;”)
INKEY(0.5)
c_input = COM_READ(1,COM_COUNT(1)) && Read in 10
IF LEN(ALLTRIM(c_input)) <= 0
t01 = 0
ENDIF
Read the rest of this entry »
No Comments »