Discussion in "8051 Discussion Forum" started by    DavesGarage    Nov 14, 2009.
Thu Apr 14 2016, 08:12 PM
#21
This pseudo code give the idea.
The way interrupts are coded will be specific to your compiler.


[ Edited Thu Apr 14 2016, 08:12 PM ]
 Karan123 like this.
Fri Apr 15 2016, 01:18 AM
#22
Thanks for reply..
Mon Apr 18 2016, 11:56 AM
#23
Hi,

@ Thanks again ExperimenterUK.

Your program as in pseudocontrolcode.zip greatly helps me .

I have implemented it in MPLAB XC8 for PIC18F4520 with Crystal Frequecny 11.0592 MHZ.

For Simplicity i have used switches to increase or decrease the values.

Now The Problem is that the Code Wait at
Delay(8000); // Scroll Delay [Display it for some time] Function as Below:

Please guide me any solution for this.
Means Relays should ON or OFF independently while scrolling the data on LCD or SEG7 will be done independently .


while(1)
	{
		///////////    Read Temperature //
		ReadTemperature();	
		if (temperature < 4 && heaterCount==0)		
	 	{
	  			heaterRelay=RELAY_ON;  		
	  			heaterCount=200;  			
	 	}
		if (temperature >
 4)
	 	{
	  			heaterRelay=RELAY_OFF;  		
				heaterCount=200;  				  			
	 	}
	  	 Delay(8000);	 	//	Scroll Delay  [Display it for some time]
		/*    Read Pressure */
		ReadPresure();
		if (pressure < 4 && pressureCount==0)		
	 	{
	  			pressureRelay=RELAY_ON;  		
	  			pressureCount=100;  					
	 	}
		if (pressure >
 4)
	 	{
	  			pressureRelay=RELAY_OFF;  			
				pressureCount=100;  				
	  			
	 	}
		Delay(8000);	 	  //	Scroll Delay [Display it for some time]
	}



For Complete Code please check attachment .


Any other suggestions are Welcome.

--
Karan
Attachment


[ Edited Mon Apr 18 2016, 12:04 PM ]
Mon Apr 18 2016, 08:03 PM
#24


@ Thanks again ExperimenterUK.


Your program as in pseudocontrolcode.zip greatly helps me .

Karan123



Thanks


Now The Problem is that the Code Wait at
Delay(8000); // Scroll Delay [Display it for some time]

Karan123



What is the problem ?



      ///////////    Read Presure //
      ReadTemperature();
                 // If relay already on don't restart it
      if (temperature < 4 && heaterCount==0)      
                       
       {
               //   Turn on the pump ..10 second on time
              heaterRelay=RELAY_ON;         
              heaterCount=200;         
       }
      if (temperature  >
 4)
      {
              heaterRelay=RELAY_OFF;  //Turn OFF the pump
           //  heaterCount=200;  //--is this needed ? 
       }

  


I'm not sure of your logic here.
You can turn the relay on for a set time,
or turn the relay on and off at the set temperature.
To do both seems odd.


[ Edited Mon Apr 18 2016, 08:14 PM ]
Tue Apr 19 2016, 12:06 PM
#25
Hello Again,

The Problem:

ReadTemperature(); -------------Shows it for Some time [Say 4 sec]
Delay(4000); // Scroll Delay [Display it for some time]
if(desired relay ON for after 10s(say))

ReadPressure(); -------------Shows it for Some time [Say 4 sec]
Delay(4000); // Scroll Delay [Display it for some time]
if(desired relay ON for after 1s(say))

if Not desired ReadTemperature() and ReadPressure() keep scroll [4 sec ]on LCD or 7 Seg.

if desired ReadTemperature() and ReadPressure() keep scroll [4 sec ]on LCD or 7 Seg with Relay ON delay.

You have deleted Delay(4000); // Scroll Delay [Display it for some time]

Tue Apr 19 2016, 12:11 PM
#26
I want to
if temperature exceed certain limit (say 7)
the Relay should ON after (10s)

if temperature reach again its limit (say 7)
the Relay should OFF after (10s)

Values from temperature and pressure keep scrolling after 4 seconds (says)

--
karan
Tue Apr 19 2016, 09:26 PM
#27


I want to
if temperature exceed certain limit (say 7)
the Relay should ON after (10s)

if temperature reach again its limit (say 7)
the Relay should OFF after (10s)

Values from temperature and pressure keep scrolling after 4 seconds (says)

--
karan

Karan123


I'm afraid I don't understand what you want.


the Relay should ON after (10s)

Karan123


Did you mean
the Relay should be ON for (10s) ?

Can you describe the full project so I can get a better idea of what you
are doing ?

