Today, 00:29
|
#12
|
|
RIP Tigger - 13 years?!
Join Date: Jul 2005
Location: Bolton
Age: 60
Services: BT Superfast Broadband
Posts: 1,690
|
Re: Programming
Which is why a new thread has been started. Fair enough. 
Ooh, I forgot - I've also studied PLC (Programmable Logic Controller) programming, which I enjoyed for its practicality (as I did Real-Time Systems on my HND, programming in 6809 Assembler on, of all things, a PDP-11). Washing machines and the like used to use them, not sure if they still do. One program controlled a miniature conveyor belt. It simulated a factory process:
Three items. Belt moves forward until item breaks a detector beam. Pauses a few seconds (simulating a heater). Moves forward. Stops again (simulating a paint spray). Moves back to the heater (to dry the paint) for a few seconds. Moves forward until item falls off belt (as if falling into a hopper). Repeat for next 2 items.
First item, fine. Second...belt didn't stop either time when it should have. Third, fine. Colour me puzzled. "How the hell," I wondered, "is it going wrong in the middle of the process?" I wrote a foolproof program, taking various conditions into account, only it didn't work. Then I made that item the 3rd. This time the program handled the first 2 items fine, but didn't handle the third.
Then, when I made that item the 1st and the program apparently failed straight away, I realised why - and for once it wasn't my program at fault, for it turned out to be perfect. In fact another student tried it and it worked perfectly. But he was using a different belt.
The cause was so simple: the item in question wasn't as tall as the others (again realistic; in a real factory the 3 items might indeed have been different), and it was passing below the beams without breaking them. The 'stop' relay wasn't being triggered.
Cue hysterical laughter.
I lowered the beams with a handy screwdriver (and the lecturer's laughing permission), and the program worked exactly as expected. With hindsight it needn't have been as elaborate once the beams were sorted out, but I left it be anyway.
I loved real-time systems (and Real-Time Systems). I wrote a traffic light simulator (you had to calculate timing carefully, though - one student miscalculated, and his program paused for only 0.02 seconds when it was supposed to pause for 2!), an interrupt-driven program to control a rotating clock pointer, a real-time digital clock (again interrupt-driven) and a slightly different version of the traffic light simulator to control not the full-sized setup, but a miniature with LEDs and an EEPROM chip. An A for every assignment. Oh, they were fun!
__________________
"People tend to confuse the words 'new' and 'improved'."
- Agent Phil Coulson, S.H.I.E.L.D.
WINDOWS 11, ANYONE?!
Last edited by Anonymouse; Today at 00:48.
|
|
|