Picproje Elektronik Sitesi

DERLEYİCİLER => Hi-Tech => Konuyu başlatan: ahmet2004 - 18 Ekim 2008, 06:00:01

Başlık: Pic16F877 8255 port çoklama...
Gönderen: ahmet2004 - 18 Ekim 2008, 06:00:01

/* Hitech C v9.50PL2            */
/* Yazan tyilgin1 Yüzbaşı       */
/* Düzenleyen By Ahmet      */

#include <htc.h>
#define XTAL_FREQ 4

__CONFIG(UNPROTECT & WDTDIS & PWRTEN & XT);

#define i8255_RD RC0
#define i8255_WR RC1
#define i8255_a0 RC2
#define i8255_a1 RC3
#define i8255_Reset RC4
#define i8255_CS RC6


#include "delay.h"
#include "Devre.h"

void main(void) {

unsigned char sayac;

TRISA = 0b00000000;
TRISB = 0b00000000;
TRISC = 0b00000000;
TRISD = 0b00000000;
TRISE = 0b00000000;

OPTION=0b10000010;
INTCON=0b00000000;

ADCON1=7;

PORTA=0; PORTB=0; PORTC=0x40; PORTD=0;

DelayMs(250);

i8255_RD = 1;
i8255_WR = 0;
i8255_Reset = 0;
i8255_CS = 0;

PORTB    = 0b10000000;
i8255_a0 = 1;
i8255_a1 = 1;
i8255_CS = 0;
DelayMs(1);
i8255_CS = 1;

while(1)
{
i8255_CS = 0;
i8255_WR = 1;


for (sayac=0;sayac<2;sayac++)
{
DelayMs(250); DelayMs(250);
i8255_WR = 0;
i8255_a0 = 0;
i8255_a1 = 0;
if (sayac==0)
{
portCIK0();
}
else
{
portCIK1();
}
i8255_WR = 1;

i8255_WR = 0;
i8255_a0 = 1;
i8255_a1 = 0;
if (sayac==0)
{
portCIK0();
}
else
{
portCIK1();
}
i8255_WR = 1;

i8255_WR = 0;
i8255_a0 = 0;
i8255_a1 = 1;
if (sayac==0)
{
portCIK0();
}
else
{
portCIK1();
}
i8255_WR = 1;
}

}
}

void portCIK0()
{
 PORTB=0x55;
}

void portCIK1()
{
 PORTB=0xAA;
}
Başlık: Pic16F877 8255 port çoklama...
Gönderen: ahmet2004 - 18 Ekim 2008, 06:01:01
Devre Animasyonu:

(http://img90.imageshack.us/img90/4803/00000000sx1.gif)

Proteus ve hex kodları:

http://www.4shared.com/file/67370190/b686cabc/8255portCoklama_ahmet2004.html (http://www.4shared.com/file/67370190/b686cabc/8255portCoklama_ahmet2004.html)
Başlık: Ynt: Pic16F877 8255 port çoklama...
Gönderen: parametre - 29 Mart 2011, 17:05:41
kodlari baska siteye yukleme imkanı yokmudur oradan indiremiyoruz tşk ederiz
Başlık: Ynt: Pic16F877 8255 port çoklama...
Gönderen: Maxim - 29 Mart 2011, 17:16:20
iyi okuyun
orada zaten kod yok, hex var.
kod ilk mesajda ..