Author Topic: How use the port commands ?  (Read 8615 times)

0 Members and 1 Guest are viewing this topic.

Offline zero44

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 128
  • Rating: +21/-0
  • <!--//www.ustr.net/infrared/infrared1.shtml-->
    • View Profile
    • zero44
How use the port commands ?
« on: April 19, 2011, 03:36:37 pm »
Hello,

In my sig you can see a coffee maker project, and I need calc's port.

I've questions:
• in command Port( , what are the three statuses ?
• how does the Send( and Get( command works ?
• how many bits ( not bytes ! ) can receive my calc in a second ? (TI 83+)

• How many milliseconds will it take to receive a 48*64 image with 4 level grayscale ? (384bytes*2pics, I think )
« Last Edit: April 19, 2011, 03:36:54 pm by zero44 »
____________

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: How use the port commands ?
« Reply #1 on: April 19, 2011, 07:21:16 pm »
that... all depends... okay.  Where to start.

The I/O port is made up of three wires.  One is ground, then there is the ring and the tip.  That gives two lines that we can mess with.  They are dealt with via pull-up resistors.  You deal with it in ASM via port 0.  In axe, you use the Port command or Get( and send(.  Read the documentation on the Port command, but that is basically dealing with those lines directly.  Remember that reading is opposite from writing here.

Depending on the protocol here, is where your different speeds come in.  I'm not sure how Axe does it.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: How use the port commands ?
« Reply #2 on: April 19, 2011, 07:41:31 pm »
I'll answer the last two more directly:

Quote
how many bits ( not bytes ! ) can receive my calc in a second ? (TI 83+)

Somewhere between 8 and 32 Kib per second maximum. It depends on the precise networking protocols and what else the processor is doing.

Quote
How many milliseconds will it take to receive a 48*64 image with 4 level grayscale ? (384bytes*2pics, I think )

What networking protocol are you using? You're definitely not going to get that picture in under about 230 milliseconds at the absolute best. At worst (assuming you're doing nothing but handling the serial port), you'll get the picture in about a tenth of a second.
« Last Edit: April 19, 2011, 07:41:54 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: How use the port commands ?
« Reply #3 on: April 19, 2011, 08:37:49 pm »
Are you planning on having it linked to external hardware somewhere? I mean, for this simple of a concept (Coffee Control) the HTCPCP only has, what, 6 or 7 meaningful commands? you need something special hardware-wise to link it to the internet anyways, so why not have the calc send and recieve simpler signals?

Just a thought.

Offline zero44

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 128
  • Rating: +21/-0
  • <!--//www.ustr.net/infrared/infrared1.shtml-->
    • View Profile
    • zero44
Re: How use the port commands ?
« Reply #4 on: April 22, 2011, 08:01:31 am »
I made a test program :

ClrDrawDrawInvDispGraph
[00->Pic1
for(A,0,999
for(B,0,999
Get->{Pic1}
End:End
ClrDrawDispGraph

If Get return one byte, my program will return 1,000,000 bytes, also 1Mb.
With this test, I can have 1Mb in 48seconds.
So 48µs for one byte. I think it's fast...
With this I could have a 4gray 64*48 13FPS video !!!
I must had make a mistake...
____________

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: How use the port commands ?
« Reply #5 on: April 22, 2011, 04:19:45 pm »
"Get" checks if a byte is trying to be sent first so it doesn't do the routine if there isn't.  Your test isn't actually reading anything so nothing is transferring which is why it appears so fast.  The last time I tested the speed, I was able to transfer the entire graph buffer in about 1.5 seconds I think, so that's somewhere near 500 bytes per second.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline zero44

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 128
  • Rating: +21/-0
  • <!--//www.ustr.net/infrared/infrared1.shtml-->
    • View Profile
    • zero44
Re: How use the port commands ?
« Reply #6 on: April 23, 2011, 07:59:56 am »
I'm not sure I understand all ...
How can I receive a byte ?
____________

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: How use the port commands ?
« Reply #7 on: April 23, 2011, 12:03:34 pm »
I'm not sure I understand all ...
How can I receive a byte ?
Well, with an arduino, you'd have to have it confirm a byte.  If I had a secondary calculator, I could log the data going from one to another.  Unfortunately I don't, so Quigibo will have to tell about his routine. (Or I guess I could disassemble it)

Offline zero44

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 128
  • Rating: +21/-0
  • <!--//www.ustr.net/infrared/infrared1.shtml-->
    • View Profile
    • zero44
Re: How use the port commands ?
« Reply #8 on: April 28, 2011, 04:01:21 pm »
With a LED I found in my room, I found what are the port statuses :
Spoiler For pins:

pins : ground, 1, 2
status :pin 1pin 2
011
110
201
300

With this I made a very big prgm : It switches the LED on and off and on ... ;D
____________

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: How use the port commands ?
« Reply #9 on: April 28, 2011, 10:24:57 pm »
Hey, that way you can understand the link port better.  Yes, although remember that reading is the opposite from writing.  ie, write 0 and read 3, write 1, and read 2, write 2 and read 1, write 3 and read 0.

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: How use the port commands ?
« Reply #10 on: April 28, 2011, 10:29:51 pm »
Hey, that way you can understand the link port better.  Yes, although remember that reading is the opposite from writing.  ie, write 0 and read 3, write 1, and read 2, write 2 and read 1, write 3 and read 0.

Say that in English please
This used to contain a signature.

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: How use the port commands ?
« Reply #11 on: April 28, 2011, 10:44:03 pm »
Hey, that way you can understand the link port better.  Yes, although remember that reading is the opposite from writing.  ie, write 0 and read 3, write 1, and read 2, write 2 and read 1, write 3 and read 0.

Say that in English please
It is in english... If you would like for me to describe it better, then that I can do. :D  Okay, so you know you write a variable by saying #->port, right? So 3->port.  To read it, you do port->X.  So if you wrote 3 to port and then did port->X, X would hold the value 0.

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: How use the port commands ?
« Reply #12 on: April 29, 2011, 08:45:56 am »
Hey, that way you can understand the link port better.  Yes, although remember that reading is the opposite from writing.  ie, write 0 and read 3, write 1, and read 2, write 2 and read 1, write 3 and read 0.


Say that in English please
It is in english... If you would like for me to describe it better, then that I can do. :D  Okay, so you know you write a variable by saying #->port, right? So 3->port.  To read it, you do port->X.  So if you wrote 3 to port and then did port->X, X would hold the value 0.



ok that makes alot more sense to me
« Last Edit: April 29, 2011, 08:47:19 am by annoyingorange »
This used to contain a signature.

Offline zero44

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 128
  • Rating: +21/-0
  • <!--//www.ustr.net/infrared/infrared1.shtml-->
    • View Profile
    • zero44
Re: How use the port commands ?
« Reply #13 on: May 07, 2011, 02:58:28 pm »
Does Port return the opposite of the port status of 1st calc or the port status of a 2nd calc ?
____________

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: How use the port commands ?
« Reply #14 on: May 07, 2011, 04:03:55 pm »
neither. It reports the opposite of the written lines. Okay, picture it this way.  You have two calcs connected by two wires.  The wires can be pulled low.  If you write a 2 to the port, it'll bring one of the lines low, and the other will remain high.  If you were to then read the status from either calc, it'll make it look like the wrong line was pulled low, but in actuality, it wasn't.  So after one calc writes 2, both calcs will read 1 as long as the other calc didn't mess with it.

To explain a slight quirk with the lines (technically, this is how it's supposed to work) If you have two calcs connected, A and B, and A pulls line 1 low, and B pulls line 2 low, A can't write that line 2 should go back up, only B can.  Likewise, B can't say that line 1 should stop being low, only A can.  It's confusing, I know.