BASIC and PIC
|
Author |
Message |
PSPkiller
*The Sweaty Indian/Welsh Guy*
Posts: 2,393.2167 Threads: 251
Joined: 24th Jun 2007
Reputation: 0.56947
E-Pigs: 53.7911
|
BASIC and PIC
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)
[Insert Signature Here]
|
|
15/04/2009 05:56 AM |
|
Mc Cabe
Storm Trooper
Posts: 1,218.1771 Threads: 177
Joined: 14th Aug 2007
Reputation: 1.43435
E-Pigs: 38.5281
|
RE: BASIC and PIC
umm my computing teacher would probably cast me to stone if I even looked at basic :3
umm?
(This post was last modified: 15/04/2009 06:50 AM by Mc Cabe.)
|
|
15/04/2009 06:50 AM |
|
Mythos
protoman
Posts: 573.1637 Threads: 31
Joined: 18th Apr 2007
Reputation: -1.8373
E-Pigs: 24.3694
|
RE: BASIC and PIC
long time since i did stuff like this.. mhh
get the counter-value into the accumulator first, then subtract 1000 from it..
then theres the conditional "jump zero" » counter is 1000
that's the main idea, hope i got you right
|
|
15/04/2009 07:26 AM |
|
feinicks
One day... we Fly...
Posts: 6,124.6050 Threads: 531
Joined: 27th Mar 2008
Reputation: 2.35695
E-Pigs: 210817.3958
|
RE: BASIC and PIC
Wow... I don't even remember what BASIC looks like...
|
|
15/04/2009 08:17 PM |
|
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
|
RE: BASIC and PIC
BASIC? From the looks of the spec shit, you're doing something fairly low level...
|
|
15/04/2009 08:44 PM |
|
PSPkiller
*The Sweaty Indian/Welsh Guy*
Posts: 2,393.2167 Threads: 251
Joined: 24th Jun 2007
Reputation: 0.56947
E-Pigs: 53.7911
|
RE: BASIC and PIC
ZiNgA BuRgA Wrote:BASIC? From the looks of the spec shit, you're doing something fairly low level...
Yes this is low level. To get full marks all wee need to do is include a sequence, a time delay and a counter. It's simple. It's just having to think like the chip thinks while I'm programming it that's difficult. You forget just how simple it is and try and make it do things that it can't do...
Mythos Wrote:get the counter-value into the accumulator first, then subtract 1000 from it..
then theres the conditional "jump zero" » counter is 1000
That's crazy... So crazy it just might work...
* PSPkiller goes and gets his coding hat...
[Insert Signature Here]
|
|
16/04/2009 05:01 AM |
|
dedat
I also poo when hungry.
Posts: 1,319.1315 Threads: 32
Joined: 14th Apr 2007
Reputation: 1.65351
E-Pigs: 3.5147
|
RE: BASIC and PIC
PSPkiller Wrote:* PSPkiller goes and gets his coding hat...
ive lost mine, has anyone seen it?
(This post was last modified: 16/04/2009 05:08 AM by dedat.)
|
|
16/04/2009 05:07 AM |
|
User(s) browsing this thread: 1 Guest(s)