?
Solved

setting time calling BIOS

Posted on 2005-04-20
6
Medium Priority
?
264 Views
Last Modified: 2011-04-14
Hi, I'm using a very small computer called ADAM4500 from advantech and I need to update the system time. The OS is called rom dos and is similar to ms-dos.
 The solution from advantech is calling bios function 1Ah sub function 3 but I don't know how to set paramaters and call BIOS.
The c compiler I'm using is an old compiler from ms ver 6
Can anyone help me to set time ?
0
Comment
Question by:pboix
  • 3
4 Comments
 
LVL 16

Expert Comment

by:PaulCaswell
ID: 13831626
Try here:

http://members.tripod.com/~oldboard/assembly/int_1a-3.html

I'll post some actual code in a minute.

Paul
0
 
LVL 16

Accepted Solution

by:
PaulCaswell earned 252 total points
ID: 13831647
This is certainly available in C8. I'll check up about C6.

      union REGS regs;

      // Set time
      regs.h.ah = 0x03;
      // ch,cl,dh = hhmmss (BCD)
      regs.h.ch=12; // Set tiime to 12:34:56
      regs.h.cl=34;
      regs.h.dh=56;
      // dl is DST
      regs.h.dl=0;
      int86( 0x1a, &regs, &regs );

Try that. Let me know if it doesnt work and I'll have another look.

Paul
0
 
LVL 16

Expert Comment

by:PaulCaswell
ID: 13834487
>>I'll check up about C6.
Found it! It is in both <dos.h> and <bios.h>

Paul
0
 
LVL 4

Assisted Solution

by:furqanchandio
furqanchandio earned 248 total points
ID: 13933745
#include<stdio.h>
#include<conio.h>
#include<dos.h>

void main()
{
REGS regs;

 regs.h.ah = 0x03;
 regs.h.ch=1;
     regs.h.ch=6;
     regs.h.cl=56;
     regs.h.dh=3;
     regs.h.dl=0;
     int86( 0x1a, &regs, &regs );

// to see time
 regs.h.ah = 0x02;
 int86( 0x1a, &regs, &regs );

printf ("\n hours = %d",regs.h.ch);
printf("\n minutes = %d",regs.h.cl);
printf("\n  seconds = %d",regs.h.dh);

getch();
}//main
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question