|
Regarding your program. Try sending 0s, not xs, i.e.:
char *buffer = "\0\0\0\0\0";
Zeros are coded with the IR on 91% of the time, while xs are coded with the
IR on only 45% of the time, neglecting the modulation, which cuts that all
down by half.
Also, five characters takes 23 ms to send, but you wait for 100 ms, so you
cut down your average IR output by another factor of 23/100. Try:
result = dir_write(buffer, sizeof(buffer));
Which blocks for exactly the right amount of time.
If all you want to do is make the IR light in the RCX turn on, all you
really need to do is set the IR transmit pin to output low:
*(char *)0xffb8 = *(char *)0xfd84 |= 1; /* Set port 5 bit 0 to output */
*(char *)0xffb6 &= ~1; /* Set port 5 bit 0 to low */
Note the update of the ROM shadow register, 0xfd84. I'm pretty sure LegOS
has symbolic names for these registers, but I do not know them.
Also, the serial interface must have transmission off, but this is the
default if you are not sending anything using the serial interface (by
using e.g. dir_write).
To turn the IR off and make dir_write work again:
*(char *)0xffb8 = *(char *)0xfd84 &= ~1; /* Set port 5 bit 0 to input */
I haven't tested any of this code specifically, but previous tests and
notes I have indicate that setting port 5 bit 0 to output low turns on the
IR light all the time, jamming transmissions. This is what you want, no?
To be able send IR continuously so you can detect it with the light sensor?
-Kekoa
|
|
Message has 1 Reply: | | Re: Blocking IR
|
| Thanks for your help but I think I might have a broken RCX. The code I've been testing and the examples you have help me with all work if I place the light sensor about 2 mm from the IR transmitter. At about 2cm it no longer works at all. I have (...) (25 years ago, 20-Jun-99, to lugnet.robotics.rcx.legos)
|
Message is in Reply To:
| | Re: Blocking IR
|
| Here is some code for IR detection, with the help from Kekoa. However it doesn't work. I know the hardware is all working because if I run minicom and then run this programme and point the RCX at the lego tower junk appears on the screen. If I take (...) (25 years ago, 15-Jun-99, to lugnet.robotics.rcx.legos)
|
12 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|