Installer Steam
connexion
|
langue
简体中文 (chinois simplifié)
繁體中文 (chinois traditionnel)
日本語 (japonais)
한국어 (coréen)
ไทย (thaï)
Български (bulgare)
Čeština (tchèque)
Dansk (danois)
Deutsch (allemand)
English (anglais)
Español - España (espagnol castillan)
Español - Latinoamérica (espagnol d'Amérique latine)
Ελληνικά (grec)
Italiano (italien)
Bahasa Indonesia (indonésien)
Magyar (hongrois)
Nederlands (néerlandais)
Norsk (norvégien)
Polski (polonais)
Português (portugais du Portugal)
Português - Brasil (portugais du Brésil)
Română (roumain)
Русский (russe)
Suomi (finnois)
Svenska (suédois)
Türkçe (turc)
Tiếng Việt (vietnamien)
Українська (ukrainien)
Signaler un problème de traduction
While you're waiting for x0, there's no way to know if x1-x2-x3 are trying to transmit something.
there are a couples of tricks you can use when you really need to listen to multiples chips:
1: Link everything to the same xbus (the 2 small chips are both linked to x0 of the big one),
that way you can slx x0, and still wait for one of the chip to transmit. the downside, is that if both chips are transmitting, you only get one value (randomly chosen) and the other will be stuck on "write", so that method is good if only one chip at the time will send signals, and you have no idea which one will.
2: if you're sure that both chips will always transmit at the same time, you could
slx x0
doStuff with x0
slx x1
doStuff with x1
since both chips are transmitting at the same time, everything will happen in the same cycle.
Those method can also be combined, link everything to x0 and just
slx x0
do stuff with first value
slx x0
do stuff with 2nd value
Now, onto your solution, there are a bunch of errors:
never use "slp 1" as first line of code unless specifically requested. By sleeping first, you are skipping the entire 1st cycle, than start performing operation on the 2nd one.
First do your stuff, than sleep to the next cycle (almost always slp will be the last command). On the other hand, slx is almost always used as 1st line, since the chip cycle starts only when it gets called.
probably just a typo, but "point" chip teq p0 100 and if true sends 1 to the big chip. Big chip will test if received value is equal to 100 instead of 1, so it will always be false.
"Foul" chip will send -1, but instructions say that a foul is worth -2.
a chip can easily be connected to multiple ports, check one, perform actions, check 2 perform action, and so on till it goes to sleep. No need of using one chip for every single input/output. Sometime if every input/output can be connected to a single chip, that chip could handle the entire system by itself.
the code i wrote is just to explain how slx could work with multiples ports.
in both examples, if you already know that data is coming from a port you don't have to slx twice to read them.
slx x0
doStuff x0
doStuff x1
also, if you need more than 2 xbus but not that many lines of code, the MC4000X is a better choice than the 6000, smaller and equipped with xbus only
Each round check if either one of them has an action required, then do a little nap and do it again next round.
Sure you'll have to power a full cycle when there's nothing to do, but seems efficient enough*.
*I guess you could also have one small chip that listens to both and all it does is send a wakeup to the big chip, I have my doubts you'll get much power efficiency.
After 3 days of trying to do it with 2 small chips and 1 big, I was able to do it in 10 lines of code!
Maybe I'll be able to optimize it to save at least 1 line so that I could fit it on an MC4k....
Thanks you two!!
<3