DATA ACQUISITION CARD(DAC) using parallel port This tutorial is taken from the book
MY EXPERIENCE IN PARALLEL PORT INTERFACING.
you can download it free from the files
section(file:-parallelport(3 files) of
yahoo group-booksbybibinhttp://groups.yahoo.com/group/booksbybibin/
comments about this book on
www.booksbybibin.blogspot.comROBO DAC
A data acquisition Card is always need to get data in different form, analog or digital .
The data can be inputted or outputted or used as a independent counter / timer. But
in Robo DAC we are having 8 analog inputs, 8 digital inputs and 8 digital outpus. We
can also expand the number of digital outputs and digital inputs.
Here you can see that first flip flop is used for 8 digital outputs and second flip flop for
controlling the DAC like ADC signalling, used as select pins for the analog mux. In
DAC there is facility for extending 8 analog inputs or 32 digital inputs or 32 digital
outputs or 16 digital inputs and outputs. So first we clock the first flip flop to output a
digital data. Then we use control flip flop to select different channels of analog mux
and signalling ADC conversion. The output of ADC conversion is given to the input of
one 74244 buffer which is read by making C3 pin LOW.
#include"bparlib.c"
void Write_FlipFlop1(int a);
void Write_ControlFlipFlop(int a);
void Read_First244(void);
void Read_Amux(int b);
float Read_adc(int a);
void main()
{
int a,b;
printf("\nenter the value to be outputted in decimal(FF1)");
scanf("%d",&a);
Clear_ControlPort_bit(0);
Clear_ControlPort_bit(1);
Set_ControlPort_bit(2);
Set_ControlPort_bit(3);
// to disable enabling of 74244
Write_FlipFlop1(a);
Read_First244();
Write_ControlFlipFlop(0);
for(b=0;b<8;b++)
Read_Amux(b); //to read the value of the analog mux using ADC
getch();
}
void Write_FlipFlop1(int a)
{
/*writing to first flip flop*/
Clear_ControlPort_bit(0);
Write_DataPort(a);
Set_ControlPort_bit(0);
}
void Read_First244(void)
{
/*reading first 74ls244*/
Clear_ControlPort_bit(2);
printf("\nReading of first 74244 is %x",Read_DataPort());
Set_ControlPort_bit(2); //disabling 244
}
void Write_ControlFlipFlop(int a)
{
/*writing to first flip flop*/
Clear_ControlPort_bit(1);
Write_DataPort(a);
Set_ControlPort_bit(1);
}
void Read_Amux(int b)
{
int i;
float c;
Write_ControlFlipFlop(0);
i=b%8;
i=i*32;
c=Read_adc(i);
printf("\ninput voltage of %d channel is:%f",b,c);
}
float Read_adc(int a)
{
int d;
float b;
delay(1);
d=a&0x70;
Write_ControlFlipFlop(d);
delay(1);
d=a|_BV(4);
Write_ControlFlipFlop(d);
delay(1);
Clear_ControlPort_bit(3);
b=Read_DataPort();
b=b*5/255;
Set_ControlPort_bit(3);
return(b);
}
remember that in the program you are taking the value as decimal and you will get
output of the flipflop as hexadecimal
APPLICATIONS OF ROBO DACSUN TRACKER:
Sun Tracker is a mechanism which keep Solar Panels always perpendicular to Sun.
The maximum radiation is obtained when Solar panel is perpendicular to sunlight, so
maximum power. Everyday sun moves from East to West and a lateral shift of
23.5degree on both sides of normal(i.e, change with seasons like summer and
winter).See http://www.eaas.co.uk/news/seasons.html. So we need two axis
tracking. Sun sets at west and our system shut downs automatically when
a particular intensity of light is reached (i.e in night and in rain time). When it set at
west and during morning it had to come back to east i.e in morning it had to shift 180
degree.. Sun Tracker should work perfectly with Sunlight and in darkroom in
presence of sodium vapor lamp.
RA0,RA1,RA2,RA3 is the output of the flip flop(74374).
You can connect the output of 74374 to the enable of L293D. When the LDR resistance
is too high , the enable of L293D should be disabled because there is no need of
moving sun tracker because the availability of light is less. You can decide it in your
program. There should be an option for suntracker to align automatically to the
direction of maximum sunlight when it is shifted from one position to other. You can
provide a suitable algoritham in your program. You can disable the L293D for
sometime and thus power consumption is somewhat reduced(see in case of big
motors H-bridge consuming good amount of power) .
LINE FOLLOWER ROBOT
Suppose you want to make a line follower robot with 4 sensors on each side and 16
speed reductions then you can make it using ROBO DAC. If you use varying supply
voltage to drive the motor then you can use this circuit. Make a proper algoritham for
driving the motor.
Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.