# how to assign a pin?

**URL:** <https://forums.digi.com/t/how-to-assign-a-pin/10756>\
**Category:** Rabbit\
**Created:** [March 11, 2007, 6:33am UTC](https://forums.digi.com/t/how-to-assign-a-pin/10756 "2007-03-11T06:33:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel.th](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@daniel.th](https://forums.digi.com/u/daniel.th)\
**Post date:** [March 11, 2007, 6:33am UTC](https://forums.digi.com/t/how-to-assign-a-pin/10756/1 "2007-03-11T06:33:30Z")

</div>

hi, this may sound like a dumm question but im new at this. :o  
How can i assign a pin from the rabbit 3000 to use it as a variable in dynamic c.  
Because i heard u can only assign 8 bit as a variable, using 8 pins.

Im working on a proyect with robots and i need to connect a display and a numeric keyboard to my rabbit 3000 to send instruccions to the robot and i want to use separated pins not the hole port.

Thx in advance.

---

<div class="post-metadata">

**Author:** ![IWriteCode](https://avatars.discourse-cdn.com/v4/letter/i/4491bb/32.png) [@IWriteCode](https://forums.digi.com/u/IWriteCode)\
**Post date:** [March 12, 2007, 10:58am UTC](https://forums.digi.com/t/how-to-assign-a-pin/10756/2 "2007-03-12T10:58:16Z")

</div>

There are Bit write functions, which write a single bit…

BitWrPortI(PEDDR, &PEDDRShadow, 0x00, 0);

You need to use the shadow ports which are also defined for each port.

From the help file:  
[b]BitWrPortI

SYNTAX: void BitWrPortI(int io\_port, char \*PORTShadow, int value, int bitcode);

KEYWORDS: parallel port

PARAMETER1: address of internal I/O port.

PARAMETER2: address of variable shadowing current value of port.

PARAMETER3: value to write to port.

PARAMETER4: bit (0-7) to write value to.

DESCRIPTION: Updates shadow register at bit with value (0 or 1) and  
copies shadow to I/O port. WARNING: a shadow register is REQUIRED  
for this function.  
All of the Rabbit internal registers have predefined macros  
corresponding to the register’s name. PADR is #defined to be  
0x30, etc.

RETURN VALUE: None[/b]

---

<div class="post-metadata">

**Author:** ![daniel.th](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@daniel.th](https://forums.digi.com/u/daniel.th)\
**Post date:** [March 19, 2007, 2:08am UTC](https://forums.digi.com/t/how-to-assign-a-pin/10756/3 "2007-03-19T02:08:10Z")

</div>

mmm im sorry, i cant make it work yet, i wanna see if u have an example code in dinamic c controlling 1 pin.

Ty in advance

---

<div class="post-metadata">

**Author:** ![lgimenez](https://avatars.discourse-cdn.com/v4/letter/l/5daacb/32.png) [@lgimenez](https://forums.digi.com/u/lgimenez)\
**Post date:** [March 30, 2007, 3:02pm UTC](https://forums.digi.com/t/how-to-assign-a-pin/10756/4 "2007-03-30T15:02:16Z")

</div>

This is an example where you change the state of PIN 4 of PORT F (You do this modifying the PORT F Data Register - PFDR).

BitWrPortI(PFDR,&PFFRShadow,1,4);

Now Pin 4 is High. To go low:

BitWrPortI(PFDR,&PFFRShadow,0,4);

Remember that previosuly you have to set the PFDDR,PFFR,PFCR,PFDCR (F: port F).  
Luciano
