Microprocessor and Development Tools - Embedded Control - Communications - Connectivity
   
Low-Cost Dev Kits
Application Kits
RabbitCores
Latest Downloads
Single-Board Computers
Rabbit Support Forums
Training/Events



Support > Ask Larry > August 30th, 2007

Ask Larry

Dear Larry,

Can you help me use the digital I/O on the Rabbit?

Ian O.

Hello Ian, As every engineer knows, the supreme goal of all embedded design is to light an LED. Just joking :)

The first thing I want to do is to point you to our Rabbit Processor Easy Reference Posters:

These posters show all the registers you will need and makes it pretty easy to find them. In the center of each poster is a description of the Parallel Ports and the registers associated with each one.

Let’s assume you are using a Rabbit 3000 device and consider a simple problem like lighting up two LEDs on Parallel Port D. You could hook the LEDs directly up to PD4 and PD5 and use pull-up resistors with the LEDs like this.

+5 Volts ------/\/\/\/\------- LED1 ---------- PD4

+5 Volts ------/\/\/\/\------- LED2 ---------- PD5

(I would recommend a 330 Ohm or bigger resistor.)

With the LEDs hooked up as above, you should be able to use this code to light them.

/************************************************************/
#define	ON	0
#define	OFF	1

main()
{
WrPortI(PDDCR, &PDDCRShadow, 0);   	// make D non-open drain
WrPortI(PDDDR, &PDDDRShadow, 0xFF);   	// make D output   
BitWrPortI(PDDR, &PDDRShadow, ON, 4);	// PD4 becomes GND and LED lights up
BitWrPortI(PDDR, &PDDRShadow, ON, 5); 	// PD5 becomes GND and LED lights up
}
/************************************************************

PDDCR = Port D Drive Control Register (Use this to set “open drain”)
PDDDR = Port D Data Direction Register (Use this to define an input or output)
PDDR = Port D Data Register (Use this to actually send the data)

This provides a very basic example of the digital I/O of a Rabbit 3000 microprocessor.

You should be aware that the digital inputs can be damaged by voltages that are too high. The Rabbit 2000 and 3000 can handle 5 volts and the Rabbit 4000 can handle 3.3 volts.

Full details on Parallel Port D (and more) can be found in the Rabbit 3000 Microprocessor User’s Manual here. The full version of the Rabbit 3000 Microprocessor User’s Manual can be found here.

After looking over this example, you should be able to move on to more complicated designs fairly quickly.

- Larry C.

Larry Cicchinelli is Rabbit Semiconductor’s Technical Support Manager. He has 30 years of embedded experience, and is considered one of the foremost authorities on Rabbit products. Larry and his staff offer comprehensive technical support to Rabbit customers.

Submit your questions for Larry via email at AskLarry@rabbit.com

Read more Ask Larry Answers




   Site Map | Privacy Policy | Contact Us | Feedback Copyright © Rabbit All Rights Reserved    A Digi International® Brand  
View Cart | Contact Us
View Cart
Products Solutions Support Company Channel partners Careers Ordering Information