yes...more inportb.

This is a discussion on yes...more inportb. within the C Programming forums, part of the General Programming Boards category; OK....good news you ask? Yes, all of my circuits are operating extremely well and dandy with the new cable I ...

  1. #1
    Registered User SavesTheDay's Avatar
    Join Date
    Jan 2002
    Posts
    77

    yes...more inportb.

    OK....good news you ask? Yes, all of my circuits are operating extremely well and dandy with the new cable I picked up....new question...I'm trying to write a PC to PC chat like program using the outportb commands....I have the sending side of the program almost perfected, and know it works fine...the question is......how do I do the in taking of the data.

    Structured as Follows:

    <User Types String>
    - Converts String to Binary
    - Chops Binary (the 8 bits) into Two 2 Bit Sections
    - Outports Each Section, 1 by 1.
    - Moves to Nex Letter in String which User Entered


    The receiving program is supposed to receive each one of these chunks of 4 bits, then re-assemble then into 8 bits, then print the corresponding character. I have no problem reassembling the binary code...the question I have is....if I do

    Code:
    send1[5]="0110";
    
    outportb(0x378,0bsend1);
    Where EXACTY does my send1 go? I don't get how to send the data to the corresponding 4 data pins on the receiving software side. I am using 4 of the IN pins, but I would imagine my string doesn't get nicely automatically sent in the IN pins, so how do I direct it? Also...what kinde of code should I use to wait for input? If I just do a constant loop of reading the port, will it just pick up the data when it comes, then just keep looping otherwise...such as...could I do:

    Code:
    char BinaryFull[9];  // 2 Sections Put Together, the Characters //
    char output[11];     // The Word Sent //
    int x=0,y=0;
    
    while (output[x]!='\0')
    {
    		
    	if ((inportb(0x379)=1) && (y==0))
    	{
          restoreBits(something);
    	  y++;
    	}
    
    	if ((inportb(0x379)=1) && (y==1))
    	{
    	  restoreBits(something);
    	  y++;
    	}
    
    	printf("%c",BinaryFull);
    	x++;
    }
    If that made any sense at all....can you check to see if the inportb is receiving anything, like that, then run the code, if it's receiving again, it run the second part, those bits are finally turned into BinaryFull in the restoreBits() function.......then the character is displayed..........mmmm....i'm going to need to pass something to the restoreBits function too I think.....the main point is determing how to read what's coming through, using the inportb commands, if I use outportb to send to certain data out pins.

    If anyone can help, it'd be much appreciate. you guys are great.

  2. #2
    Registered User SavesTheDay's Avatar
    Join Date
    Jan 2002
    Posts
    77
    Super Salem,

    Is this exactly what I would use the PC-PC File Sharing Cable for? If I understood your picture right, Transfer crosses over to Receive....and that would make more sense...I'm still curious to the questions in my post though....Thanks .

  3. #3
    Registered User SavesTheDay's Avatar
    Join Date
    Jan 2002
    Posts
    77
    =| Anyone?

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,442
    > Is this exactly what I would use the PC-PC File Sharing Cable for?
    Yes, for transfers between two PCs via the parallel port

    >- Converts String to Binary
    There's nothing to do here
    You read the chars into an array of char, so they're already stored in handy 8 bit chunks

    >- Chops Binary (the 8 bits) into Two 2 Bit Sections
    Code:
    ms_nibble = ( arr[i] >> 4 ) &0x0f;
    ls_nibble = ( arr[i] ) & 0x0f;
    >- Outports Each Section, 1 by 1.
    outportb(0x378,ms_nibble);
    outportb(0x378,ls_nibble);

    Where 'i' is the for loop control variable, running from 0 to strlen(arr)-1

  5. #5
    Registered User SavesTheDay's Avatar
    Join Date
    Jan 2002
    Posts
    77
    Someone must know the answer to this........if I send

    outportb(0x378,0x0F);

    Sending 1111 through pins 2,3,4,& 5, and I'm using a PC-to-PC File Transfer cable, where do the 1's go?? How can you make inportb() read those 4 data pins? I need to know how inportb works....how the inport pins work.......which numbers they are...Anyone?!!?!?!?!?!

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,442

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. inportb() again, sorry
    By pittuck in forum C++ Programming
    Replies: 3
    Last Post: 11-28-2003, 01:16 PM
  2. Need help on Serial Port programming!!!
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 06-04-2002, 05:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21