Microcontroller › 8051 › Help with serial communication and lighting of led
- This topic has 1 reply, 2 voices, and was last updated 7 years, 8 months ago by
GANEEV SINGH.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
December 12, 2011 at 2:38 pm #1438
Julian
ParticipantGreetings. I’m a beginner is programming 8051. i’m doing a project involving leds, pushbuttons, lcd n serial comm. My led, lcd and pushbuttons work fine but when i combined the serial part, it’s only either the serial is working or the lcd n led are working. I’ve provided my source code below. it’s not a difficult program. pls correct me if there’s any mistake. thx a lot.
#include <reg51.h>#include <stdio.h>#define lcd_port P2int j;sbit rs = P0^5;sbit rw = P0^6;sbit en = P0^7;sbit BUT0 = P0^0;sbit LED0 = P1^0;sbit BUT1 = P0^1;sbit LED1 = P1^1;char bz[]={“Busy”};char awy[]={“Not at campus”};void delay(unsigned int msec){int i,j ;for(i=0;i<msec;i++)for(j=0;j<200;j++);}void lcdcmd(unsigned char value){rs = 0;rw = 0;lcd_port = value;en = 1;delay(1);en = 0;}void lcd_data(unsigned char display){rs = 1;rw = 0;lcd_port = display;en = 1;delay(1);en = 0;}void shift_left(){lcdcmd(0x18);delay(200);}void lcd_busy(){for (j=0; bz[j]!=’