Kulwinder Atwal wrote:
>
> I do not know how much extra work your software does, or the speed of
> your CPU. You can also set the port for generating an interrupt on
> every high level of your 109 kHZ signal by attaching your 109 kHZ signal
> to the STB, INTE, and IBF pins. By doing this you will be simulating a
> write to the port from an external device.
Basically, it is my intention to integrate this piece of A/D conversion
into a GTK+ GUI that i am writing for my thesis. There is more info on
http://hello.to/MC303 -> follow the link to 'my thesis'.
Up until now, i have only written this test-program to see if my
circuitry is fine. The program works for DOS, so it means that
everything is ok... i only have problems if i run this program in
linux. If i get this thing to work just fine in Linux, then i want to
integrate the code as a callback function in a GTK+ GUI. Say for
example if the user presses a button, that the function that does the
A/D conversion is being executed.
I have attached the complete source code of the test program. It is
code that drives a TL500C Dual Slope A/D convertor through the parallel
port.
I have also attached a file that explains on which computer I try to run
this. I am running Debian GNU Linux with kernel 2.2.14.
So, I would like to know if Real Time Linux is the easiest solution for
my problem. I don't want to make things too complicated anymore, i just
want this thing going in linux so i can integrate it in my GTK+ GUI.
Any further suggestions on the best/shortes/easiest solutions are
welcome.
Greetzzz
MC303
--
Bart Vandewoestyne http://hello.to/MC303
Hugo Verrieststraat 48 [EMAIL PROTECTED]
8550 ZWEVEGEM ICQ# 21275340
BELGIUM - EUROPE nick: MC303
Phone: +32(0)56/75.48.11
-------------------------------------------------------------
"Der Horizont vieler Menschen ist ein Kreis mit Radius Null -- und das
nennen sie ihren Standpunkt."
NIC:
Compex RL100-ATX
CD-ROM:
HITACHI CDR-8435, ATAPI CDROM drive
Hard Disk:
Seagate ?
Graphics Card:
S3 Inc. ViRGE (rev 6)
Sound Card:
Soundblaster AWE64 Gold
Monitor:
NOKIA Multigraph 449Xi
15"
Max Resolution: 1024x768
H Freq: 30-65 kHz
V Freq: 48-120 Hz
/* TL500C */
/* Sturen en lezen van de TL500C Dual Slope Digitaal-Analoog konvertor */
#include <sys/io.h>
#include <stdio.h>
#define BASEPORT 0x378
#define TRUE 1
void tel(int tijd);
main()
{
int portstatus = 0;
int klok, pol, waarde;
if (ioperm(BASEPORT, 3, 1)) { perror("ioperm"); exit(1);}
while (TRUE) {
waarde = 0;
/* AUTO ZERO faze: A (PIN 9) en B (PIN 8) laag */
portstatus = portstatus & ~(0x80) & ~(0x40);
outb(portstatus, BASEPORT);
tel(10000);
/* INTEGRATE INPUT faze: A en B hoog */
portstatus = portstatus | 0x80 | 0x40;
outb(portstatus, BASEPORT);
tel(10000);
/* INTEGRATE REFERENCE faze */
/* testen van polariteit: komparator op pin 10 */
pol = inb(BASEPORT+1) & 0x40;
if (pol)
{
/* positieve ingangsspanning -> A hoog en B laag */
portstatus = portstatus | 0x80 & ~(0x40);
outb(portstatus, BASEPORT);
}
else
{
/* negatieve ingangsspanning -> A laag en B hoog */
portstatus = portstatus & ~(0x80) | 0x40;
outb(portstatus, BASEPORT);
}
/* nog testen op polariteit van ingangssignaal en evt. voorwaarde */
/* van comparator aanpassen */
while ((waarde < 20000) && !(inb(BASEPORT+1) & 0x40)) {
do
{
klok = inb(BASEPORT+1) & 0x80;
}
while (klok == 0);
waarde++;
do
{
klok = inb(BASEPORT+1) & 0x80;
}
while (klok == 0x80);
}
if (waarde == 20000) printf("\nOverkapaciteit");
else
printf("\nGemeten waarde = %d", waarde);
}
}
void tel(int tijd)
{
int waarde = 0;
int klok;
while (waarde < tijd) {
do
{
klok = inb(BASEPORT+1) & 0x80;
}
while (klok == 0);
do
{
klok = inb(BASEPORT+1) & 0x80;
}
while (klok == 0x80);
waarde++;
}
}