How to get programmed io R/W on RCM6700?

I need help to program correctly the IO ports (A & B) to get simple read and write operations

Read through Chapter 31 (External I/O Control) of the Rabbit 6000 User Guide, and reference the “External I/O” section of the Rabbit 6000 Reference Poster.

You need to set up multiple registers.

IBxCR (e.g., IB0CR using address range 0x0000–0x1FFF and bit/pin 0 of one of the I/O blocks) configures wait states, the I/O strobe, whether it’s read only, if the strobe is active high or low, and if it should use the I/O bus (on Port A and B). When in /CS mode, the Rabbit also drives the shared /RD and /WR pins based on whether you’re reading or writing.

You need to set SPCR to either 0x8C (for 6 bits of addressing on PB[7:2]) or 0x9C (for 8 bits of addressing on PB[7:0]). Note the odd bit order as a legacy of prior Rabbit processors – PB[2:7] are address bits [0:5], PB0 is bit 6 and PB1 is bit 7.

Once configured, you can use WrPortE(addr, NULL, value) to write a value to the device, or RdPortE(addr) to read from the device. Using a value of 0x0000 for addr sets all address bits of Port B to 0. With 6 bits of addressing, you have 64 unique addresses (0x0000 to 0x0003F).

Lib/Rabbit4000/Displays/LCD122KEY7.LIB makes use of External I/O if you’d to see it in action.

Hi Tom!

Thank You so much for your message and help.

It works, immediataly for the Read signal.

We are, yet, in troubles with the Write signal. Work on.

Best Regards!

image001.jpg

What value are you using for the IBxCR register? Make sure bit 3 (0x08) is set to enable writes.

And you probably want bits 4 and 5 (the 0x30 bits) set to 0 so it’s using the strobe for a chip select.

Having the other bits at zero (default) will be a good starting point for testing. Once you’ve calculated the necessary wait states, you can adjust the top 2 bits to use fewer than 15 wait states.

So, IBxCR set to 0x30 for a start? Maybe you still have the default value of 0x00?

Hi Tom!

We got succes in the control of IO R/W.

Our problem, now, is: in the circuit we have, it must be used de signals \PE0 and \PE7 to complete the enable access to the external device.

We know that the setup is corrected in the CPU (\PE0 = 0 and \PE7 = 0). But, externaly the signal is mesured as \PE0 = 1 and \PE7 = 1. Is there any additional command missing?

Thank You.

Best Regards

You don’t need to toggle PE0/PE7 manually. What settings are you using for IB0CR and IB7CR? If you’re using PE0/PE7 as active-low chip selects, you’d expect the values to be high when not reading/writing the devices.

If you configure IB0CR and IB7CR correctly, you’ll be able to r/w the device on PE0 using addresses 0x0000 to 0x003F and on PE7 using 0xE000 to 0xE03F. Remember to use WrPortE() and RdPortE() to access your memory-mapped devices.

Maybe share your code on the open issue you have with Digi’s support department, and they’ll pass it on to me for feedback.