// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
//pin description
sbit ten_b at ra0_bit;
sbit one_b at ra1_bit;
sbit ss_b at ra2_bit;
sbit led at ra3_bit;
sbit rly1 at rb6_bit;
sbit rly2 at rb7_bit;
//message to be display
char msg1[]="SET TIME=";
char msg2[]="O ON";
char msg3[]="MIN";
char set[]="00";
//end message
//define
#define port porta
#define delay 10
#define smh 1080
#define t 0
#define o 1
#define s 2
//end
//declare variables
bit ss_select,io;
unsigned int in,check,copy_set;
short ten,one;
int DisplayOnce = 0;
// end of declaration
void interrupt()
{
in++;
if(in==check)
{
io=~io;
in=0;
}
intcon.tmr0if=0;
tmr0=39;
}
void main()
{
trisa=0x07;
trisb=0x00;
porta=0x00;
portb=0x00;
option_reg=0x07;
tmr0=39;
ten,one,in,check,ss_select,io,copy_set,led=0;
lcd_init();
lcd_cmd(_lcd_clear);
lcd_cmd(_lcd_cursor_off);
delay_ms(10);
do
{
if(button(&port,s,delay,1)) //logical 1 detect
{
ss_select=~ss_select; //toggle ss select
}
while(ss_b=~ss_b);
start:
if(ss_select==0)
{
if(io==0)
{
intcon=0;in=0;
lcd_out(1,1,msg1);
lcd_out(1,14,msg3);
if(button(&port,t,delay,1)) //if logical one is detected
{
ten++; //increment ten
if(ten==10)
ten=0; //it ten==10 means reset
}
while(ten_b=~ten_b);
if(button(&port,o,delay,1)) //if logical one detected
{
one++; //increment one
if(one==10) one=0; //1f 10 reset
}
while(one_b=~one_b);
set[0]=ten+48;
set[1]=one+48;
copy_set=atoi(set);
check=(copy_set * smh);
lcd_out(1,11,set);
}
if(io)
{
io=0;
rly1=0;
rly2=0;
led=0;
}
}
if(ss_select==0&©_set==0) goto start;
if(ss_select&©_set!=0)
{
intcon=0xA0;
if(io)
{
intcon=0x00;
rly1=1;
one=0;
rly2=1;
ten=0;
led=1;
if(DisplayOnce == 0) {
lcd_cmd(_lcd_clear);
lcd_out(2,1,msg2);
delay_ms(100);
DisplayOnce = 1;
}
}while(ss_select==0);
}
}while(1);
}
char msg1[]="SET TIME=00MIN";
char msg1[]="SET TIME=00MIN";
i get values from user and display through this message(char msg1[]="SET TIME= 00 MIN"; ). the user value is indicated in this code as"00". how to convert these "00"values to integer.
//message to be display
char msg1[]="SET TIME=";
char msg2[]="O ON";
char msg3[]="MIN";
char set[]="00";
lcd_out(1,1,msg1);
lcd_out(1,14,msg3);
lcd_out(1,11,set);
HI.,
IN REAL TIME whenever i switch on the unit output automatically set to high....but as per my program initial state is low, in simulation it's working fine....
i checked with breadboard...is it any problem due to using breadboard.
relay, led and display also show output on
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?