Hi Steve,
Firstly welcome to MrPLC and also welcome to the wonderful world of PLC programming, after doing a few projects you will never look back......well done for sticking your hand in the air to take on this train project there is no better way of learning something than jumping in with both feet.......as my old boss used to say "out of the deep end come the best swimmers"......another boss said "the only way to tackle something is to take a huge bite and chew like hell" they both had nervous break downs but thats beside the point.....anyway I digress.
I must agree with BobL on the grade.....big A for effort from me too but the commenting has alot to be desired.
When commenting programs you are not only looking out for the next poor soul that has to come and have a look at your code but also 6 or 12 months down the track when you yourself come back to the code and try to wade through and make sense of it all.
On a simple few lines of code stringent commenting might not seem such a huge deal but as the program becomes larger and more complex good comments are crucial....it is a good idea to get into the habit of commenting from the very start of your programming life.
Since you have been gutsy enough to throw your code out there for all to see and critique (good on you!) I will put mine out there too.
It is raining where I am here in Ozzie land at the moment so I thought I might put together a program of how I would tackle the train crossing project.
There are many ways to skin a cat and my example is just one way...bear in mind I don't have a plc here at home so I haven't tested the code there could be a couple of gremlins lurking but in general I think it is pretty solid.
I have used the concept of command and status bits (I dropped the status bits cos there really is no feedback from gate position limit switches or anything else). This basically means that the control sequence and outputs are completely separate modules and they interact by relaying commands from the control sequence to the outputs and status info back to the control sequence.
By keeping both separate you can chop and change the control sequence as you wish during the commissioning process or if new changes or expansion occurs. All you have to do is energise the lamp flash trigger for example the output module will take care of the rest. It might seem a bit long winded and all over the place at first but in the long run and as the program becomes much larger this modular approach really starts to come into its own. Compared to embedding outputs into sequences and creating one massive sprawling program modules are far superior.....that is only my humble opinion.
I also I used the plc free running clock to manage the pulsing of the lamps it is simple and takes care of a basic task like flashing a lamp nicely...you had 1 second as your on time and 1 second as your off time unfortunately the free running clock (see help files in RSLogix500) doesn't have a 1 second on/off timebase but I figured 1280ms would do for this project.
I was also thinking about some sort of checking of the limit switches to see that they are not on at the same time or some checking to see that they actually turn off (it is called back checking with pneumatic cylinder position sensors) in case of failure but I don't know enough about how they are triggered by the train to go down this track....pardon the pun

.
I also thought about a manual function so you could drive the bell, lights or gate separately to check operation.
As I said there are many ways to achive this project mine is just one....all I am trying to do is give you a few ideas on how to approach it from a different angle.
Hope it helps
Cheers
[attachmentid=6701]