Tutorial - Source code for interfacing TSOP1738 RC5 with 8051 Microcontroller
Posted on : Monday, February 21, 2011
Practical Course For ATMEL Microcontrollers - Upgraded
TSOP1738 RC5 Interfacing with 8051 Microcontroller
Product Tutorial by
Tech-Support Team @ www.EmbeddedMarket.com
© Copyright Article
The TSOP1738 is Infrared receiver.
RC5 is the IR transmission protocol developed by Philips. This was used for remots of TV & other equipments.
The PCAM+ kit is equipped with on board TSOP1738. The code below is used to decode the RC5 signal transmitted by the TV remote.
TV Remote is included with the PCAM+ product.
To complete the assignment you will need:
1. Product - PCAM+ (Practical Course For ATMEL Microcontrollers - Upgraded)
2. HandyProg-USB Programmer for 89S52 (Included with the PCAM+ kit)
3. RC5 TV Remote (Included with the Kit)
4. Single pin female to female connectors - 1 + 8
Port Pin P3.3 is connected to the output pin of TSOP1738, which is marked as IR38 on the PCAM+ board.
Connect 8 LEDs to Port P2 to see the decoded output.
8 LEDs will show binary value of the Switch pressed on TV remote.
IMP: Use remote which is supplied with the kit. Other remotes from market will not work.
Below is the source code written in 8051IDE:
VAR1 equ 07h ;Variable for delay
VAR2 equ 08h ;Variable for delay
TEMP equ 10H ;Temp variable
COUNT equ 11H ;Count variable
ADDR equ 12H ;Device address received from RC5
CMD equ 13H ;Command value received from RC5
FLIP bit 00H ;Flip bit
TOG bit 01H ;Temp bit for flip
IR equ P3.3 ;IR Receiver connected to this pin
MOV SP,#60H ;Stack pointer initialization
CLR TOG ;Clear temp bit
JB IR,$ ;Wait for first bit
MOV VAR1,#229 ;3.024mS delay
MOV C,IR ;Read Flip bit
MOV COUNT,#5 ;Count for address
MOV ADDR,A ;Save the address
MOV COUNT,#6 ;Count for Command
MOV TEMP,CMD ;Save the old command
MOV CMD,a ;Save the new command
MOV A,ADDR ;Cheack for valid address
CJNE A,CMD,VALID ;Check for valid command
mov VAR1,#128 ;1.728mS delay for each bit
Save this code, assemble it and flash it to the PCAM+ kit with 89S52 using HandyProgUSB Programmer.
Make connection as described above. You should see the Binary value for each switch press of TV remote.
EmbeddedMarket.com has delivered products to various cities in India including , bhopal, chennai, kharagpur, pune, Abu road, Agartala, Agra, Ahemadabad, Ahmedabad, Ahmedabad-380058, Ahmednagar, Aizawl, Ajmer, Akola, Alappuzha, Alapuzha, Alibag, Aligarh, Allahabad, Alleppey, Alto-dabolim, Aluva, Alwar, Ambala, Ambernath, Ambikapur, Amravati, Amreli, Amritsar, Anand, Anantapur, Andheri, Andheri east, Angamaly, Angul, Ankleshwar, Ankleswar, Aruppukottai, Asansol, Auranagabad, Aurangabad, Aurangabad. , Austin, Baddi, Bagalkot, Bagdogra, Balngalore, Banagalore, Banaglore, Bandel, Bangalore, Banglore, Baramati, Baroda, Barshi, Bathinda, Belgaum, Bellary, Bengaluru, Benguluru, Berhampur, Bhadravati, Bhandara, Bharatpur, Bharuch, Bhavnagar, Bhavnagar-364 001, Bhilai, Bhilai, distt - durg, Bhilwara, Bhimavaram, Bhiwadi, Bhiwandi, Bhiwani, Bhopal, Bhosari, pune, Bhubaneswar, Bhubaneswar, orissa, Bhubaneswer, Bhubhaneswar, Bhuj, Bilaspur, Boisar, Bolpur, Bombay, Bongaon, Borsad, Bulandshahr, Burdwan, Burhanpur, Calicut, Cannanore, Carson city, Chakan,pune , Champa , Chanchal, Chandigarh, Chas, Chengalpattu, Chennai, Chennai, india, Chennau, Chidambaram, Chikmaglur, Chinchwad, Chittoor, Cochin, Coimbatore, Coimbatore ,, Coos bay, Coppet, Csir road, taramani, chennai, Csm nagar, Cuddalore, Cuddalore district, Cuttack, Dabhoi, Dakpathar, Deharadun, Dehra dun , Dehradun, Delhi, Dhamtari, Dhanbad, Dharmanagar, Dharwad, Dhule, Dibrugarh, Dindigul, District- kurukshetra, Dombivili, Dombivli, Durg, Durgapur, Ernakulam , Ernakulum, Ernamkulam, Erode, Faizabad, Faridabad, Faridkot, Fatordaâ€“margaoâ€“goa, Fazilka, G.b. nagar, Gandhinagar, Gandhinagar - , Gangtok, Gauttam budhha nagar, Gaziabaad, Gazibad, Ghaziabad, Goa, Golaghat, Gorakhpur, Greater noida, Guna, Guntur, Gurdaspur, Gurgaon, Guwahati, Gwalior, Hapur, Hardwar, Haridwar, Harihara, Haripura, Hassan, Hauzkhas, Hazaribagh, Himatnagar, Ho chi minh, Hodal, Hoshiarpur, Hosur, Howrah, Hubli, Hukkeri, Hydarabad, Hydearabad, Hyderabad, Hyderabad., Hyderbad, Ichalkaranji, India, Indore, Indrapuram, ghaziabad, Jabalpur, Jaipur, Jakarta selatan, Jalandhar, Jalandhar city, Jalgaon, Jammu, Jamnagar, Jamshedpur, Jaspur, Jaysingpur, Jhunjhunu, Jodhpur, Junagadh, Kadampanad, Kadi, Kahangad, Kaithal, Kakinada, Kalamassery, kochi, Kalambaste, Kaloor, Kalpakkam, Kalyan, Kalyan east , Kalyan west, Kancheepuram, Kanchipuram, Kannur, Kannur., Kanpur, Kanyakumari district, Karad, Karaikal, Karaikudi, Karkala, Karnal , Karunagappally, Kasaragod, Katpadi, Kesinga, Khammam, Khandwa, Khanna, Kharagpur, Khopoli, Kochi, Kochi,, Kolahpur, Kolar gold field, Kolhapur, Kolkata, Kolkata,, Kollam, Komarapalayam, Kopargaon, Kopergaon, Korba, Kota, Kota jn, Kotkapura, Kottayam, Kottayam dist, Kozhikode, Kumarganj, dakshin dinajpur, Kundara, Kurnool, Kurukshetra, Lalitpur, Lashkar gwalior, Latur, Lausanne, Lonavala, Lonavla, London, Lucknow, Ludhiana, Machilipatnam, Madhyamgram, Madurai, Madurai-2, Mahadevapura, bangalore, Mahape, navi mumbai, Mahesana, Malappuram, Malviya nagar, Mandi, Mangalore, Mangalore, surathkal, Manglore, Manipal, Manipal, udupi, Mapusa, Marcel, Marcela, Margao, Margaon, Mathura, Medinipur, Meerut, Mehsana, Melur, Mettur dam, Mhow, Mhow, district - indore, Miraroad, thane, Modinagar (ghaziabad), Mohali, Moradabad, Morjim, Moti nagar, Mumbai, Mumbai thane , Mysore, Nadiad, Nagpur, Naharlagun, Nalgonda, Nalla sopara, Namakkal district, Namrup, Nanded, Nandyal, kurnool-district, Nashik, Nasik, Navi mumbai, Navsari, Nazareth, Nazira, Neemuch, Nellore, Nellore dt, New delhi, New mumbai, New perungalathur, Neyveli, Neyveli-3, Nipani, Nit faridabad, Noida, Noida / gautam budh nagar, Ongole, Osmanabad, Palakkad, Palamaner, Pampady, Panaji, Panajim, Panchkula, Panjim, Pantnagar, Panvel, Parkala, udupi district, Parwanoo, Patan, Patan(north gujarat), Pathankot, Patiala, Patna, Payyanur, Penugonda, Petlad, Phagwara, Pilani, Pimple nilakha, pune, Pollachi, Ponda, Pondicherry, Ponkunnam, Porbandar, Porvorim, Powai, Puducherry, Pudukkottai, Pun, Punã©, Pune , Pune / maharashtra, Pune 37, Pune, maharashtra, Pune1, Punr, Puri, Raebareli, Raigarh, Raipur, Rajahmundry, Rajapalayam, Rajkot, Rajsamand, Ramachandrapuram, Ramgarh cantt., Ramnthapuram, Rampur, Ranchi, Raniganj, Ratnagiri, Renigunta, Ribandar, Rishikesh, Rohtak, Roorkee, Rourkela, Saharanpur, Salem, Samalkot, Sangli, Sangola, Santiniketan, Sas nagar, mohali, Saswad, Satara, Sector 82, noida, Secunderabad, Secunderbad, Secundrabad, Shahdara, Shevgaon, Shimoga, Shirpur, Shirpur,dhule, Siliguri, Silvassa, Sindhanur, Singapore, Siolim, Sirsa, Sirsi, Sivakasi, Sivasagar, Sojitra, Solan, Solapur, Sonepat, Sonipat, South goa, Sriharikota, Srinagar, Srinagar garhwal, Surat, Surathkal, Suratkal, Surendranagar, Talegaon dabhade, Talod, Tamluk, Tanuku, Tezpur, Thalassery, Thane, Thane (w), Thane west, Thane [ west ] 400607, Thane(west), Thane-west, Thanjavur, Theni, Thiruvalla, Thiruvallore, Thiruvananthapuram, Thiruvanathapuram, Thiruvannamalai, Thiruvannamalai district, Thookkupalam , Thrissur, Tiruchengode, Tiruchirapalli, Tiruchirappalli, Tirunelveli, Tirupati, Tirupur, Tirupur., Tirur, Tiruvannamalai, Trichur, Trichur, , Trichy, Trivandrum, Tumkur, Tuticorin, Udaipur, Udupi, Ujjain, Ulhasnagar, Up, V. v. nagar, Vadodara, Vadododara, Vadodra, Vallab vidya nagar, Vallabh vidyanagar, Valsad, Vapi, Varanasi, Vasai, Vasai east , thane district, Vasai road, Vasai road (west), Vasc-da-gama, Vasco, Vasco da gama, Vasco-da-gama, Vashi, navi mumbai, Vellore, Verna, Vidisha, Vijapur, Vijayawada, Virar (west), Virudhunagar, Visakhapatnam, Vithalwadi(w), Vizianagaram, Warangal, Wardha, Warje malwadi,pune, Yamuna nagar, Yamunanagar, Yeola, Zirakpur, Zuari nagar, Zuarinagar