Help with code please
Moderator: Benj
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Help with code please
Hi,
In another thread I am building a heating timer with the help of Enamul, ass an add on I want to make this unit that will give a "Zone ON" indication on an LCD if the corresponding port is high, and when the port is low the LCD reverts to saying OFF, I have started the cod but have got stuck really, I am enclosing a copy of the code, I would appreciate it if anyone could help.
thanks in advance
Acestu
In another thread I am building a heating timer with the help of Enamul, ass an add on I want to make this unit that will give a "Zone ON" indication on an LCD if the corresponding port is high, and when the port is low the LCD reverts to saying OFF, I have started the cod but have got stuck really, I am enclosing a copy of the code, I would appreciate it if anyone could help.
thanks in advance
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
-
- Posts: 125
- Joined: Mon Aug 15, 2011 1:54 pm
- Has thanked: 8 times
- Been thanked: 11 times
- Contact:
Re: Help with code please
It was close. Made a few minor changes.
- Attachments
-
- Flowcode1.fcf
- (17.5 KiB) Downloaded 256 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Help with code please
Hi Acestu,
Here is one version.
I will post another version without the switch command later.
Just want to show you some different methods of achieving what you have requested.
Martin
Edit posts have crossed.
So not seen how dbasnett has done is code.
It's still good to see how different other people so about solving the same task
Here is one version.
I will post another version without the switch command later.
Just want to show you some different methods of achieving what you have requested.
Martin
Edit posts have crossed.
So not seen how dbasnett has done is code.
It's still good to see how different other people so about solving the same task
- Attachments
-
- Zone_status1.fcf
- (15.31 KiB) Downloaded 260 times
Martin
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Help with code please
Hey Thanks Guys,
2 different approaches, that's great for learning purposes, I have just looked at both of the codes and I think the way my logic would of done it was dbasnett's version I think, Martin the way that you did it , the LCD cursor setting I have only seen the settings as numbers ie 17,0 but you have used something like 17, zone_1 so I don't really know what is going on there, but thanks to both of you for the different views...
thanks
Acestu
P.S. My plan is to use these http://www.avagotech.com/pages/en/optoc ... hcpl-3700/
to connect the 230volt live wires to the inputs of the pic and switching the lcd status, what do you think ?
2 different approaches, that's great for learning purposes, I have just looked at both of the codes and I think the way my logic would of done it was dbasnett's version I think, Martin the way that you did it , the LCD cursor setting I have only seen the settings as numbers ie 17,0 but you have used something like 17, zone_1 so I don't really know what is going on there, but thanks to both of you for the different views...
thanks
Acestu
P.S. My plan is to use these http://www.avagotech.com/pages/en/optoc ... hcpl-3700/
to connect the 230volt live wires to the inputs of the pic and switching the lcd status, what do you think ?
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Help with code please
With the cursor command you can either enter a number e.g 17 for X and 0 for Y, or you can enter a variable.acestu wrote: Martin the way that you did it , the LCD cursor setting I have only seen the settings as numbers ie 17,0 but you have used something like 17, zone_1 so I don't really know what is going on there
Since zone steps from 1 to 2 to 3 to 4 then back to 1 then if you use 17 for X and zone-1 for Y then:
When: zone = 1, Y = zone-1 = 0 So Text is on line 0
zone = 2, Y= zone-1 = 1 So Text is on line 1
Etc
Martin
Martin
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Help with code please
I have used this sensor for AC Energy meter module to isolate ac part from PIC..very nice and reliable IC.My plan is to use these http://www.avagotech.com/pages/en/optoc ... hcpl-3700/
to connect the 230volt live wires to the inputs of the pic and switching the lcd status, what do you think ?
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Help with code please
Hi Enamul,
Yes I was searching for something to use for this project the other night and found these they seemed just the job for voltage/current sensing, I am glad you think the same, I have ordered some from Farnell together with the chips for our Timer project, they should be here Monday...
Thanks
Acestu
Yes I was searching for something to use for this project the other night and found these they seemed just the job for voltage/current sensing, I am glad you think the same, I have ordered some from Farnell together with the chips for our Timer project, they should be here Monday...
Thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Help with code please
What you exactly want to know using this chip? I have also used another ic from the same company..they really very linear in output response..Do you want to measure voltage or current or just want to detect the presence of voltage?I have ordered some from Farnell together with the chips for our Timer project, they should be here Monday
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Help with code please
Hi Enamul,
For this project I just want to sense that a wire is live with 230volts, but I would love to learn more about it...
Thanks
Acestu
For this project I just want to sense that a wire is live with 230volts, but I would love to learn more about it...
Thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Help with code please
OK..this chip can easily do that. I can post figure to show how to use the chip.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Help with code please
Thanks Enamul,
that would be great...
Acestu
that would be great...
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Help with code please
Hi
Nice thing of the IC is that it can be used with AC/DC both..But I prefer to rectify outside the IC and filter the DC and drop the voltage low enough so that you can apply that to the input of the IC. GND1 is AC side GND and GND(Vss) is common with PIC. That means GND will be separated and so there will be no link with AC circuit to PIC circuit which can save you from lots of AC issues.
Nice thing of the IC is that it can be used with AC/DC both..But I prefer to rectify outside the IC and filter the DC and drop the voltage low enough so that you can apply that to the input of the IC. GND1 is AC side GND and GND(Vss) is common with PIC. That means GND will be separated and so there will be no link with AC circuit to PIC circuit which can save you from lots of AC issues.
- Attachments
-
- ckt.png
- (50.72 KiB) Downloaded 5176 times
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Help with code please
Thanks Enamul,
That's really handy, just what I want to do, would it be advisable to put a fuse on the AC input ?
Thanks
Acestu
That's really handy, just what I want to do, would it be advisable to put a fuse on the AC input ?
Thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Help with code please
Yes. You are absolutely right. I forgot to put..That's a very emergency one for ac.That's really handy, just what I want to do, would it be advisable to put a fuse on the AC input ?
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Help with code please
Hi Enamul,
what sort of value fuse would you use because I suppose this device is drawing absolute minimal current ?
thanks
Acestu
what sort of value fuse would you use because I suppose this device is drawing absolute minimal current ?
thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Help with code please
Hi Enamul,
Just wondering what diodes you have used for the voltage sensing circuit, would 1N4001 do because there is no real big power involved is there ?
thanks
Acestu
Just wondering what diodes you have used for the voltage sensing circuit, would 1N4001 do because there is no real big power involved is there ?
thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Help with code please
1N4001 is perfect for this application..180K is limiting current..so no problem