re-compile -need helping to enlighten C programming

D

developer

http://www.web7days.com/farm/tn/controller.jpg.html

#include<dos.h>
#include<process.h>
#include<io.h>
#include<stdio.h>
#define STROBE 0x01
#define NOT_STB 0x00

int void main()
{
char i,j;
unsigned int CTRL_PORT,STAR_PORT;
unsigned int far DATA_PORT;
DATA_PORT=MK_FP(0x0000,0x0408);
STAR_PORT=DATA_PORT+1;
CTRL_PORT=STAR_PORT+1;
outport(CTRL_PORT,0x00);
while(1)
{
outport(DATA_PORT,0x00);
delay(2000);
outport(DATA_PORT,0xff);
delay(2000);
outport(DATA_PORT,0x00);
delay(2000);
j=0x80;
for(i=0;i<8;i++)
{
outport(DATA_PORT,j);
j=j>>1;
delay(2000);
}
}
}


the original source

include<dos.h>
#include<process.h>
#include<io.h>
#include<stdio.h>
#define STROBE 0x01
#define NOT_STB 0x00

void main()
{
char i,j;
unsigned int CTRL_PORT,STAR_PORT;
unsigned int far *DATA_PORT;
DATA_PORT=MK_FP(0x0000,0x0408);
STAR_PORT=*DATA_PORT+1;
CTRL_PORT=STAR_PORT+1;
outport(CTRL_PORT,0x00);
while(1)
{
outport(*DATA_PORT,0x00);
delay(2000);
outport(*DATA_PORT,0xff);
delay(2000);
outport(*DATA_PORT,0x00);
delay(2000);
j=0x80;
for(i=0;i<8;i++)
{
outport(*DATA_PORT,j);
j=j>>1;
delay(2000);
}
}

from the pict the top three is working with my ibm note book 90mhz thinkpad
520, I used lap-link to copy the test.exe into the ibm notebook. the c8, c7
and c6 are working, I have tried 6 other SN74L373N chips. I am trying to run
a small toy motor which stimulated as a pump for irrigation purpose.


I need good man to help me to recompile and under turbo C and teach me to
modify the above program and compile this under this source under bloodshed
C. I will transfer the executeable to ibm note book to see the stimulation
is working or not working.

C0 5 mins
C1 10 mins
C3 30 mins
C4 45 mins
C5 50 mins
C6 60 mins
C7 2 min


this is main changing the "delay" which is recognise in the bloodshed and
the relavant variables.

enlighten me please.

TIA.
 
R

Raymond Martineau

#include<dos.h>
#include<process.h>
#include<io.h>

These include libraries are non-standard. Can't help you there.
#include<stdio.h>
#define STROBE 0x01
#define NOT_STB 0x00

int void main()

This is not valid. The function prototype *must* be int main().
{
char i,j;
unsigned int CTRL_PORT,STAR_PORT;
unsigned int far DATA_PORT;

As a style issue, all-capital identifiers should be used either for macros,
or for constant variables (depending on the situation.) Using them for
non-constants will cause confustion.

The rest of the source code relates to a third-party library that is not
part of standard C. This is off-topic in this newsgroup, since not many
people understand how to do low-level interfaces with hardware (let alone
know what is going on in an uncommented program.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top