re-compile -need helping to enlighten C programming

Discussion in 'C Programming' started by developer, Dec 17, 2004.

  1. developer

    developer Guest

    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.
    developer, Dec 17, 2004
    #1
    1. Advertising

  2. 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?
    Martin Ambuhl, Dec 17, 2004
    #2
    1. Advertising

  3. On Fri, 17 Dec 2004 13:22:13 +0800, "developer" <> 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.)
    Raymond Martineau, Dec 17, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve
    Replies:
    6
    Views:
    411
    Andrew Glasgow
    Feb 14, 2004
  2. Ray
    Replies:
    23
    Views:
    730
    Christian Tismer
    Dec 25, 2005
  3. Replies:
    0
    Views:
    503
  4. Replies:
    9
    Views:
    402
    Alan Johnson
    Mar 8, 2007
  5. kevin

    Please enlighten me:-0 HELP Please

    kevin, Sep 1, 2003, in forum: Javascript
    Replies:
    2
    Views:
    103
    kevin
    Sep 4, 2003
Loading...

Share This Page