473,324 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

C Code For Automatic Lightning Controller

hai,
i need to write code for a device which controls the automatic turn on and turn off lightning lamps of a home,which is connected to the serial port of the PC.

can u help me by giving the code for the serial port programming and also the required functions that i should write for the device.
Jan 22 '07 #1
7 2180
horace1
1,510 Expert 1GB
hai,
i need to write code for a device which controls the automatic turn on and turn off lightning lamps of a home,which is connected to the serial port of the PC.

can u help me by giving the code for the serial port programming and also the required functions that i should write for the device.
Sounds an interesting project - what is the interface between the serial port and the lights - is it on/off control or vaiable, e.g. relays, opto-isolator, triac, etc.?

what operating system and compiler are you usings as this will effect the serial driver code?
Jan 22 '07 #2
hi,
the interface between the serial port and pc is PLC called as power linc v2 controller developed by smarthome INSTEON network.i will connect the PLC to the serial port of pc,then i need to write some coding on pc the platform is windows.i need to develop the C programming code that should be embedded into the PLC insteon device,on the power line which is connected to plc,on that line only a product of INSTEON called lightning controller is alligned on the same power line.so i need to write code for the lightning device.

i think first i need to write code for serial port programming and then the device functions help me in total coding

the on/off control that kind of actions are taken care by the PLC.
Jan 22 '07 #3
horace1
1,510 Expert 1GB
hi,
the interface between the serial port and pc is PLC called as power linc v2 controller developed by smarthome INSTEON network.i will connect the PLC to the serial port of pc,then i need to write some coding on pc the platform is windows.i need to develop the C programming code that should be embedded into the PLC insteon device,on the power line which is connected to plc,on that line only a product of INSTEON called lightning controller is alligned on the same power line.so i need to write code for the lightning device.

i think first i need to write code for serial port programming and then the device functions help me in total coding

the on/off control that kind of actions are taken care by the PLC.
which compiler are you using? e.g. visual C, DEV-C++, borland cbuilder?
Jan 22 '07 #4
borland c compiler
Jan 22 '07 #5
horace1
1,510 Expert 1GB
borland c compiler
have a look at
http://www.geocities.com/horacespider/Serial_IO/

the code in directory TurboC V3 works with borland Turbo C V3

The code in directory DEV-C compiles under Borland C V5.6 - gives a few warnings but you can probably ignore them - seems to work OK
Jan 22 '07 #6
hai,
can u help me by giving some tips in developing the c code for an embedded device on the serial port of pc,which has internal memory.

setbrightlevel( )
setdimlevel( )
settimer( )/* sets the time for the lamp in a day for which time it should operate on off */
Jan 26 '07 #7
horace1
1,510 Expert 1GB
hai,
can u help me by giving some tips in developing the c code for an embedded device on the serial port of pc,which has internal memory.

setbrightlevel( )
setdimlevel( )
settimer( )/* sets the time for the lamp in a day for which time it should operate on off */
I assume you have some protocol to communicate with the embedded microcntroller to set the levels, timers, e.g. could be characters such as T1540 to switch on the timer at 15.40.

you would need to
(1) initialise the RS232 serial port to required baud rate etc, e.g. if you use the code I suggested
Expand|Select|Wrap|Line Numbers
  1. rs_initialise(port ,9600, '8', 'N')
  2.  
(2) send the characters to do required control
Expand|Select|Wrap|Line Numbers
  1. rs_putstring("T1540");
  2.  
you could form string for all the other operations

have you written the microcontroller code yet?
Jan 26 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: bigoxygen | last post by:
Hi. I'm using a 3 tier FrontController Design for my web application right now. The problem is that I'm finding to have to duplicate a lot of code for similar functions; for example, listing...
0
by: Fritz Bosch | last post by:
We are in the process of refactoring our GUI-based test application for radio equipment and are rewriting a significant part in Python. The new architecture will substantially be based on the...
4
by: SQL Sever News Group | last post by:
Hi, I v a problem that i have to secure my asp code. I tried "screnc.exe", it is very useful but not hard to crack. Anybody who can give an alternate and better way. Thanks in Advance
26
by: Michael Strorm | last post by:
Hi! I posted a message a while back asking for project suggestions, and decided to go with the idea of creating an adventure game (although it was never intended to be a 'proper' game, rather an...
1
by: Andy Fish | last post by:
Hi, I have been thinking about the design of a large ASP.NET app and I've read people have a lot of trouble implementing front controller, especially with postbacks, so I don't feel comfortable...
37
by: Alan Silver | last post by:
Hello, Newbie here, so please forgive what is probably a basic question ... I see a lot of discussion about "code behind", which if I have understood correctly, means that the script code goes...
4
by: Griff | last post by:
Two questions really, the first one "conceptual" and the other more involved with design: 1 - There are two schools of thought where I work on the role of the "controller" task. The first is...
10
by: simon.hibbs | last post by:
Lets say that I have an application consisting of 3 files. A main.py file, gui.py and a data.py which handles persistent data storage. Suppose data.py defines a class 'MyDB' which reads in data...
3
by: knkk | last post by:
I am trying to include this code in the footer.template files of all blog templates: <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." :...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.