With the exception, that I need to create a "YELLOW" color by using a duty cycle of 18ms on, 8ms off, and still be able to check inputs from 2 other pins, that will designate the LED switch from either a RED, or GREEN, depending on the status of the other two inputs. This should be all logical, obviously, and should allow the changing of the color, for an "Automatic Block Control" Example -
input 1 is reading the status of next block = HIGH if occupied, LOW if empty.
HOWEVER... the "HOME" Block signal, which this is written for, must check to see if it's OWN block is occupied, called "Occupancy_Status", which of course is read as a first priority. HIGH = Occupied, LOW = EMPTY.
If the block forward (NEXT BLOCK), is occupied, then it checks to see if its OWN "HOME BLOCK" is empty or occupied. If it is "OCCUPIED" this "HOME BLOCK(each ATtiny85 is its own 'HOME BLOCK' a home block control). then the block is immediately turned in to a yellow signal, and then when the block behind it checks the status of the forward block "HOME" Status goes to yellow, it checks its "OWN HOME STATUS", and looks to see if the Block is occupied, or empty, it will set the LED to GREEN, if its own "HOME BLOCK is empty, or stays RED being occupied itself. It keeps checking forward Status, to see which MODE, or COLOR it is in, an
Diagram - ---------------------[BLOCK 1]-----------------------------------------[BLOCK 2]----------etc...
| | | | | |
OUTPUT | | |(INPUT) (OUTPUT)| | | (INPUT)
| | | | | |
---To Previous Block INPUT---- | | |--FROM NEXT BLOCK STATUS OUTPUT----- | | | --NEXT BLOCK--(etc) --->
[INPUT from HOME Block Sensors] [INPUT from HOME Block Sensors]
[HOME BLOCK OCCUPANCY STATUS] [HOME BLOCK OCCUPANCY STATUS]
HIGH = OCCUPIED HIGH = OCCUPIED
LOW = EMPTY LOW = EMPTY
IF THIS DIAGRAM DOESN'T MAKE SENSE, I'LL UPLOAD A COLORED DIAGRAM SHORTLY, LET ME KNOW.
This is an Automatic Block Control(ATC) for Train Traffic on main lines that are NOT CTC controlled(Central Train Control)
The controlling block, in a controlled routing system, is where your diverging routes are 'SET" for Direction, and the BLOCK sensors. along with the BLOCK STATUS from the FORWARD or NEXT BLOCK signal STATUS, determines the proceeding Block Signal color.
The combination of a forward block being occupied, and as long as the previous block is NOT occupied, that block will change to "YELLOW' unless it is OCCUPIED, at which point it will stay RED Until it is cleared.
If this isn't as clear as I hoped it would be, please ask for clarification. Each block is controlled mainly by these 2 signals, and then all that is necessary needed is the ability to make a duty cycle be maintained so that it appears to be a YELLOW signal after it HOME block is cleared, and the next block is OCCUPIED. This should automatically cascade back through all of the needed signals on each independent selected route between CTC sections. Holding a GREEN or a RED signal is easy. HIGH or LOW. High being GREEN, and LOW being RED. This single output pin should control all 3 colors needed.
If the block is clear, it will show a GREEN. If it is OCCUPIED, it will show a RED. The previous signal should read this output, and then check the TRACK OCCUPANCY pin, to see if it is FULL, or EMPTY, and display the appropriate color on the signal head.
I fear I am complicating a simple operation, and I have developed a mind block on why I should do this or that to make it work... HELP!!!!!! lol!!!!
THANK YOU IN ADVANCE FOR HELPING ME UNDERSTAND WHAT I MUST DO TO MAKE THIS WORK. THE REMAINING PROGRAMMING IS DEPENDANT ON THIS SUBROUTINE, AND ARE EASILY IMPLEMENTED.
I have gotten confused in how to write it so it sequences properly.