|
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
This project shows how to construct a 4-button remote control system for use with Micro-Bot using the PicBasic Pro demo version compiler. We'll use the Ming 4-button TX-99K4A transmitter, Ming RE-99 receiver, and Holtek HT-12D decoder IC just like in the full version compiler RF remote control project shown HERE. We can't add all the bells & whistles like the full version project, but this does give you a good trial run with the free demo version compiler. With a few simple components and the demo compiler you can still build a lot of nifty gadgets like this, or remote control servo positioning systems, remote window blind controllers, programmable logic ICs, and more. It's certainly worth grabbing the full version compiler at some point, but there's still a lot you can squeeze out of the free version if you're creative.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The TX-99K4A transmitter uses the Holtek HT-12E 4-bit encoder IC, so we'll need the matching Holtek HT-12D decoder IC for the receiver circuit. The Ming RE-99 300MHz RF receiver module operates at the same frequency as the TX-99K4A, so we have a perfect match between transmitter & receiver. The CD-ROM has datasheets for the TX-99K4A Schematic , TX-99K4A Datasheet, HT-12D, and Ming RE-99 in Adobe .PDF format. With the demo version compiler we're limited to 31 lines of code so we'll keep it simple here. In this experiment Micro-Bot will be 100% under remote control. Review some of the other projects for code snippets you can modify and add to this project code for more functionality. The Decoder IC: The HT-12D decoder IC has four latching data outputs, and one momentary output. The 4-bit data pattern on output pins D0-D3 will latch, and stay at the last transmitted 4-bit value until we press another button on the transmitter sending a different 4-bit logic pattern. Note: We can't use output pin D3 of the HT-12D. The TX-99K4A transmitter does not change this bit. As shown below in Figure#1, the HT-12E encoder inside the TX-99K4A does not have a switch connected to data input pin #13 or D3. Switch SW-1 [button A] connects to D2, SW-2 [button B] connects to both D1 and D2, SW-3 [button C] to D1, and SW-4 [button D] to D0. There are no switch connections to D3.
It's not shown in the partial schematic in Figure #1, but when any button is pressed power is supplied to the encoder circuit initiating the transmission of data. Releasing a button ends the transmission by removing power from the HT-12E encoder. At the receiver end the decoders VT output pin idles at logic 0. When a transmission from an encoder with the same address is being received, the decoders VT output will transition from ground to +5V during the transmission. When we release the transmitter button and end the transmission VT returns to ground. Hence, VT gives us a momentary bit to use with the 3 latching data bits. We'll sample the decoders VT output pin with PortA3 looking for logic 1 or +5V. If the VT output pin is logic 1 we'll jump to a sub-routine named Check_Remote to read the 4-bit binary value present on the decoders latching outputs D0, D1, D2 and the momentary VT output. Within the Ckeck_Remote sub-routine we'll determine which button on the TX-99K4A transmitter is being pressed, and alter Micro-Bots direction or command him to stop if Button D is being pressed.
To control Micro-Bot with the TX-99K4A remote
transmitter, we'll want at least four basic control functions or
commands. We'll assign each the of the transmitter buttons a single function
as follows --:
Whoa..! Where's forward..? We'll make forward the default direction if the VT output is idle or logic 0 since this condition indicates we're not pressing any of the transmitter buttons. This turns control back over to Micro-Bot, and he continues moving forward. Our program code will occasionally check the status of the VT output connected to PortA.3 for logic 1 to determine if any buttons on the transmitter are being pressed. If VT=0 Micro-Bot will load the value for forward motor direction, jump over the Check_Remote sub-routine, and go to the Move sub-routine to continue moving forward until we press a button on the transmitter initiating a turn or stop. If a button is pressed PortA.3 [aliased as VT] will be logic 1, and we jump to Check_Remote, determine the button that's being pressed, and execute the command assigned to that specific button. Data Patterns:
As mentioned previously, the TX-99K4A transmitter has four
buttons labeled A, B, C and D. The four data outputs of the HT-12D decoder
will provide the following data patterns corresponding to each button press
on the TX-99K4A --:
Table #1 Knowing these data patterns Micro-Bot can easily determine which button is being pressed, and quickly react to each command from the transmitter. The Receiver Schematic: Below is the receiver schematic. The data output pin of the Ming RE-99 RF receiver connects to the HT-12D decoder IC pin #14. Power for the receiver module is provided by Micro-Bots regulated +5V & ground. You can wire this circuit on the Micro-Bot bread board or directly onto the circuit board. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Once you have the receiver circuit
assembled, program the code below into Micro-Bot. Note: Below we're setting PortB=%00000011. When using the PULSOUT command we want high-going pulses for controlling the servo motors. The PULSOUT command requires you to set the output pin to the compliment of the pulse you require. Hence, "0" = "1" or high pulses on PortB.4 and PortB.5 when we issue the PULSOUT command. If you've put together the infrared navigation project already, setting PortB.0 & PortB.1 to logic 1 turns the infrared LEDs off. Just in case they're still be wired in, we'll make sure they stay off. If you skipped over the demo compiler project for infrared navigation, review the project HERE for details of how the 16-bit motor control values are being used. This may look confusing if you've skipped over the motor control discussion. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Copyright © 2007
Reynolds Electronics |
|||||||||||||||||||||||||||||||||||||||||||||||||||||