[Featured][Alpha] CLAP - TI Link - http://clap.timendus.com

Here you can find side projects of the staff and great projects which we think should get extra support. (Note that featured projects are not projects by staff members of MaxCoderz)

Moderator: MaxCoderz Staff

User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Well, that's pretty much the idea of networking ;) Enabling calculators to send data to a specific other calculator. Only difference is that I don't plan on having them alternate every bit, but every stream. So calculator one can send a stream of bytes specifically to calculator two, and when it's done calculator three can send a stream to calculator four.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
Saibot84
New Member
Posts: 38
Joined: Fri 17 Feb, 2006 9:14 pm
Location: Jersey City, NJ

Post by Saibot84 »

sorr to double-post... but my previous message was written in a hurry before rushing off to class... What I was proposing is the following:
We have 4 calculators on the network. Usually if calc 1 is sending/receiving bytes to/from calc 2, calcs 3 and 4 have to sit idly by, waiting to be able to communicate. Let's say that calc 1 needs to send bytes $80, $40, $20, $10 to calc 2 and that calc 3 needs to send $80, $40, $10, $20... calc 1's bytes (in binary) are
%1000 0000, %0100 0000, %0010 0000, %0001 0000
and calc 3's bytes are
%1000 0000, %0100 0000, %0001 0000, %0010 0000 ... so we alternate between the two calcs when sending the bits... and the total communication on the network becomes:
%11000000 00000000 00110000 00000000 00001001 00000000 00000110 00000000
or $C0 00 30 00 09 00 06 00
(I alternated between reading a bit from calc 1's data, and calc 3's data)

