Hello, I have an RCM5600W RabbitCore and am completely new to this platform. I am trying to connect third party devices such as a proximity sensor that sends a high or low to a pin on the rabbit. I’m having trouble understanding the pins and the software, for example, my understanding is as follows:
BitRdPortI(PDDR,0) should read a bit from the PD0 pin labeled in the manual as pin 17. I have the development motherboard and when I plug my device into pin 17 on the header and execute the read port it always comes back low even when the sensor activates and reads hi via a multimeter.
I find the documentation and pin layouts confusing, if anyone could explain how I can read the status of a pin in dynamic C it would be much appreciated.
I suspect you have not yet discovered the MiniCore RCM5600W OEM User’s Manual…
I think you are confusing the edge connector assignments (of the MiniCore module) with the header assignments (of the interface/development board) - they are different. If you are using the development board, there are labeled pads that you can solder to (they call it the “Module Extension Header”). If you’re just using the interface board and connecting directly to the header, then those assignments are shown in Appendix B of the User’s Manual (http://www.rabbit.com/documentation/docs/manuals/RCM5600W/RC5600WM.pdf).
On the software side, make sure you configure PD0 to be an input using PDDDR. Details of this can be found in the processor User’s Manual (http://www.rabbit.com/documentation/docs/manuals/RCM5600W/RC5600WM.pdf)
Thanks for pointing that out! I realize that the P2 connector on the interface board uses pin 11 for PD0. I am now confused about the PDDDR functions. I couldn’t find anything helpful in the manual, but the sample programs do utilize those functions although not clearly. What is the difference between PDDR, PDDDR, PDFR, PADR, etc? I used this command hoping it would set the physical PD0 as input:
BitWrPortI(PDDDR, &PDDDRShadow, 0, 1);
This is the logic for my if statement to determine if PD0 is high or low:
It always seems to come back as reading a high even with nothing connected. I’m sorry about all these basic questions, this platform is very different for me.
The registers are described in the Microprocessor User’s Manual.
Use the bit number (0), not the bit mask (1) for the 4th argument in BitWrPortI().
Thanks again sgt for your help. I have replaced the bit number and mask accordingly. This is my code and when I apply 5V to PE0 (J2-3) nothing happens to the output.
The stdio output stays displaying “E0”, even when the high voltage is applied to the pin. All I need is to be able to determine if a pin is high or low.
P.S. - The only register description I found in the entire manual was Section 5.2.1 Digital I/O and that was a single example of setting inputs and outputs.
Eek. You don’t want to be applying 5V to the inputs - they run at 3.3V (3.6V max, according to the doc).
I have an RCM4100 that has PE1 stuck at 0 - probably something I did, but in any case I had to move that input to PE4. So don’t rule out the possibility that that one input is bad (though you should always assume you’re doing something wrong until you can prove otherwise…)
Looks like I posted the wrong link for the microprocessor user’s manual above. It’s http://www.rabbit.com/documentation/docs/manuals/Rabbit5000/UsersManual/R5000UM.pdf
That’s where you’ll find the detailed info about the ports and registers and all the nifty peripherals that the processor has…
I’ve brought my input voltages down to 3.3V.
The stuck PE0 went away only to bring a new odd feature… I get various readings when I plug in a wire to the J2 pin. I’ve moved the physical wire and sensor to different ports (PE0,PE1,PE2,PC0,PC2) as well as modify the code and it does the same thing - no order, just random highs and lows. It’s just a single wire in J2, connected to nothing but air on the other side. As soon as I unplug the wire from J2 as the program is still running, the output goes low. I’ve tried several wires also with no luck.
The user manual is great, just what I was looking for and reading through just the parallel port info made me realize how complex these rabbits are. I just wanted a chip to record highs and lows from various input sensors and send them via wifi to a server… Seems like the rabbit chips can do just about everything!
I really don’t know where to go from here, but I do appreciate all your help!!