Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > re-compile -need helping to enlighten C programming

Reply
Thread Tools

re-compile -need helping to enlighten C programming

 
 
developer
Guest
Posts: n/a
 
      12-17-2004
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,0x040;
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,0x040;
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.


 
Reply With Quote
 
 
 
 
Martin Ambuhl
Guest
Posts: n/a
 
      12-17-2004
developer wrote:
> http://www.web7days.com/farm/tn/controller.jpg.html
>
> #include<dos.h>
> #include<process.h>
> #include<io.h>


Did you not pay attention the first time? Why do you think this
implementation-specific crap is on-topic now when it was off-topic before?

> #include<stdio.h>
> #define STROBE 0x01
> #define NOT_STB 0x00
>
> int void main()


WTF? Doesn't your compiler barf at that?
 
Reply With Quote
 
 
 
 
Raymond Martineau
Guest
Posts: n/a
 
      12-17-2004
On Fri, 17 Dec 2004 13:22:13 +0800, "developer" <(E-Mail Removed)> wrote:

>#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.)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bizarre vector insertion behavior - can someone please enlighten? ckfan.painter@gmail.com C++ 9 03-08-2007 02:26 AM
Bizarre vector insertion behavior - can someone please enlighten? ckfan.painter@gmail.com C++ 0 03-07-2007 07:45 PM
Please enlighten me about PyPy Ray Python 23 12-25-2005 07:02 PM
Can someone enlighten me why... Fuel NZ Computing 3 08-21-2004 10:29 AM
Someone enlighten me, please! Steve HTML 6 02-14-2004 02:25 AM



Advertisments