Discussion in "General help Guidance and Discussion" started by    milky    Nov 13, 2007.
Tue Nov 13 2007, 05:42 am
#1
i manage to communicate between hc11 with 6821 but ii'm facing problem in connecting 68hc11 with 8255.

Anyone can help?thanks.
Tue Nov 13 2007, 11:58 am
#2
can i see the circuit diagram? and code to know what you are doing..
Wed Nov 14 2007, 05:23 am
#3
the below is mine code.I just want to interface the 68HC11 with 8255.I connect A0-A15 to some TTLs to get the address i want.And the /wr line from 68HC11 is connect to AND and NAND TTL, and the other pin of the 2input AND and NAND is connected to Vcc.And the output is connected to /wr and /rd of 8255.

I manage to interface 68HC11 with 6821.But not for 8255. :mad

*USING 8255
*USING PORTA.0, A.1, A.2 CONNECT TO 3 LEDS

PORTA EQU $1800
PORTB EQU $1801
PORTC EQU $1802
CR EQU $1803

ORG $0200

INIT_PPI:
LDAA #$80 ;SET ALL AS O/P
STAA CR

START:
LDAA #$FF
STAA PORTA
JSR DELAY

LDAA #$00
STAA PORTA
JSR DELAY

BRA START
*---------------------------------------
DELAY
LDX #$FFFF
DELAY_LOOP
DEX
BNE DELAY_LOOP
RTS
Wed Nov 14 2007, 12:41 pm
#4
you cannot directly move data to ports of 8255... first you need to configure the control register first, after that you can use all three ports of 8255.
Lets say your 8255 has base address of 2000H. So control register has address of 2000H, PORTA has address of 2001H, PORTB 2002H and PORTC 2003H.
You must go through the datasheet. Also moving data to 8255 is just like moving data to external RAM, keep this in mind can you try coding one more time? there is one example i made for 8255 interfacing.. Interfacing 8255 with 8051
hope this might help you a little..
Thu Nov 15 2007, 02:43 am
#5
ajay, i already configure the control register.which is shown in line 7 and 8. i load $80 into CR which stand for control register.
Thu Nov 15 2007, 12:37 pm
#6
oops i did not see the code clearly..
well the code looks fine to me.. you are first sending FF and then 00 to PORTA... everything looks fine to me.. you have configured as normal port operation of 8255.. and there is nothing special you have done in the code... so it has to work..
can i see the circuit diagram? all i can say is check the addresses..
Mon Dec 10 2007, 08:57 pm
#7
Hi

Yep when in doubt RTBM (read the bloody manual) in this case the data sheet for the 8255 and TTL logic chips.



I have had some experience in 3 subjects for my course using the 8255 interfaced to an 80x86 box. And also building 8-bit IO circuit for ISA bus using TTLs only - no 8255.

The 8255 can be configured in a number of combinations. The most common is Ports A,B,C each for 8-bit I/O. Make sure you have the mode configured, and that each port is configured as input, output, or combination (depending on the mode).

Make sure you have the correct base address set, and that your offsets are correct for your ports.

Say for ports A and B I/O:
Port_A = BasePort;
Port_B = BasePort + 1;
Control = BasePort + 3;



Is it mandatory that you use assembly? If not, do your self a favour and use C. Also, depending on your C compiler, you should be able to inspect the list file which pretty much has most of your Assembly code done for you.

Here is some C++ code for 80x86 from one of my subjects:

/*                                   io8255.cpp           s2/04 pf
  This program demonstrates I/O on the 8255 card. The type of IO used
  is the simplest type using non strobed input
  In this mode the 8255 card provides 3x8 bit IO ports

     PORT A    sockets 0 - 7      located at PORT 432
     PORT B       "    8 - 15               "      "  PORT 433
     PORT C       "    16 - 23             "      " PORT 434

  PORT A and PORT B can be either output or input
  PORT C is nibble programable as either output or input

  PORT 435 is the control port and is used as follows

       bit 0 - PORT C lower nibble   1 - input
                                     0 - output
       bit 1 - PORT B  1 - input
                       0 - output
       bit 2 - '0' always for this mode of operation
       bit 3 - PORT C upper nibble   1 - input
                                     0 - output
       bit 4 - PORT A  1 - input
                       0 - output
       bit 5 - '0' always for this mode of operation

       bit 6 - '0'   "     "    "    "  "      "
       bit 7 - '1' always

 eg. To set PORT A for input, PORT B for output and both nibbles of PORT C
     to output. The C command would be

		 outportb(435,144);       ie 10010000

 The outportb and inportb() functions are DOS functions so you must set up your
 program to compile to a DOS executable - use the Target Expert , see DosTarget
 notes if you've forgotten how (Alternatively use a DOS project with the single
 file io8255.cpp). Compile your program on your PC.
 Then run the executable on the PC with the hardware connected to it.

 This program sets up ports A and B for input and port C for output.
 It inputs from A and B and outputs to C
*/


  #include <iostream.h>

  #include <conio.h>

  #include <dos.h>
   /* must be included if we use inportb() or outportb() */

  void main()
    {
     int outc,ina,inb;

     clrscr();

	  outportb(435,146); /* ie 10010010  sets port A and B input port C output */

	  ina=inportb(432);    /* read a byte in from port A */
	  /* There is also a macro called inp which could be used  ina=inp(432) ; */
	  cout << " Number on port A is " << ina << endl ;

	  inb=inportb(433);    /* read port B */
	  cout << " Number on port B is " << inb << endl ;
	  
     cout << "What number do you want to output to port C ? " ;
	  cin >
>
 outc ;
     outportb(434,outc);  /* send 'outc' to port C */

     cout << "Hit <enter>
 to end";
     getch() ;
    }




Or could be hardware - double check every wire and connection. For my last project building an ISA bus interfacing circuit, there were scores of connections - it's very easy to have one wire conected to the wrong pin.

A schematic would be helpful.

If you can interface your circuit to serial port you can see output on PC monitor using a terminal emulator- that makes life a lot easier. Or if you can emulate the circuit using your IDE.





[ Edited Mon Dec 10 2007, 09:02 pm ]
Tue Dec 11 2007, 01:33 am
#8
DTS can you post a schematic? will be even better
Fri Dec 14 2007, 01:45 am
#9
circuit?

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Williamjaf
Tue Apr 16 2024, 12:25 pm
best_yyPa
Tue Apr 16 2024, 09:42 am
ErnestoExpop
Tue Apr 16 2024, 02:57 am
Jamesclepe
Mon Apr 15 2024, 11:10 am
Aliciaelora
Mon Apr 15 2024, 07:59 am
btaletvpcu
Mon Apr 15 2024, 04:36 am
UbvpwcTib
Mon Apr 15 2024, 03:13 am
AmyJow
Sun Apr 14 2024, 11:54 pm