Pic16F877 8255 port çoklama...

Başlatan ahmet2004, 18 Ekim 2008, 06:00:01

ahmet2004

/* 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;
}

ahmet2004


parametre

kodlari baska siteye yukleme imkanı yokmudur oradan indiremiyoruz tşk ederiz

Maxim

iyi okuyun
orada zaten kod yok, hex var.
kod ilk mesajda ..