Mesut Yigit Guest
|
PLC like functions |
Posted: Fri Jan 28, 2005 1:01 pm |
|
|
My problem is , I need some of the functions of an PLC hardware.
1 ) As in a PLC , I need to use nearly 30 timers that has a time base of 10ms. and has an Set value , current value, enable input (boolean) and time elapsed output (boolean).
2) logical functions has to be cascaded in a row , nearly 8 functions in a rung.
3) Whole system must work in such a sequence as follows.
main()
{
Init_MCU();
Init_PLC();
while(1)
{ get_inputs();
process_ladder();
write_outputs();
}
}
The main benefit of this approach is the rule based control ability of each discrete input and output. In classical programming, especially time delays causes problems. Let say if you use delay_ms(500) , all the main loop stops for half second.
With above written way , I can use one of the timer as a constant time base.
Did somebody try this way of programming? , can I find some samples?
Thanks to everybody for help.
P.S. Currently, in my spare time , I am working on a programming environment to use PICs and CCS compiler to write classical Ladder algorithms, a sort of ladder to CCS compiler translater. I am going to publish it as open source. Yet have a long way to go. |
|