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.
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]
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
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