Вы находитесь на странице: 1из 7

RF TRANSMITTER

1.0 ABSTRACT This application note is about the RF transmitter which is designed to transmit the digital signal to the receiver. In Happiness Care Team of Field Deployable Sound Sensor Project, the RF transmitter is one of our main components. It is interfaced with the PIC Microprocessor as its controller. The PIC Microprocessor to use is PIC 16F877A. The explanation of how to initialize the code function of transmitter by using MPLAB also provide and how to create its subroutine.

2.0

INTRODUCTION

RF Transmitter is a component of electric circuits that we use it to transmit a RF signal to the receiver. In sound sensor project, the RF transmitter is used to transmit the RF signal from to the receiver and controlled by PIC 16F877A to apply with auto-gate system. The circuit interfacing the transmitter, PIC 16F887A and the Analog-Digital-Converter (ADC) is shown as in Figure 1. The RF transmitter circuit consists of resistor, coil, crystal and transistor. In our project, we use PIC 16F877A to interface with the transmitter as we think it is one of the ideal solution for the transmitter to be function smoothly.

Figure 1: The Circuit Interfacing RF Transmitter, PIC 16F877A and Analog-Digital-Converter (ADC)

3.0

PIC 16F877A: The Ideal Solution for the RF Transmitter

PIC 16F877A is the microchip device which has some and good range of features. The Table 1 shows the features of PIC 16F877A features and Figure 2 is the figure of pin diagrams of PIC 16F877A. The data of PIC 16F877A key features is shown in the red box. In this programming, the Universal Synchronous Asynchronous Receiver Transmitter (USART) coding is used to setup transmitter and receiver code in PIC 16F877A. However, this application note only gives the information about RF transmitter and not the receiver.

Table 1: The table of PIC Family Key Features

Figure 2: Pin Diagrams of PIC 16F877A

3.1

The Universal Synchronous Asynchronous Receiver Transmitter (USART)

The Universal Synchronous Asynchronous Receiver Transmitter (USART) provides the type of basic serial communication originally developed for dumb terminals to communicate with mainframe computers; it was later adopted for the COM port of the PC to interface to the mouse and other serial peripherals. The Universal Synchronous Asynchronous Receiver Transmitter (USART) module is one of the two serial I/O modules. (USART is also known as a Serial Communications Interface or SCI.) The USART can be configured as a full-duplex asynchronous system that can communicate with peripheral devices, such as CRT terminals and personal computers, or it can be configured as a half-duplex synchronous system that can communicate with peripheral devices, such as A/D or D/A integrated circuits, serial EEPROMs, etc. The USART can be configured in the following modes: Asynchronous (full-duplex) Synchronous Master (half-duplex) Synchronous Slave (half-duplex) Bit SPEN (RCSTA<7>) have to be set in order to configure pins RC6/TX/CK as the Universal Synchronous Asynchronous Receiver Transmitter. The pin 25 is set to the pin RC6/TX/CK for the transmitter. USART module also has a multi-processor communication capability using 9-bit address detection. However, this project uses 8-bit address detection for the PIC by set TX9 = 0. The Figure 3 shows the signal of USART at PIC port. This project use asynchronous or full duplex configuration by set sync = 0.

Figure 3: Signal at PIC port

The USART is accessed through pins RB6. The modes operation to build this RF transmitter application is asynchronous (no clock connection). The asynchronous mode is probably used more often, as other methods of synchronous transmission are available in the PIC. In asynchronous mode, RB6 acts as a data transmit (TX) output and RB7 as data receive input (RX). Data is transmitted in 8-bit words with the least significant bit sent first. The receiver must sample the input at the same rate as the data is sent, so standard clock (baud) rates are used. Low baud rate is used in this transmitter. Separate transmit and receive lines are used, so it is possible for these operations to be carried out simultaneously.
3

4.0 4.1

IMPLEMENTATION: PROGRAMMING PIC FOR THE RF TRANSMITTER Initialize the Transmitter

We will assume initially that the signal from PIC is transmitting. The sender and receiver have to be initialized to use the same baud rate, number of data bits (default 8) and number of stop bits (default 1). The transmit (TX) output is high when idle (external line negative). When the serial buffer register (TXREG) is written, the data is automatically sent as follows. The byte transmission starting is signaled by the line going low for one clock period (start bit). The selected baud rate determine the following 8 bits are then output from the transmit register, at intervals. After the last data bit, the line is taken high by the transmitter for one clock period (stop bit), and that is the end of that transmission. The line is left high if there is no more data; another word can be transmitted after a delay, or immediately following. The protocol is thus about as simple as it is possible to get. 4.2 Create the subroutine The Code 1 below is the code so each time we call this routine to setup the transmitter register void setup_rf_transmitter (void) { SPBRG = 255; Select low baud rate BRGH = 0; Select low speed asynchronous mode SYNC = 0; Select asynchronous mode SPEN = 1; Serial port enable (transmitter is serial port) TXEN = 1; Transmit enable bit TX9 = 0; Select 8-bit transmission } Code 1: Subroutine for RF Transmitter 4.3 Setting up Transmitter

Each time to read signal input from PIC 16F877A, we must enable the RC/TX/CK pin. The selected pin is pin 25 in PIC 16F877A. So, the signal output from PIC 16F877A will send to the transmitter circuit by this pin. 4.4 Read the RF Transmitter

The function code for RF Transmitter to transmit is shown in Code 2. The unsigned character for define is b11111111. To test the RF Transmitter function or not, the LED will be used and connect with it. If the RF Transmitter is success to transmit a signal, the LED will on. The connection of LED with RF transmitter can be shown in Figure 4.

void uart_send(unsigned char data) { unsigned short i; while(TXIF==0); //only send the new data after { for(i=1000;i>0;i--) { TXREG=data; } //the previous data finish sent } } Code 2: The function code of RF Transmitter to transmit the signal

LED is used to test the RF

Transmitter

Figure 4: The Transmitter interface with PIC 16F877A In the Figure 4, two LEDs are connected. The purpose is to detect the variation voltage of signal transmission. The red LED will on when RF Transmitter transmit 1V signal while the green LED will on when the voltage signal is over than 2 V. 5.0 THE SOFTWARE

This is the software to implement the coding into the PIC 16F8877A. 8.0 SUMMARY

This application note describe how to simply programming the RF Transmitter. Due to the hardware microchip PIC 16F887A, the coding could easily be implemented. This application note also acts as a foundation upon where the user can implement features for Sound Sensor System that can apply in any system that using wireless sound sensor.
5

9.0

APPENDIX

Вам также может понравиться