Post Reply 
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
Offline
Post: #1
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
Find all posts by this user Quote this message in a reply
Mc Cabe
Storm Trooper

Posts: 1,218.1771
Threads: 177
Joined: 14th Aug 2007
Reputation: 1.43435
E-Pigs: 38.5281
Offline
Post: #2
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
Visit this user's website Find all posts by this user Quote this message in a reply
Mythos
protoman

Posts: 573.1637
Threads: 31
Joined: 18th Apr 2007
Reputation: -1.8373
E-Pigs: 24.3694
Offline
Post: #3
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

[Image: Mythos3k.png]
15/04/2009 07:26 AM
Visit this user's website Find all posts by this user Quote this message in a reply
feinicks
One day... we Fly...

Posts: 6,124.6050
Threads: 531
Joined: 27th Mar 2008
Reputation: 2.35695
E-Pigs: 210817.3958
Offline
Post: #4
RE: BASIC  and  PIC
Wow... I don't even remember what BASIC looks like...

◄◄••• 天使たちの夢か? •••►►

[Image: ewualizer.gif]
My works!
15/04/2009 08:17 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA
Smart Alternative

Posts: 17,023.4213
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.0333
Offline
Post: #5
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
Visit this user's website Find all posts by this user Quote this message in a reply
PSPkiller
*The Sweaty Indian/Welsh Guy*

Posts: 2,393.2167
Threads: 251
Joined: 24th Jun 2007
Reputation: 0.56947
E-Pigs: 53.7911
Offline
Post: #6
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
Find all posts by this user Quote this message in a reply
dedat
I also poo when hungry.

Posts: 1,319.1315
Threads: 32
Joined: 14th Apr 2007
Reputation: 1.65351
E-Pigs: 3.5147
Offline
Post: #7
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
Find all posts by this user Quote this message in a reply
boogschd
boogyman
Worlds End

Posts: 4,954.3196
Threads: 90
Joined: 29th Nov 2007
Reputation: 4.19708
E-Pigs: 43.6852
Offline
Post: #8
RE: BASIC  and  PIC
dedat Wrote:
PSPkiller Wrote:* PSPkiller goes and gets his coding hat...

ive lost mine, has anyone seen it?

i haz it ... shi- doesn't work for me >:(
16/04/2009 06:28 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

 Quick Theme: