Hi,
I have srf-005 ultrasonic sensors that I'd love to use but they need an i/o. ...... use of radio transmitters. It hadn't occurred to me to use ir. Which technology would you use?
For a robot car you probably "should" use Infra-Red Remote Control, because the RF modules generally all use the same radio frequency and are intended only for "intermittent" (time-shared) operation (door bells, car/garage doorlocks, Weather sensor data, etc.). Also the RFOUT / RFIN commands are not supported by 08M2 chips; an off-the-shelf Universal and/or scrap (Sony TV) RC might give a reliable controller with little effort. However, interfacing the IR commands to a Radio Transmitter-Receiver pair is an ingenious compromise, that may easily permit multiple users within a single room.
___________
Of course if more than 3 or 4 "pins" are required then it's "sensible" to use a larger PICaxe (than 08M2); the 14M2 has twice as many I/O pins, much more memory (RAM, Table and Program slots, etc.), lower voltage operation and the RF commands, etc., for modest extra cost. However, the 08M2 is sufficient for many applications (particularly if using the I2C bus, or in an Educational environment) and may be all that's available to hand or from some third-party suppliers (e.g. CPC in UK). Also the 08M2 actually can be faster, simpler and more flexible (e.g. greater interrupt capability), because all its pins fit into the same port
(which the PE conveniently allows to be declared as a single digit, or as Port B. or Port C.). Therefore, a user might have only some 08M2s, but all is not lost because the 08M2 has 6 pins which can ALL be used as both inputs and/or outputs, within certain limitations. The trick is to plan ahead and use the more "restricted" pins for the simpler tasks, so here's my summary of what CAN be done if you're desperate:
Pin
C.2 is generally the most "useful" pin because it has PWM Output capability, an (unofficial) Comparator Output, all the usual I/O functions, and most significantly it is the I2C Bus Data line (SDA). Similarly, the I2C SCL Clock line is a prime use for Pin
C.1 , but it is also the DAC "Reference" voltage input, effectively a "Programmable Potentiometer", or simply an internal weak Pull-
Down resistor. Officially, Pin
C.0 is "Output Only" and is required for Programming and Debugging, but it CAN be used as an input and/or a "DAC" Output if required (although PWM via a low-pass filter generally makes a far better DAC). Then
C.4 is another pin, with full Digital I/O and Analogue input capabilities, etc..
Officially, Pin
C.3 is "Input Only", but it CAN be used as a limited Output by activating its Weak Pullup Resistor, as is available on ALL the 08M2's port pins. The current is restricted (and only from the supply rail) but is sufficient to drive the "Enable" pin of most chips (a high-value pulldown resistance may be needed), or an NPN transistor, or a MOSFET such as 2N7000. Similarly, Pin
C.5 can be used for Input or Output with some care: First, a DISCONNECT command is required to prevent a Reset (initiating a new download), and in most cases the 10k pulldown resistor is best increased to 100k+ to increase the output voltage swing.
It's often commented that "The PICaxe Manual" has insufficient details on some topics, but there are many different PICaxes, so the most definitive information often can be obtained by using the Program Editor for a Syntax Check, or by Simulating a Test Program. This will often indicate which pins are available for specific functions such as PWM outputs or ADC inputs, etc.. However, sometimes it's "over-protective", requiring a workaround, for example:
variable = %100000 : PULLUP variable , or a POKESFR command. For additional Hardware facilities, such as the Comparator, Timer1 Gate, Alternate Pin Functions and Interrupt on Change Flags, etc., the "Pin Allocation Table" (1), near the start of the related Microchip Data Sheet, is a good starting point to see most of the facilities that are available.
Finally, there are various circuit techniques that might be adopted, for example multi-level (Analogue) signalling, or Multiplexing, for which "Charlieplexing" is a popular method for driving more LEDs than there are pins available.
Cheers, Alan.