how to configure hardware to connect the Keyboard

Started by tzif69 November 11, 2003
Hi
I managed to perform a small program that will be able to verify
which key has beeb pressed on the AT/PC keyboard.
I managed to do that using the UART interrupt using the 8515 and
STK500.

The ASCII code is beeing displayed on PORTB leds and i manage to see
that using the CODEVISION terminal.
It works fine!
BUT..........
Now i need to connect the Key board to the 8515 to work as a stand
alone.
Where can i find any information on the way to connect the keyboard .
Can i connect it to the RX/TX pins without any other harware (like
the MAX232)?

Do i need to change my code in order to work with an EXT interrupt or
can i leave it like that working with the UART interrupt

Please advise

Thank you


Hi guys
Well i dont really know what to do.
I am seeing the correct pulses that comes from the keyboard and i
see that there is a good signal.
I configured the INT1 to work with all the availabke configuration
and connected the kewboard to PD3 which is the INT1 pin.
But altough i see that the clock (which is connected to the INT1)
goes down as soon a key beeing pressed....i still getting trouble to
make a "clear" entrance to the EXT routin.
I have attached the code that i wrote just to see that as soon as
the interrupt accurds (i am talking about the ext intterrupt )
I even tried to add the CLI command follow by a delay in order to
avid more interrups after the first fall of the clock ....but uit
still give me the creaps.

please go through the code and tell me why it doesnt wrk

Thanks
/*********************************************
This program was produced by the
CodeWizardAVR V1.23.8d Light
Chip type : AT90S8515
Clock frequency : 3.686400 MHz
Memory model : Small
External SRAM size : 0
Data Stack size : 128
*********************************************/

#include <90s8515.h>

// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x15
#endasm
#include <lcd.h>
#include <delay.h>

// External Interrupt 1 service routine
interrupt [EXT_INT1] void ext_int1_isr(void)
{
// Place your code here
#asm ("cli")
PORTB.3=!PORTB.3;
delay_ms(100);
#asm ("sei")
}

// Timer 1 overflow interrupt service routine
interrupt [TIM1_OVF] void timer1_ovf_isr(void)
{
// Place your code here
PORTB.1=!PORTB.1;
}

// Declare your global variables here

void main(void)
{
// Declare your local variables here

PORTA=0x00;
DDRA=0x00;

PORTB=0x00;
DDRB=0xFF;

PORTC=0x00;
DDRC=0x00;

PORTD=0x00;
DDRD=0x00;

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

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 3.600 kHz
// Mode: Normal topFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
TCCR1A=0x00;
TCCR1B=0x05;
TCNT1H=0x00;
TCNT1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;

// External Interrupt(s) initialization
// INT0: Off
// INT1: On
// INT1 Mode: Falling Edge
GIMSK=0x80;
MCUCR=0x08;
GIFR=0x80;

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

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

// LCD module initialization
lcd_init(16); // Global enable interrupts
#asm("sei")

while (1)
{
// Place your code here
PORTB.7=0x1;
delay_ms(100);
PORTB.7=0;
delay_ms(100);

};
}
--- In avrclub@avrc..., "tzif69" <menahem@r...> wrote:
> Hi
> I managed to perform a small program that will be able to verify
> which key has beeb pressed on the AT/PC keyboard.
> I managed to do that using the UART interrupt using the 8515 and
> STK500.
>
> The ASCII code is beeing displayed on PORTB leds and i manage to
see
> that using the CODEVISION terminal.
> It works fine!
> BUT..........
> Now i need to connect the Key board to the 8515 to work as a stand
> alone.
> Where can i find any information on the way to connect the
keyboard .
> Can i connect it to the RX/TX pins without any other harware (like
> the MAX232)?
>
> Do i need to change my code in order to work with an EXT interrupt
or
> can i leave it like that working with the UART interrupt
>
> Please advise
>
> Thank you