15/04/2009, 05:56 AM
The story is as follows:
For school I have to write a program in BASIC to run on a PIC chip. I've chosen to write a program that controls a railway crossing. One of the features of the system is that it counts how many trains have passed over the crossing. When the counter reaches 1000 it will turn on an output warning that the crossing needs maintenance.
My problem is:
How the hell do I program it to check if the counter has reached 1000. I've worked out how to add 1 to the counter for every train that's passed, and how to reset the counter when an imaginary maintenance man comes and presses a button, but I can't work out how to check the number in the memory address allocated to the counter.
Anyone? Does anyone here even know BASIC?
PS the PIC chip is a 16C84 (DATASHEET)
For school I have to write a program in BASIC to run on a PIC chip. I've chosen to write a program that controls a railway crossing. One of the features of the system is that it counts how many trains have passed over the crossing. When the counter reaches 1000 it will turn on an output warning that the crossing needs maintenance.
My problem is:
How the hell do I program it to check if the counter has reached 1000. I've worked out how to add 1 to the counter for every train that's passed, and how to reset the counter when an imaginary maintenance man comes and presses a button, but I can't work out how to check the number in the memory address allocated to the counter.
Anyone? Does anyone here even know BASIC?
PS the PIC chip is a 16C84 (DATASHEET)