I’m working with the RCM5700 Mini Core
First time to use the External IO Aux Bus feature on the Rabbits…
This seems this is an illusive topic…
So I’m posting a sample from the Rabbit folks and have modified and
added my comments to help those looking for the same
type of information.
Hope this is use to some users
PS … you should be familiar with bus and address configurations
as well as using IOWR / IORD / CS signals to enable your
external IO interface designs…
//*************************
//RCM57_extern_IO.C PE7 used as strobe, write enabled
//
//Port A used as external I/O data bus,
//Port B as external I/O address bus.
//Use IOWR IORD to interact with your hardware addressing
//
//PB[7…2] correspond to external address bits 5 through 0.
// note: you can use the entire PB[7…0] if desired
// by modifying the SPCR criteria below
//*************************
// this is a typical READ and WRITE to an External Data port
main()
{
int var1;
// SlavePortControlregister
WrPortI(SPCR, &SPCRShadow, 0x8C);
// I/O Bank Control Reg
WrPortI(IB7CR,&IB7CRShadow, 0x08);// 15 ws io/cs active low cs
// set PE7 to be used as the CS pin
BitWrPortI(PEDDR, &PEDDRShadow,1,7); // PE7 set to an output
BitWrPortI(PEAHR, &PEAHRShadow,0,7); // PE7 = I7 pg117 RCM5000 man
BitWrPortI(PEFR, &PEFRShadow,1,7); // PE7 alternate function
WrPortI(PBDDR, &PBDDRShadow,0xFF); // probably not needed.
while(1)
{
WrPortE(0xE001, NULL, 0xAA); // write 0xaa to 0xE001
// keep in mind that the 0xExxx is dictated by the CS pin
// see pg 304 RCM5000 manual 27.1.2 I/O Strobes
// this shows the ranges using the different IBxCR strobes
// typically, for general I/O you would only use one strobe
// and map any I/O hardware you have to this range…
// I used 0xE001 as a write address but it has the range
// xE000 - xEFFF. (same for the READ below )
waitfor(DelayMs(10)); // just a delay here
var1 = RdPortE( 0xE002 ); // reading a byte is the same as above
// with regards to the address range, it uses CS7
waitfor(DelayMs(10)); // just a delay here
}
}