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

Wed Aug 21 2019, 02:53 AM
charmdatescamreviewsldn
writing
Wed Aug 21 2019, 02:04 AM
charmdatemke
cooking
ExperimenterUK
Mon Aug 05 2019, 07:09 PM
@Ismail ..post in forum, give details
Mon Aug 05 2019, 04:33 PM
Ismail balghmi
Hello. Please I won't download
ExperimenterUK
Wed Jul 24 2019, 12:47 AM
@BUSTER123 Please post in the forum
Tue Jul 23 2019, 06:13 PM
BUSTER123
hello! newbie here. i am kind of a guy who hates using ready - made existing libraries, so this helped a lot as i was trying to control and write to a character lcd display. however, i can't figure out how to set the cursor position. for example, i want to set it to the 5th column in the first row, so position 5. so according to the table, i am sending 10000101 on the 8 data lines of the lcd (register select pulled low). the cursor does not move there however. and i cant move the cursor left or right too. is it something wrong that i am doing? thank you.
ExperimenterUK
Thu Jul 11 2019, 07:55 PM
@ramos https://www.theengineeringprojects.com/2017/09/l298-motor-driver-library-proteus.html
ExperimenterUK
Thu Jul 11 2019, 07:44 PM
@praveen123. Can you give a link to the project ?
Thu Jul 11 2019, 04:47 PM
ramos
buenos dias alguien podria ayudarme necesito saber como descargar la libreria del l298n para proteus
Thu Jul 11 2019, 11:11 AM
praveen123
anyone can help me

Downloads

Comments

jualanled
Sat Aug 17 2019, 03:41 AM
Wed Aug 07 2019, 10:35 AM
hieu16005
Sat Aug 03 2019, 01:16 PM
Pra
Mon Jul 29 2019, 07:39 AM
manu8193
Wed Jul 24 2019, 04:44 AM
3AAPC
Sun Jul 21 2019, 12:41 AM
rpels7707
Fri Jul 19 2019, 11:31 AM
ameya123
Fri Jul 19 2019, 07:36 AM

Online

Guests: 44, Members: 0 ...

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

Members: 38086
Newest member: jualanled
Forum Activity
nick@IT Avatar
Posted By [email protected]
Wed Aug 07 2019, 10:38 AM
I am trying to execute USSD codes through my GSM m...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Jul 28 2019, 08:55 PM
An LM339 may not be fast enough for reliable SPI ...
sakibnaz Avatar
Posted By sakibnaz
Sun Jul 28 2019, 06:40 AM
Hi All.I need to connect my MCU with an external S...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jul 24 2019, 10:42 PM
Your unit is communicating, so I assume the GPS si...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jul 24 2019, 10:32 PM
Have you read this ?http://www.8051projects.net/wi...
manu8193 Avatar
Posted By manu8193
Wed Jul 24 2019, 04:57 AM
any one tell me the explaination and 'c' code for ...
3AAPC Avatar
Posted By 3AAPC
Sun Jul 21 2019, 12:51 AM
3AAPC Avatar
Posted By 3AAPC
Sun Jul 21 2019, 12:47 AM
With the GPS antenna in the outdoors, I use the ub...
ameya123 Avatar
Posted By ameya123
Fri Jul 19 2019, 07:42 AM
Hello,Please share 8051 Assembly language code for...
figureyang Avatar
Posted By figureyang
Fri Jul 05 2019, 04:37 AM
here is the source code prepared for you download ...