SHENZHEN I/O

SHENZHEN I/O

データを表示:
slx multiple XBus ports?
I I'm guessing there's probably a more efficient way of doing things, but I'm using to MC4ks outputting XBus to 1 MC6k. I can't figure out the slx command to test more than one XBus port.
https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=3076727707

Thanks
< >
1-4 / 4 のコメントを表示
mala 2023年11月9日 1時22分 
there's no command that allows you to sleep waiting for multiples port at the same time.
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.
mala 2023年11月9日 6時20分 
small addon:
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
最近の変更はmalaが行いました; 2023年11月9日 6時24分
Not sure if it's a space issue for you, but why not just connect both "point" and "foul" to the analog ports on the big chip?

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.
最近の変更はthewifiwhispererが行いました; 2023年11月10日 12時15分
Laserbeak43 2023年11月11日 13時12分 
Holy Moly!
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
< >
1-4 / 4 のコメントを表示
ページ毎: 1530 50