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

ExperimenterUK
Thu Mar 14 2019, 08:44 PM
We don't send code,but you can ask for help in the 8051 forum
Thu Mar 14 2019, 11:00 AM
Jui Sanjay Kapare
Hello sir, I want code of interfacing DS18B20 with 8051.plz send the code as early as possible
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....

Downloads

Comments

tutu10
Tue Mar 12 2019, 07:11 AM
Raj243
Fri Mar 08 2019, 02:08 AM
bharatsb
Thu Mar 07 2019, 04:34 PM
Yass7
Thu Mar 07 2019, 03:55 PM
mashabed
Mon Mar 04 2019, 11:08 PM
AccelMotion
Tue Feb 26 2019, 06:06 PM
turbovps
Mon Feb 25 2019, 06:26 AM
the_Doker
Thu Feb 14 2019, 02:21 PM

Online

Guests: 34, Members: 0 ...

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

Members: 38052
Newest member: tutu10
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Mar 22 2019, 09:10 PM
Using the external interrupt on pin B0 is the best...
Ansh12 Avatar
Posted By Ansh12
Fri Mar 22 2019, 03:45 PM
I have pic16f877a and MPLABX8 and I want to count ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Mar 13 2019, 02:32 AM
HiI looked at" Atmel AVR042: AVR Design Considera...
tutu10 Avatar
Posted By tutu10
Tue Mar 12 2019, 07:13 AM
Hi...My firmware upgradable code lock seems to be ...
Yass7 Avatar
Posted By Yass7
Sat Mar 09 2019, 12:52 AM
It's exactly that ! it's my teacher who asked me t...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Mar 09 2019, 12:27 AM
As I understand it, you want to use a P89LPC952 /...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Mar 09 2019, 12:21 AM
After you get the string what do you want to do wi...
bharatsb Avatar
Posted By bharatsb
Thu Mar 07 2019, 04:40 PM
help me to write code for 8051 to receive string ...
Yass7 Avatar
Posted By Yass7
Thu Mar 07 2019, 03:59 PM
Hello everyone,here I made a 3-axis CNC with 3 ste...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Jan 26 2019, 07:19 PM
Yes that helps a lot.At first sight I can't see th...