Author |
Message |
|
Foxman
Newbie
Joined: 06 May 2009 Posts: 12
|
Posted: 06 May 2009 01:29:50 am Post subject: |
|
|
hey I have a TI 84+ and I took up a project that's probably way over my head ,
I need to find a way to send one byte of data over the I/0 port. The problem is when I try to send the byte via serial cable to a PCB, the ring and the tip stay at a 3.2v charge but won't change. what values do I need to use with the "out (0), a" command? I've tried everything I can find online. Thanks for your help! :biggrin:
Last edited by Guest on 06 May 2009 01:30:59 am; edited 1 time in total |
|
Back to top |
|
|
darkstone knight
Advanced Member
Joined: 07 Sep 2008 Posts: 438
|
Posted: 06 May 2009 04:13:57 am Post subject: |
|
|
sending something will cause the linkport to go high/low (send %10101010 or %01010101 to be sure it goes high) very shortly
like 1/6.000.000 seconds, you cant see that using a multimeter...
probably, anyway... |
|
Back to top |
|
|
benryves
Active Member
Joined: 23 Feb 2006 Posts: 564
|
Posted: 06 May 2009 05:24:32 am Post subject: |
|
|
The two least-significant bits of the value output to the link port set the state of the lines. They are open-collector. ld a,3 \ out (bport),a will short both lines to ground, ld a,0 \ out (bport),a will release both lines to float high again.
The TI-OS provides routines like SendAByte to handle the complexities of data transfer for you. |
|
Back to top |
|
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 06 May 2009 10:04:01 am Post subject: |
|
|
Is it possible that interrupts are...interrupting the process by trying to silent-link? |
|
Back to top |
|
|
FloppusMaximus
Advanced Member
Joined: 22 Aug 2008 Posts: 472
|
Posted: 06 May 2009 11:26:56 pm Post subject: |
|
|
Interrupts might be interfering with it. You should also be sure that you have disabled the hardware link assist, as that will override anything you do with port 0. |
|
Back to top |
|
|
Foxman
Newbie
Joined: 06 May 2009 Posts: 12
|
Posted: 07 May 2009 05:27:09 pm Post subject: |
|
|
Thanks for your fast replies, Here's the values I've used so far:
----Port (0)----
192 $c0 both lines are hot
252 $FC both lines are hot
212 $D4 both lines are hot
232 $E8 both lines are hot
0 $0 both lines are hot
1 $1 CRASH
2 $2 CRASH
3 $3
4 $4
208 $D0 both lines are hot
209 $D1
210 $D2
211 $D3 CRASH
I'm not sure what's going on, no change in the output except for the occasional crash, and how would I turn the interrupts off? thanks for your input |
|
Back to top |
|
|
calc84maniac
Elite
Joined: 22 Jan 2007 Posts: 770
|
|
Back to top |
|
|
Foxman
Newbie
Joined: 06 May 2009 Posts: 12
|
Posted: 07 May 2009 05:54:29 pm Post subject: |
|
|
calc84maniac wrote:
I have this link bookmarked but it fails to explain why my calc crashes when I set b0 or b1? |
|
Back to top |
|
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 07 May 2009 07:43:39 pm Post subject: |
|
|
Code: DI; Disables interrupts
EI; Enables interrupts
With only 3.2V to show for it, this serial link is drawing too much current for the calc to recognize the port as idle. My calc usually gets 5.7V in that state and any load under 10kOhms makes it crash faster than a drunk out a of bar. I'd disable that cable.
Last edited by Guest on 07 May 2009 07:43:59 pm; edited 1 time in total |
|
Back to top |
|
|
Foxman
Newbie
Joined: 06 May 2009 Posts: 12
|
Posted: 08 May 2009 12:50:54 am Post subject: |
|
|
I don't see why it's only giving off 3.2v the cable isn't plugged into anything, it's set up as ring to pin 2, tip is set to pin 3, and ground is pin 5. there isn't any power draw from it except from the voltmeter? :hmpf:
thanks for the answer about the intercepts I'm going to give that a try. |
|
Back to top |
|
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 08 May 2009 09:23:28 am Post subject: |
|
|
What kind of cable is it? |
|
Back to top |
|
|
Foxman
Newbie
Joined: 06 May 2009 Posts: 12
|
Posted: 08 May 2009 11:01:57 am Post subject: |
|
|
RS-232 serial cable, but it's custom made for this PCB I'm working with |
|
Back to top |
|
|
Foxman
Newbie
Joined: 06 May 2009 Posts: 12
|
Posted: 08 May 2009 12:01:07 pm Post subject: |
|
|
I'm not getting many results, I tried a different cable and got the same voltage out put of 3.2v. I also changed the program to disable Interrupts and then enable them after it sends the byte. I did give the bcall(_sendabyte) a try but only get a consistent pulse on the scope. for some reason I can't get anything to send a byte of data in binary :|
*Edit: I'm starting to think it's my calc, I tired doing the same thing in basic and got a consistent pulse with no change in respect to the byte I'm trying to send. I'll just have to make the program using C++ on the computer. thanks for the help
Last edited by Guest on 08 May 2009 12:23:21 pm; edited 1 time in total |
|
Back to top |
|
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 08 May 2009 12:41:50 pm Post subject: |
|
|
I'd re-check it using the out (bport),a method. It don't know if bcall(_sendabyte) does this, but some programs won't proceed with the remaining bits until it gets a response. (And every bit needs a response). With interrupts off, your out commands will operate without that limitation.
Last edited by Guest on 08 May 2009 12:42:43 pm; edited 1 time in total |
|
Back to top |
|
|
FloppusMaximus
Advanced Member
Joined: 22 Aug 2008 Posts: 472
|
Posted: 08 May 2009 01:01:03 pm Post subject: |
|
|
Sorry if I'm stating the obvious here, but I'm still not quite sure what you're trying to do. Are you familiar with how the low-level DBUS link protocol works? Basically, to send a bit, you pull one of the two data lines low, then wait for the other device to acknowledge the bit (which it does by pulling the other line low.) Then you release your line, and wait for the other device to release its line before sending the next bit.
This is the protocol that is implemented by the SendAByte and RecAByteIO routines. So SendAByte and RecAByteIO will only work if the device you're trying to communicate with is also using that protocol. If the device you're talking to uses some other wire protocol, such as RS-232, you need to write your own code (and in many cases, you also need some special hardware to translate the voltage levels.)
(Note that if you're using a BlackLink- or GrayLink-compatible serial cable, the calculator is not speaking RS-232. In the case of the BlackLink, the data lines are controlled by the PC using the serial port status lines, and the PC itself implements the DBUS link protocol. In the case of the GrayLink, the internal hardware translates between RS-232 on the PC side, and the DBUS protocol on the calculator side.) |
|
Back to top |
|
|
Foxman
Newbie
Joined: 06 May 2009 Posts: 12
|
Posted: 08 May 2009 04:56:46 pm Post subject: |
|
|
As you can tell I"m still a bit new to calc ASM but the board I'm trying to communicate with is using the serial protocol where the sending pin of the calc starts low and then sends the byte then ends with a high bit, and vice verse for receiving. if that makes any sense?
*Edit: I'll see if I can get the code up soon, it's on another computer
Last edited by Guest on 10 May 2009 02:33:00 am; edited 1 time in total |
|
Back to top |
|
|
Foxman
Newbie
Joined: 06 May 2009 Posts: 12
|
Posted: 11 May 2009 01:03:49 am Post subject: |
|
|
Code: .nolist
#include "ti83plus.inc"
data .EQU AppBackUpScreen
data2 .EQU AppBackUpScreen+2
_homeup .EQU 4558h
.list
.org $9D95 - 2
.db t2ByteTok, tAsmCmp
start:
LD A, 0
LD (data), A
LD (data2), A
bcall(_RunIndicOff)
LD H, 0
LD L, 0
AA:
bcall($4540)
JP Display
AB:
bcall(_getkey)
CP 3
JP z, Keyup
CP 4
JP z, KeyDown
CP 9
JP z, exit
CP 0
JP z, exit
CP 191
JP z, send
JP AB
Keyup:
LD HL, (data)
PUSH HL
bcall($4540)
POP HL
LD H, 0
LD A, L
CP 255
JP z, AB
Inc HL
JP Display
KeyDown:
LD HL, (data)
PUSH HL
bcall($4540)
POP HL
LD H, 0
LD A, L
CP 0
JP z, AB
Dec HL
JR Display
Display:
LD (data), HL
PUSH HL
LD HL, 1*256+1
LD (CurRow), HL
LD HL, message1
bcall(_PutS)
LD HL, 1*256+2
LD (CurRow), HL
LD HL, message2
bcall(_PutS)
LD HL, 1*256+3
LD (CurRow), HL
LD HL, message3
bcall(_PutS)
LD HL, 1*256+4
LD (CurRow), HL
LD HL, message4
bcall(_PutS)
bcall(_NewLine)
LD HL, 5*256+6
LD (CurRow), HL
POP HL
LD D, H
LD E, L
PUSH DE
bcall(_DispHL)
POP HL
JP AB
;sending
Write:
LD HL, (data)
LD A, L
DI
LD c,a
LD d,1
LD e,0
set 1,e
LD a, e
out (0), a
send_byte:
LD a,c
and d
or a
JP nz,reset_ring
JP z,Set_ring
set:
rlc d
LD a,e
out (0),a
LD e,0
LD a,d
cp 1
jr nz,send_byte
res 1,e
LD a, e
out (0), a
EI
JP sent
Set_ring:
res 1,e
JP set
reset_ring:
set 1,e
JP set
send:
JP Write
sent:
LD HL, 3*256+7
LD (CurRow), HL
LD HL, message5
bcall(_PutS)
LD A, (data2)
CP 0
JP Z, AB
INC A
LD (data2), A
bcall(_getkey)
bcall($4540)
JP AA
exit:
bcall($4540)
bcall(_homeup)
RET
message1:
.db "Enter a Number", 0
message2:
.db "between 0 - 255", 0
message3:
.db "or use the up", 0
message4:
.db "and down keys", 0
message5:
.db "Data sent", 0
.end
END
Alright here's the code, I know there's a few things that need a touch up but getting it to work is the most important thing right now. |
|
Back to top |
|
|
FloppusMaximus
Advanced Member
Joined: 22 Aug 2008 Posts: 472
|
Posted: 11 May 2009 01:09:51 pm Post subject: |
|
|
Well, if you're trying to send serial data like that, the device you're communicating with probably expects to get that data at some particular speed. You need to tune the loop so that the bits, including the start and stop bits, are sent at the correct rate. (That also means you need to be sure that the loop will take the same amount of time for every bit, so you need to eliminate those conditional jumps or add delays to compensate for them.)
With that code, at 6 MHz, you're running between 58 and 65 kpbs. At 15 MHz, you're running between 146 and 161 kbps. |
|
Back to top |
|
|
Foxman
Newbie
Joined: 06 May 2009 Posts: 12
|
Posted: 11 May 2009 02:37:23 pm Post subject: |
|
|
good information, I was going to add the delays as soon as the calc could send one byte, I'm using a scope to read all out put and the out put is always the same. that's the biggest thing I"m trying to work out right now.
*Edit: Woot! it works now, just needed to adjust the levels on the scope, and now the program has all of the delays it needs. THANKS so much for your input! :biggrin:
Last edited by Guest on 11 May 2009 05:13:57 pm; edited 1 time in total |
|
Back to top |
|
|
|