Exact match. Not showing close matches.
PICList
Thread
'[SX] SERIN/OUT Baud Modes Clarification'
2008\07\21@110923
by
rodneymcn/a
|
|
Can someone help me clarify what does the "OPEN" refer to for the baud modes in SERIN/OUT?
I had thought it was "Open Collector" but doesn't seem to be, looking at the asm code.
Here's the difference's in assembly of a subroutine I'm using - taking a quick look, it seems to inverse the data !RA, but I thought that's what the "N" (inverted) was used for...
BAUD = "OTnnnn"
293 0092 0425 CLRB MyOut
294 0093 0C7E MOV __PARAM4,#126
0094 002B
295 0095 02EB DJNZ __PARAM4,@$
0096 0010 0A95
296 0098 0708 MOVB IND.1,__PARAM1.0
0099 0420 0608 0520
297 009C 0200 MOV !RA,IND
009D 0005
298 009E 0503 STC
299 009F 0328 RR __PARAM1
300 00A0 02E9 DJNZ __PARAM2,@$-13
00A1 0010 0A93
301 00A3 0018 BANK $00
293 0092 0018 BANK $00
294 0093 0425 CLRB MyOut
295 0094 0C7E MOV __PARAM4,#126
0095 002B
296 0096 02EB DJNZ __PARAM4,@$
0097 0010 0A96
297 0099 0000 NOP
298 009A 0000 NOP
299 009B 0708 MOVB MyOut,__PARAM1.0
009C 0425 0608 0525
300 009F 0503 STC
301 00A0 0328 RR __PARAM1
302 00A1 02E9 DJNZ __PARAM2,@$-13
00A2 0010 0
Rodney
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=280511
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\07\21@135654 by JonnyMacn/a
|
|
I've added comments to a OTxxxx SEROUT statement that might be helpful.
354 00AC 0C58 MOV __PARAM1,#"X" ; SEROUT RA.0, OT9600, "X"
00AD 0028
355 00AE 0C0A MOV __PARAM2,#10 ; start + 8 bits + stop
00AF 0029
356 00B0 0CFA MOV FSR,#__TRISA ; point to port
00B1 0024
357 00B2 005F MODE $0F
358 00B3 0400 CLRB IND.0
359 00B4 0200 MOV !RA,IND ; make TX an output for start bit
00B5 0005
360 00B6 0405 CLRB RA.0 ; this creates the start
361 00B7 0C02 MOV __PARAM3,#2 ; bit delay
00B8 002A
362 00B9 0C9D MOV __PARAM4,#157
00BA 002B
363 00BB 02EB DJNZ __PARAM4,@$
00BC 0010 0ABB
364 00BE 02EA DJNZ __PARAM3,@$-3
00BF 0010 0ABB
365 00C1 0000 NOP
366 00C2 0000 NOP
367 00C3 0000 NOP
368 00C4 0708 MOVB IND.0,__PARAM1.0 ; grab the bit to send
00C5 0400 0608 0500
369 00C8 0200 MOV !RA,IND ; write it to tris (1 = float, 0 = low)
00C9 0005
370 00CA 0503 STC ; pad stop bit
371 00CB 0328 RR __PARAM1 ; rotate for next bit to send
372 00CC 02E9 DJNZ __PARAM2,@$-21
00CD 0010 0AB7
373 00CF 0018 BANK $00
2008\07\23@101659 by rodneymcn/a
|
|
Thanks so much for the feedback, Jon.
It made me realize I need to not (!) assume with assembler!
I've been using the simulator to see what's happening, but I'm still not sure on how does the SX 'know' that the output port is open collector?
Is it because the output port is initialized as an input, and then it 'outputs' with mov !RA, IND command, instead of using TRIS_A = %0000 where the program starts?
Where all of this is leading is using open collector for MIDI out on the UART VP.
I just can't get my head around this yet! I figure if I can see what Bean is doing with SX/B, I can do the same with the UART VP.
the UART VP has the following code for the output configuration:
rx_pin EQ ra.2 tx_pin EQ ra.3
;...mov ra, #%1011 ;initialze port RA mov !ra,#%0100 ;Set RA's inputs and outputs
I have midiout working using SEROUT, and declaring the Tx pin as a var
MidiOut VAR RA.1 ' midi serial output
Am I making this too complicated?
Many thanks for any feedback!
Rodney, the MIDIot
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=280511#m280875
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\07\23@104256 by JonnyMacn/a
|
|
Unless you override the compiler with an OUTPUT directive in the PIN definition, all ports are initialized as inputs and that state is saved in the shadow registers. The shadow registers get updated by any command that affects them.
Why an open collector output for MIDI? MIDI uses a current loop with optical couplers, so by its construction there is electrical isolation; driving the outputs both directions will not harm a properly-constructed MIDI system.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=280511#m280880
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\07\23@114452 by rodneymcn/a
|
|
Thanks Jon,
I apologize for being in this rut, but as far as open collector, isn't that what "O" is for in the baud mode?
All of the Basic Stamp MIDI code has this as well.
I guess I'm thinking too much again, but wouldn't a current loop require it to be open collector on TX, as the Rx is optically isolated?
I also found several references, here's one noting this:
http://www.harmony-central.com/MIDI/midi-cable.txt
MIDI IN :
1- n.c.
4- anode of optocoupler
2- n.c. <<<--- !!!! Different for MIDI OUT
5- cathode of optocoupler
3- n.c.
MIDI OUT/THRU:
1- n.c.
4- +5v thru resistor
2- local ground
5- TTL open collector output
3- n.c.
Basically, through my experiments, if I specify my TXOut as "output", it freaks out my synth. If I leave as input, and do SEROUT "OT", it works!
It also freaks out when I use the "PIN OUTPUT" reference, but "PIN INPUT" works fine. (e.g. using PIN INPUT, and using SEROUT on the input pin)
Hence, I'm thinking there's something similar going on w/ the UART VP, and can't get my head around the OC thing.
All of my 'commerical' midi devices work great on this synth. I'll post my findings when I get there, but sounds like you're already successful with this, which leads me to think I'm heading down a wrong path... which isn't so bad, as long as I'm having fun and have great interaction w/ the forum members!
Your (and anyone else's) input is much appreciated!
Thanks!
Rodney
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=280511#m280899
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\07\23@123642 by JonnyMacn/a
|
|
Forgive me, I haven't experimented with MIDI output for a long time and having just gone back to look at old experiments find that they are indeed using "Open" baud mode.
Yes, the "O" is for Open, it's the next letter that counts. For MIDI using high-level SEROUT you need to specify a baud parameter of OT31250; the T indicates True mode where the idle state of the line is 1 (which is usually pulled up in Open mode), this is akin to Open-Collector (though it's actually called Open-Source in the SX due to the construction of the IO pin).
It might be helpful if you posted your entire program -- sometimes working with fragments can put the rest of us at a serious disadvantage.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=280511#m280913
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\07\23@125647 by rodneymcn/a
|
|
Thanks Jon,
Another point to this is that I'm not using the two inverters/buffers on the MIDI spec for the TxOut (the latter one is a 75LS05, which is open collector), as I'm assuming that the SX can be used w/o them... I'm reducing parts, but I need to experiment a bit more, as that could be part of my problem...
I think I know where to go from here - I will definately provide feedback...
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=280511#m280919
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
|
|
You don't need the inverters. You'll typically see those in circuits on the downstream side of the opto -- this allows the MIDI THRU output to sink enough current for a zero bit, and takes the load of the serial input to the local host. Now, if you're going to create a device that uses MIDI in and not buffer the data through the processor then you should use the inverters. I get the idea, though, that your SX is the MIDI master which means you can connect to the MIDI line directly. Keep in mind that when the MIDI output pin is active (low) it will be sinking about 20 mA (well within SX limits).
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=280511#m280930
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\07\23@214221 by rodneymcn/a
|
|
I'm hoping I won't need them, too!
Can you help me understand what you mean by?
Now, if you're going to create a device that uses MIDI in and not buffer the data through the processor then you should use the inverters.
Isn't this referring to two different types of buffers? I consider the inverters a buffer to protect the processor data lines - (e.g. for appropriately sinking/sourcing the current, or enabling OC on a uart/processor pin that doesn't have it), whereas buffering the data through the processor is temporarily storing the data, until it can be appropriately used (as in the Rx UART VP).
Keep in mind that when the MIDI output pin is active (low) it will be sinking about 20 mA (well within SX limits).
Wouldn't a 5mA current loop be 5mA no matter what? Looking at the schematic from Midi out to Midi in, you have 5v supply, a 220 ohm resister, a diode voltage drop (opto coupler - assume 0.7v), and two more 220 ohm resistors. This would be 4.3V/660 ohms = 6.5mA, unless I'm missing something...
My project will eventually use both Midi TX and RX - something like an simple arpeggiator initially.
I'm focusing on the Midi TX part (using the VP). The Rx you have already done for us (many thanks for that!)
Sorry for stretching this thread out beyond its initial context, and again appreciate the help!
Rodney
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=280511#m281011
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\07\23@233053 by JonnyMacn/a
|
|
What I meant by buffering is receiving a byte in and then retransmitting it -- a software buffer, so to speak. You might want to do this to interleave you messages in stream coming in if that's required (I think this process is called store-and-forward).
My mistake on the MIDI loop current; sorry, it is much less than 20 mA (I calculate 7.9 mA).
To be candid, I think this thread has become somewhat long-winded because you present everything in fragments, not allowing the rest of us to see the whole picture -- that makes things tough....
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=280511#m281017
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\07\24@054137 by rodneymcn/a
|
|
I too, cringe at my thread - I wish I could break it out... In my cluttered mind, I had a direction I was trying to head, and had a few right angle turns in there, but will learn next time. I was trying to see if there was a logical explaination w/o pushing too much code, as I just wanted some help on the "Open Collector" concept, rather than an entire working program right now.
Thanks!
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=280511#m281053
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
More... (looser matching)
- Last day of these posts
- In 2008
, 2009 only
- Today
- New search...