As I have changed my architecture, the answer to this question is not in my critical path. However, it may come up in the future. In XC, I declare bidirectional ports by leaving out the "out" and "in". Normally, my usage is not to sample what's being driven on the bus by an external "master" - but to read the current state of what is being driven.
Actually, in pseudo-code - my intended use for these types of ports would be
Code: Select all
on stdcore[myfavcore] : port readbidir = PICKAPINORPINS;
main()
{
readbidir <: 1; // drive a 1
function_that_changes_readbidir (readbidir);
if (readbidir) take_this_action_readbidir_ishigh; else take_this_action_readbidir_islow;
}
It may be possible with asm - but is there an XC method?
If I declared the port as an output, then I cannot read the port by using ":>" due to rules. As shown in the pseudo-code, I do not believe the "if (readbidir) ...." is valid as I believe I had issues treating ports as standard variables in this manner.
Additionally, although my example shows a port that could very well be an output (since I am never interested in what is being driven on the bus from an outside source) -- this same concept may also apply to true bidir ports where - while in output mode - I would like to read the state of what I am outputting rather than keeping track with a variable.
Regards,
Jason Whiteman