I am coding a basic traffic light control which will be displayed on the monitor.
In that i need an external interrupt (event ) to happen and change the state of the current traffic light. I am trying to do it without any board or external peripheral.
Now I think i have the following choices . tell me which is the best.
1. One interrupt function to be installed on the system which will give interrupt regularly? (But i dont know how to install that …any body please help me on that)
2. A C program running on a 2nd PC or hyperterminal which will regularly send some different values with delay to my PC serial port on which the traffic light program is running which will regularly check that value and for one set of data it will change to one state and for another set of data another state. So here the two programs will be running simultaneously on their own system.
3.Or else shall i go for an external interrupt generator?
In the above methods which is the best way to do it. or else is there any other altrnative which is simpler and do not include external hardware.If any of the above solutions are not correct then please ignore them.. My environment is turbo C on windows.(answers on gcc are also invited bcos i have TRITON IDE with gcc installed on windows for ARM7)
You could just make a multithreaded application and have some treads act like interrupts when thay awake.
Thread one: Traffic controle Thread two: Simulate traffic approching from east and requesting a change in ligthing, and randomly sleeping from 1 to 60 seconds before awakening again. Thread X use imagination.
In gcc this could be done easy if you have the pthread lib for one example.