News:

SMF for DIYStompboxes.com!

Main Menu

Issue regarding MT8816

Started by djc, January 17, 2014, 01:45:48 AM

Previous topic - Next topic

djc

Hi,
I am new to this forum. I don't know what it is for.However I have an issue with operation of MT8816 cross point switch IC. Searched a lot on the internet and found this forum where lots of guys have worked on it. I am working on a small telephone exchange. I am facing an issue that how to run MT8816. Little hardware description is as follows. It's CS pin is connected to power supply, RESET pin is connected to ground. AY0,AY1,AY2 are also connected to ground. AX0,AX1,AX2,AX3 are connected to controller's PC1,PC4,PC3 and PC2 pins respectively. Data pin of 8816 is connected to PB6 of controller and 'STROBE' pin of 8816 is connected to PC0 pin of controller. I tried several combination means
1)selecting address bits first then giving data and then strobe signal.
2)STROBE high, then address selection then data and then strobe ow. But still not working. Controller is ATMEGA8 .Can any body please properly guide me.
Here is my code with Code Vision AVR compiler and ATMEGA8 controller.


/*****************************************************
This program was produced by the
CodeWizardAVR V2.03.4 Standard
Automatic Program Generator
© Copyright 1998-2008 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com

Project :
Version :
Date    : 10/20/2013
Author  :
Company :
Comments:


Chip type           : ATmega8
Program type        : Application
Clock frequency     : 8.000000 MHz
Memory model        : Small
External RAM size   : 0
Data Stack size     : 256
*****************************************************/

#include <mega8.h>
#include <delay.h>

#define AX0 PORTC.1
#define AX1 PORTC.4
#define AX2 PORTC.3
#define AX3 PORTC.2
#define data PORTB.6
#define strobe PORTC.0
#define test PORTC.5

// Timer 0 overflow interrupt service routine
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
// Place your code here

}

// Declare your global variables here
void strobe_clk()
{
        strobe = 1;
        //#asm("nop")
        delay_ms(500);
        strobe = 0;
        delay_ms(1000);
}

void main(void)
{


// Declare your local variables here

// Input/Output Ports initialization
// Port B initialization
// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=In
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=T
PORTB=0x00;
DDRB=0xFE;

// Port C initialization
// Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTC=0x00;
DDRC=0xfF;

// Port D initialization
// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTD=0x00;
DDRD=0xFF;

// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: 8000.000 kHz
TCCR0=0x00;
TCNT0=0x00;

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;

// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;

// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
MCUCR=0x00;

// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x01;

// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;

// Global enable interrupts
//#asm("sei")
       
        AX0 = 0;
        AX1 = 0;
        AX2 = 0;
        AX3 = 0;
        data = 0;
        delay_ms(1);
        strobe = 1;
          #asm("nop")           
          delay_ms(1);
          strobe = 0;
          delay_ms(1);
         
       
        AX0 = 1;
        AX1 = 0;
        AX2 = 0;
        AX3 = 0;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 0;
        AX1 = 1;
        AX2 = 0;
        AX3 = 0;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 1;
        AX1 = 1;
        AX2 = 0;
        AX3 = 0;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 0;
        AX1 = 0;
        AX2 = 1;
        AX3 = 0;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 1;
        AX1 = 0;
        AX2 = 1;
        AX3 = 0;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 0;
        AX1 = 1;
        AX2 = 1;
        AX3 = 0;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 1;
        AX1 = 1;
        AX2 = 1;
        AX3 = 0;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 0;
        AX1 = 0;
        AX2 = 0;
        AX3 = 1;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 1;
        AX1 = 0;
        AX2 = 0;
        AX3 = 1;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 0;
        AX1 = 1;
        AX2 = 0;
        AX3 = 1;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 1;
        AX1 = 1;
        AX2 = 0;
        AX3 = 1;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 0;
        AX1 = 0;
        AX2 = 1;
        AX3 = 1;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 1;
        AX1 = 0;
        AX2 = 1;
        AX3 = 1;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 0;
        AX1 = 1;
        AX2 = 1;
        AX3 = 1;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
        AX0 = 1;
        AX1 = 1;
        AX2 = 1;
        AX3 = 1;
        data = 0;
        strobe = 1;
          #asm("nop")           
          delay_ms(500);
          strobe = 0;
       
       
         


while (1)
       {         
        AX0 = 0;
        AX1 = 0;
        AX2 = 0;
        AX3 = 0;
       data = 0; 
       delay_ms(2);   
       strobe = 1;
       delay_ms(1);
       strobe = 0;
       delay_ms(2);         
       delay_ms(1000);
       
        AX0 = 0;
        AX1 = 0;
        AX2 = 0;
        AX3 = 0;
       data = 0; 
       delay_ms(2);   
       strobe = 1;
       delay_ms(1);
       strobe = 0;
       delay_ms(2);         
       delay_ms(1000);                     
       }
}