View Full Version : TSOP1738-> AT90S2313 -> UART Interfacing problem

05-31-2005, 07:23 PM

I am trying to make a circuit to take the output of a TSOP1738 and send it to the computer via the UART of an AT90S2313 so that I can see whats coming out of a remote and use it for some later project. Ive attached an LED to the micro that turns off when the IR detector is triggered and its working fine, but the data doesnt seem to be reaching the computers hyperterminal window. Ive connected the Rx and the Tx pins to a MAX232 line driver. The hardware must be ok because it runs an example UART program to echo back characters in hyperterminal fine. I dont know if the problem is with the code the micro is running or if hyperterminal cant recognise the data format. Please help me out. The AVR Assembly source code is below.

.include "2313def.inc"

.def temp = R16 ; temporary variable
.def data = R17 ; to store data to be transmitted
.def copy = R0 ; to store original SREG during interupts

.org 0x0000
rjmp init

.org 0x0006
rjmp sendbyte ; ISR to transmit over UART when timer0 overflows

ldi temp, low(RAMEND)
out SPL, temp ; Stack Pointer initialiser

ldi temp, 0x00
out DDRD, temp ; set PORTD to input

ldi temp, 0xFF
out PORTB, temp ; turn off PORTB LEDs
out DDRB, temp ; set PORTB to output

ldi temp, 12
out UBRR, temp ; set up UART for 19200bps with 4Mhz crystal

ldi temp, 0b00011000
out UCR, temp ; set UART to Rx and Tx

ldi temp, 2
out TCCR0, temp ; set timer0 prescalar to 8
out TIMSK, temp ; enable interupts for timer0

sei ; enable interupts globally

rjmp main ; main loop

in copy, SREG ; back up SREG

sbi PORTB, 0 ; show current level of IR Receiver on LED
sbis PIND, 5
cbi PORTB, 0

ldi data, 48 ; ascii value for zero
sbis PIND, 5
inc data ; if IR Reciever is active change data to ascii(1)

out UDR, data ; transmit data on UART
out SREG, copy

06-01-2005, 09:40 PM
hmmm...do you have to use a micro?
when u can directly interface the TSOP1738 to the serial port..


I dont know if the problem is with the code the micro is running or if hyperterminal cant recognise the data forma

Depends which remote are you using to transmit IR signals.Each manufacturer has their own protocol....
You need an oscilloscope to read the incoming bitsor a learning program on ur micro[----to memorise the keys]

06-03-2005, 09:11 AM
Just connect the TSOP1738 as per the data sheet to the TTL side of the MAX232 ... and feed the RS232 output to the COM port .... that does it all ... I have done it ... one think u need to check though .. that is your remote giving 38Khz or 36 / 40 or something else

good luck !