I'm not sure if this is better than just having calc 3 wait to send its bytes as soon as calc 1 is done, but it will at least balance the load so that no calc is waiting (doing nothing) while only two calcs on the network are communicating... I know I like it how Firefox actually shows you pictures while they're still being downloaded as opposed to IE not showing you a picture until it's been fully DLed... same thing but for the calcs... I think it'd be better for the calcs to be "doing something" (such as communicating at a slower speed) than for the communication on the network to be queued (since we would then also need a queue manager, wouldn't we)

I hope I made some sort of sense...
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

I see your point of view, but I disagree. The idea is that all calculators will be running an interrupt routine that blocks the calculator as soon as it starts receiving something. Because of this, we can "lock" all calculators in their roles:

Calc 1 starts sending, which disables interrupts
Calc 2 starts receiving, which blocks normal operation (so it can't start sending)
Calc 3 starts listening (but ignoring the data), which also blocks
Calc 4 starts listening (but ignoring the data), which also blocks

So at all times when data is sent, we have guaranteed that we have only one sender, which is crucial for proper transfer. It would be possible to implement your idea, but it would be far from functional because of the above structure. I'd have to make a sort of hybrid between sending and receiving because all sending calculators can also be listening to other data streams. Also, it would require a lot of negotiating between senders (what if all four calculators want to send data? Do you plan to multiplex that too? Who'd be receiving then?) which only ADDS more delay.

Finally, your reason for suggesting this isn't valid either because of the above structure. All calculators are locked in their roles as long as there is data being sent on the network, so all four calculators will have to wait untill ALL data is sent, not just the data that's meant for them.

In short: it'll just make the software more complex (larger) and the network slower, without actually adding anything positive. The only way it could work is if we treat the interrupt routine as a seperate thread that handles incoming data without blocking the program, but the data transfer speed would have to be significantly slower then, and you'd get all sorts of annoying locks. Plus most applications will not start to process the data as long as it hasn't been received entirely, so again it wouldn't add anything.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
KermMartian
Calc Wizard
Posts: 549
Joined: Tue 05 Jul, 2005 11:28 pm
Contact:

Post by KermMartian »

Just to back Timendus and his correctness up, it's precisely the way the interrupt send/rec routine in Cn2 works as well.
Image Image Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

But as we know Ben can make his calc multithread so.. What if you let sending/receiving run together with some main program? If so don't forget to let it set a flag somewhere that teh data is being changed and thus should be not be used/changed etc etc..
If this would be my idea then it would be bad, but it actually isn't so it might even work... (although a little slower for each calc, it might be faster overall since you would not have to lock calcs that have nothing to do with a certain transfer)
User avatar
KermMartian
Calc Wizard
Posts: 549
Joined: Tue 05 Jul, 2005 11:28 pm
Contact:

Post by KermMartian »

But look, there's only one linkport, and no way to distinguish one of the network "layers" from the other without listening to packets and looking for some kind of identifier. As Timendus said, this takes many additional clock cycles, and is therefore impractical. There's no real point to trying to isolate different streams of data between the same two nodes on the same network.
Image Image Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

well 84's have 2 ports, but it doesnt really matter since it would be completely impractical and slow so..
but if someone would make some program that would be like BASIC's GetCalc( with the difference that it will work when the other calculator is in a loop then Im sure I could make 84's network. I allready tried it but ofcourse it didnt work since those bloody calcs dont respond to silent link when they're busy.
User avatar
KermMartian
Calc Wizard
Posts: 549
Joined: Tue 05 Jul, 2005 11:28 pm
Contact:

Post by KermMartian »

Umm, mainly because GetCalc() only works between two calcs, not multiples.
Image Image Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

does, it takes 2 arguments of which 1 optional, the second is which link port you would want to use, so it could be connected to 2 other calcs.
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

King Harold wrote:But as we know Ben can make his calc multithread so.. What if you let sending/receiving run together with some main program?

Ben's "multithreading" is realized through interrupts, so all of the above applies. To explain it in a more understandeable way: you have two programs both running half the time. If one of your programs is communicating with another calculator, it'd miss half of the bits it receives. Or, since the other calculator is also running it's link software half the time, they could miss each other all the time and they'd receive nothing.

it might be faster overall since you would not have to lock calcs that have nothing to do with a certain transfer

You're theoretically correct here, but it's pretty much impossible, as explained above. Also, you're talking about the speed of execution, where we are talking about the transferspeed, which would be much lower than in my solution. Now I think of it, execution speed would also get worse as you'd only have half the CPU time, compared to 99% CPU time if you're not receiving anything in my solution. The only thing you'd improve is the reliability of the execution speed, which can drop to 0% on reception versus the same 50% in your idea...

About chaining Ti-84s, like I said that is not one of my goals. I don't have one, don't know anything about the USB port, don't want to get into routing, and want to stay compatible with calculators without a USB port.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
KermMartian
Calc Wizard
Posts: 549
Joined: Tue 05 Jul, 2005 11:28 pm
Contact:

Post by KermMartian »

Slightly offtopic, but it turns out I may have had incorrect equates. Have I massively confused myself here?

Code: Select all

SendCLDL      .equ   $D0
SendCHDL      .equ   $D1
SendCLDH      .equ   $D2
SendCHDH      .equ   $D3

ClockMask      .equ   $01
ClockHigh      .equ   $00
ClockLow      .equ   $01

DataMask      .equ   $02
DataHigh      .equ   $00
DataLow         .equ   $02

LinkMask      .equ    $03
GetCLDL         .equ   $03
GetCHDL         .equ   $02
GetCLDH         .equ   $01
GetCHDH         .equ   $00
(Not a topic hijack, btw, just thought getting this straightened out once and for all might help anyone trying to do link stuff)
Image Image Image
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Which calculator are we talking about, why don't you check the Wiki or the CLAP source, and I was under the impression that I had "straightened that out" four years ago :)
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
KermMartian
Calc Wizard
Posts: 549
Joined: Tue 05 Jul, 2005 11:28 pm
Contact:

Post by KermMartian »

I was using $04 and $08 for data and clock read values, respectively, but then I tried outputting the link port read value to the screen and bits 0 and 1 were getting set. I'll take a look at the wiki.

Edit: oh, and I refuse to look at the CLAP source in case I accidentally see code to give me ideas.

Edit#2: Got it all straight now. Ty.
Image Image Image
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Not to be childish or anything, but I was under the impression that you've been coding link related things for ages..? At least that's what you've made us all to believe. Seems a bit odd that you don't have a bit of source of a few defines lying around from previous projects...
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
KermMartian
Calc Wizard
Posts: 549
Joined: Tue 05 Jul, 2005 11:28 pm
Contact:

Post by KermMartian »

Yeah, and I was coding them on the TI-83, which used the D0...D3 values, which didn't seem to be working on the 83+. Now I know why.
Image Image Image
Post Reply