Understanding DIRA and OUTA in multiple cogs
Mark Swann
Posts: 124
I thought I knew how to use dira and outa, but I am seeing some strange behavior in some code I am testing. So, let me pose this question.
If, in cog 1, I set all bits in dira to zero, and in cog 2 I set 1 or more bits of dira to '1', will writing 1's into outa of cog 1 affect any of the output pins?
Lucidman
Post Edited (lucidman) : 11/5/2007 2:02:07 AM GMT
If, in cog 1, I set all bits in dira to zero, and in cog 2 I set 1 or more bits of dira to '1', will writing 1's into outa of cog 1 affect any of the output pins?
Lucidman
Post Edited (lucidman) : 11/5/2007 2:02:07 AM GMT
Comments
-Phil
I took the uOLED-96-Prop-Demo_V4.spin demo program and modified it to launch a cog with some assembly code in it. The new cog would write some things to the four outputs P18, P19, P20 and P21. The problem is that it causes the graphics module to stop displaying what I commanded it to display, i.e it goes blank.
Here is the assembly code in the new cog that I started with.
So I decided to try something strange. I set all the dira bits to zero, and it still causes the graphics module to go blank. Go figure!
·Furthermore, if I change the·code so it only writes zeroes to outa, it works fine, The screen does not go blank. Again, go figure.
I'm baffled.
Any ideas?
(not so) Lucidman
Thanks,
Lucidman
·
You da man!
That was the problem.
Thanks
Lucidman.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
When in doubt, refer to the datasheet! If you'll notice on the diagram of the cogs that shows the I/O chain, the output of each cog is conditioned by the direction register. If the direction register bit in the cog is zero, the output of the cog will be forced to zero regardless of the value in the output register.
Reading pays!