0 Members and 1 Guest are viewing this topic.
There is a small problem I need to clarify. You are saying these programs are run at the same time? Are they run at *precisely* the same time, or not? I am assuming that they are being run from the homescreen, and so there will always be a small difference in time right? One program is inevitably going to start running first, and the only way it can know if there is another calculator connected is to wait for it to send something. There needs to be some way to get out of the loop though, or else it would keep waiting forever if there was no calculator connected. So i propose a different solution:Would it work to have a screen saying "connecting... press clear to abort" or something like that? It would wait for the other person to connect, and when the connection is established, it would run the game or whatever, or if the connection is aborted, quit.
I can't give you a routine, but I can give you a way for the calculators to actually see each other. First of all, pause for a random amount of time (Optional, because as builderboy said, it's highly unlikely they'll be run at the exact same second). Then, check line A of the link port. (Line A and B is just how I'll reference them) if it is set (the other program set it in this case) then just set line B, and then just wait until the first calc resets line A (at which point, reset line B and whoever had calc A is the main calc). If line A is not set when you check it, set it. Wait until the other calc sets B, or abort if it doesn't after a certain amount of time.Now for actual communication, I would suggest using one line as sort of a clock. When line A toggles, you check line B for the actual data. Also, note, that what you read and what you write are essentially inverses of each other. And when I say set, I mean that the line is pulled low. Reset meaning the normal state. Always write a value of 0 to the port before leaving.
Send(1,200)While 1Get->AEndIf A!=-1 Or getKey(15)Send(2,200)If A!=-1Goto 2PLEndGoto 1PL
I don't think so, but you could talk to Kerm about how to implement it yourself On that note, I might try to put together a tutorial on linking if I can figure it out myself...
0->CDisp "WAITING...",i,"PRESS ANY KEY",i,"TO CANCEL",iRepeat C Get->A Send(100,1000 !If A-100 2->C End If getKey 1->C EndEnd!If C-1Goto <FailLabel>EndDisp "SUCCESS!"Goto <PassLabel>