Wed Apr 20 2016, 10:09 AM
#28
Hi,

1)
In Simple words.
I want to make a system that will scroll temperature and pressure on LCD or 7 Segments every 4 seconds.


Did you mean ..
the Relay should be ON for (10s) ?



2)
No . Relay should ON after 10 sec . and Kept ON when condition is true . If Condition will be false (somehow) Relay should OFF after 10 sec and Kept OFF

3)
when condition is true 10 sec should Not be added to 4 sec delays.

Means Relay Should kept ON and OFF Independently and Scrolling will be done Independently.


--
Karan
Thu Apr 21 2016, 09:05 PM
#29
Try this

Fri Apr 22 2016, 11:39 AM
#30
Hello,

Many of Thanks for pseudocontrolcode2.zip .

The Display Scrolling is done prefactly with your code .

But there is problem in Relay ON Relay OFF Timing.

Sometimes Relay Get ON after 10sec, Sometimes 5sec, Sometimes 8Sec

Means Not Exact Timing. Same thing for Relay OFF timing.

Meanfile . I have shifted these two lines to main.But results are same.

if(heaterOnDelayCount==0)  //when we hit 0, turn on the relay
  heaterRelay=ON;     //turn relay on
if(heaterOffDelayCount==0) 
  heaterRelay=OFF;     //turn relay off





Please Check complete code as attchment guide me how to correct the mistake .

Code made for PIC18F4520 with MPLAB XC8 complier .




--
Karan
Attachment

Get Social

Information

Powered by e107 Forum System

Conversation

Tue Jan 22 2019, 06:51 AM
chnlovelyo
writing
ExperimenterUK
Mon Jan 07 2019, 03:31 AM
@REVOCATUS please post in the AVR forum
Mon Dec 24 2018, 09:25 AM
REVOCATUS MATEMU
sorry I mean referee boards for player substitution
Mon Dec 24 2018, 09:24 AM
REVOCATUS MATEMU
hi am.looking how to build referee by using Atmega 328 and its codes
Sat Dec 15 2018, 01:45 PM
Arslan ayoub
Hii ,, can I get the simulation of numeric keypad lock on proteus
ExperimenterUK
Mon Dec 03 2018, 05:17 PM
Please post questions in the forum. The chat box is for chat
Mon Dec 03 2018, 06:43 AM
help!me!
help! I don't understand busy flag!
Sun Dec 02 2018, 08:01 PM
ile
hello
Mon Nov 12 2018, 05:58 AM
Pavan_user
i have seen your replica of I2C programming using AT89C51 but i am unable to understand the "ack_bit" variable usage ...looks like it is always 1...can you elaborate how acknowledgment is working....
bgk3678
Tue Nov 06 2018, 02:36 PM
kindly any one give solution for my problem

Downloads

Comments

garfield0929
Sun Jan 20 2019, 12:48 AM
servprov
Thu Jan 17 2019, 06:44 AM
marcomilazzo
Wed Jan 16 2019, 04:21 PM
sandhyashree
Wed Jan 16 2019, 04:04 PM
SONACHAI1234
Sun Jan 06 2019, 08:14 AM
manan.gulyaani
Tue Jan 01 2019, 07:58 AM
etech
Sun Dec 30 2018, 07:44 PM
NeilC
Sun Dec 23 2018, 07:39 PM

Online

Guests: 68, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38039
Newest member: garfield0929
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Jan 06 2019, 10:37 PM
Which 8051 chip are you using ?
SONACHAI1234 Avatar
Posted By SONACHAI1234
Sun Jan 06 2019, 08:21 AM
Hi,By mistakenly i burn rx program in my 8051 micr...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Dec 19 2018, 06:27 PM
Nobody knows?sifirsekizThe problem is that you are...
sifirsekiz Avatar
Posted By sifirsekiz
Wed Dec 19 2018, 12:15 PM
sifirsekiz Avatar
Posted By sifirsekiz
Sun Dec 16 2018, 11:13 PM
Guys pleaseeeee :((
sifirsekiz Avatar
Posted By sifirsekiz
Sat Dec 15 2018, 07:09 PM
HiThe pulse-sensor-amped has an analogue output.Th...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Dec 15 2018, 07:01 PM
HiThe pulse-sensor-amped has an analogue output.Th...
sifirsekiz Avatar
Posted By sifirsekiz
Sat Dec 15 2018, 09:02 AM
and ı have pulse sensor one out but anolog use 805...
sifirsekiz Avatar
Posted By sifirsekiz
Sat Dec 15 2018, 08:56 AM
HiMembers can supply code and diagrams if they wan...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Dec 14 2018, 11:54 PM
HiMembers can supply code and diagrams if they wan...