Revisiting I/O Pins and Baud Rate: OT
Yendor
Posts: 288
I wanted do look more at the assembly code for the I/O pins from my post
"Delay, PIN Command, BaudRate Options & SX-Key Listing Feature Request" at http://forums.parallax.com/showthread.php?p=607062
That one got a little complicated, so I wanted to narrow down a couple of questions and try again, since I've had a chance to investigate a little more.
1.· Revisiting the PIN command
2.· Revisiting·the difference betwen the T and the OT baud modes in the baud rate for SERIN/SEROUT, does the O refer to "Open Collector"?
Thanks!
Rodney
Post Edited (Yendor) : 10/7/2006 6:57:07 AM GMT
"Delay, PIN Command, BaudRate Options & SX-Key Listing Feature Request" at http://forums.parallax.com/showthread.php?p=607062
That one got a little complicated, so I wanted to narrow down a couple of questions and try again, since I've had a chance to investigate a little more.
1.· Revisiting the PIN command
I did two versions of one program with the only difference in the two files was on pint was defined as:
And then I changed the other file as:
I compiled each code and went to the SASM output directory and did a file compare.
The only differences was the SX/B code differences,·shown above and down further where the output field is accessed, which had
MOV W,#252· ; for the PIN RA.1 OUTPUT··· %1111_1100
MOV W,#254 ; for the VAR RA.1··············· %1111_1110
So do these SASM·constant impactin the TRIS register?··It seems logical as 0 is an output.·I guess I was expecting PIN·... Output to give more assembly differences.
Also, if you are using a pin that's is·a bi-directional, would you declare it as a VAR, as in:
MyOut1 PIN RA.1 OUTPUT
And then I changed the other file as:
MyOut1 VAR RA.1
I compiled each code and went to the SASM output directory and did a file compare.
The only differences was the SX/B code differences,·shown above and down further where the output field is accessed, which had
MOV W,#252· ; for the PIN RA.1 OUTPUT··· %1111_1100
MOV W,#254 ; for the VAR RA.1··············· %1111_1110
So do these SASM·constant impactin the TRIS register?··It seems logical as 0 is an output.·I guess I was expecting PIN·... Output to give more assembly differences.
Bean, I didn't quite understand what you were saying there.· Can you give a little more detail?Bean said...
Rodney,
The code to setup the pins is generated by the "PROGRAM" directive.
Bean.
Also, if you are using a pin that's is·a bi-directional, would you declare it as a VAR, as in:
biCycle VAR RA.2 'bidirectional pin
2.· Revisiting·the difference betwen the T and the OT baud modes in the baud rate for SERIN/SEROUT, does the O refer to "Open Collector"?
Thanks!
Rodney
Post Edited (Yendor) : 10/7/2006 6:57:07 AM GMT
Comments
Yes, the O in OT stands for open. For open true, the serial line needs a pull-up as the SX will only pull the line low (for a 1 bit), the pull-up takes it high for the idle state or a zero bit. For open inverted, the serial line needs a pull-down. By using open modes you can buss multiple devices on the same line without fear of an electrical conflict (you may scramble data if two devices talk at the same time, but there won't be a buss short).