Microcontroller › 8051 › 8051 Source Codes
- This topic has 2 replies, 2 voices, and was last updated 9 years, 4 months ago by Ashutosh Bhatt.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
July 27, 2015 at 12:37 am #3785desmondParticipant
Are most of the sources for the 8051 projects (Digital Clocks etc.) incorrect or it's that I am using the wrong compiler? When I try to debugg the program below, I get an error saying "unknown file name 'sfr' " and the same thing happens for 'sbit'. I use codeblock and keil evaluation edition as my compilers.
//Program for Digital clock using RTC DS12C887 and 8051 microcontroller (AT89C51) with time set
/*24 hr clock
set p3^3=0,then start=0 then set time by dig_hr1 & dig_min1, then remove p3^3 & start */
#include<reg51.h>
#include<absacc.h>
#define dataport P2
#define port P1
#define lcdport P3
sbit reset = port^0;
sbit rs =port^1;
sbit rw =port^2;
sbit e = port^3;
sbit dig_hr1=port^4;
sbit dig_min1=port^5;
sbit start=port^6;
int min1=0,hr1=0;
int min0=60,hr0=25;
unsigned char temp=60,hr,min,sec,num[60]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0X09,0X10,0X11,0X12,0X13,0X14,0X15,0X16,0X17,0X18,0X19,0X20,0X21,0X22,0X23,0X24,0X25,0X26,0X27,0X28,0X29,0X30,0X31,0X32,0X33,0X34,0X35,0X36,0X37,0X38,0X39,0X40,0X41,0X42,0X43,0X44,0X45,0X46,0X47,0X48,0X49,0X50,0X51,0X52,0X53,0X54,0X55,0X56,0X57,0X58,0X59};
void delay(unsigned int msec )
{
int i ,j ;
for(i=0;i<msec;i++)
for(j=0; j<1275; j++);
}
void lcd_cmd(unsigned char item)
{
dataport = item;
rs= 0;
rw=0;
e=1;
delay(1);
e=0;
return;
}
// function to send data
void lcd_data(unsigned char item)
{
dataport = item;
rs= 1;
rw=0;
e=1;
delay(1);
e=0;
return;
}
void lcd_data_string(unsigned char *str)
{
int i=0;
while(str!='