I'm looking at interfacing an XE216-512-TQ128 to an external cpu, with the xmos chip being mapped into a memory range ($D100 to $D7FF on the address bus). The bus in question is relatively slow (~2MHz) so I could simply sit in a loop sampling and triggering if necessary. Ideally though, I'd like to have the code only trigger when an address is actually relevant.
The manual presents options for 'value = x' and 'value != x' on the port, but I was wondering if there was any way to mask off bits ? It did occur to me I could use some external hardware to AND the required lines together and wire up a 1-bit port to that, then trigger on the 1-bit port and read the 16-bit port when the 1-bit port is triggered. Again, ideally, I'd prefer to keep the external hardware to a minimum so if there's a clever way to do it in software, I'm all ears :)
Cheers
Simon
Detecting a bitmask on an input port
-
- Experienced Member
- Posts: 67
- Joined: Fri Aug 24, 2012 9:37 pm
- Contact:
Hello Simon. The first example under Inputting Data is relevant
https://www.xmos.com/published/xc-input-and-output
In a loop, read your multi-bit port to look for your address match along with any other qualifying strobe, decode signal, etc. before performing your required task.
https://www.xmos.com/published/xc-input-and-output
In a loop, read your multi-bit port to look for your address match along with any other qualifying strobe, decode signal, etc. before performing your required task.
-
- Experienced Member
- Posts: 67
- Joined: Fri Aug 24, 2012 9:37 pm
- Contact:
Ok but this is polling, right ? As above "I could simply sit in a loop sampling and triggering if necessary", but I was wondering if I could make it event-driven rather than just constantly sampling in s/w and testing it in a loop.
If that's the way it has to be, then that's fine - don't get me wrong. I was just wanting to make sure I wasn't missing a trick somewhere.
Cheers - and thanks for the reply :)
Simon
If that's the way it has to be, then that's fine - don't get me wrong. I was just wanting to make sure I wasn't missing a trick somewhere.
Cheers - and thanks for the reply :)
Simon
-
- Experienced Member
- Posts: 67
- Joined: Fri Aug 24, 2012 9:37 pm
- Contact:
I think I actually see what you were trying to say now - the 'Waiting for a Condition on an Input Pin' example shows that you can wait for "!= x", where x can change from sample to sample. That means the code will wait for a transition, not just run the loop continuously.
So I can effectively reduce the work being done because I'll only get a transition every time the (much slower) bus changes. I can use this :)
Cheers - I sometimes take a while to understand, but the lightbulb switches on eventually :)
Simon
So I can effectively reduce the work being done because I'll only get a transition every time the (much slower) bus changes. I can use this :)
Cheers - I sometimes take a while to understand, but the lightbulb switches on eventually :)
Simon