Professional Documents
Culture Documents
Introduction
Figure 1 : RF Transmitter
These RF Transmitter/Receiver Modules are very small in dimension and have a wide
operating voltage range (3V-12V). The low cost RF Transmitter/Receiver can be used to
transmit signal up to 100 meters (the antenna design, working environment and supply voltage
will seriously impact the effective distance). It is good for short distance, battery power device
development. In this project design RF Transmitter Modules 315MHz will be used.
1
GOAI TECK LIANG HK2006-3572
The application of RF includes Industrial remote control, telemetry and remote sensing.
Beside that RF also can be used as Alarm systems and wireless transmission for various types of
low-rate digital signal. In addition RF can be used as remote control for various types of
household appliances and electronics projects.
PRODUCT LAYOUT
Label Description
Data :The Data pin of the transmitter.
VCC:The power supply to the transmitter.
GND :The Ground of the transmitter.
ANT :The hole to solder and connect antenna. (Please select the
correct antenna length, which is 24cm)
2
GOAI TECK LIANG HK2006-3572
3
GOAI TECK LIANG HK2006-3572
circuit of the receiver. Once the receiver receives the data from transmitter, the green and red
led will start to blink.
BANKSEL SPBRG
MOVLW D'255'
MOVWF SPBRG
BANKSEL TXSTA
MOVLW B'00100000'
MOVWF TXSTA
BANKSEL RCSTA
MOVLW B'10010000'
MOVWF RCSTA
CALL BANK0
Program above is shown as the setup for the usart.
In this circuit design, the asynchronous mode (BRGH=0) is chosen and the oscillator
used for microcontroller is 20 MHz. Therefore set the SPBRG = 255, the most slow speed for
usart.
4
GOAI TECK LIANG HK2006-3572
For the transmitter part, the transmit enable bit is enabled. Others functions of
transmitter are turned off. Therefore, TXSTA should set as B'00100000'.
BTFSS SWITCH1
CALL SWITCH1_ON
GOTO $-2
SWITCH1_ON
MOVLW D'4' % decimal 4 is moved to the working register
MOVWF TRA % decimal 4 is moved from working register to TRA file
AGAI
BANKSEL PIR1 % select register PIR1
WAITTX1 BTFSS PIR1,TXIF % Test for the TXIF in register PIR1
GOTO WAITTX1 % if TXIF=0, back to the WAITTx1
MOVLW D'1' % decimal 1 is moved to the working register
5
GOAI TECK LIANG HK2006-3572
Program above shows the programming of the transmitter to transmit the signal. The
transmitter will continue to send 4 times decimal 1 and 1 times decimal 2 to the receiver when
the button is pressed. Once the TXREG register transfers the data to the TSR register, the
TXREG register is empty and the TXIF is set.
AGAIN
BANKSEL PIR1
WAITRX BTFSS PIR1,RCIF
GOTO $-1
BANKSEL RCREG
MOVF RCREG,W
MOVWF REC1
MOVF REC1,W
6
GOAI TECK LIANG HK2006-3572
SUBLW D'1'
BTFSC STATUS,Z
GOTO AGA1
MOVF REC1,W
GOTO AGAIN
AGA1
BANKSEL PIR1
WAITRX1 BTFSS PIR1,RCIF
GOTO WAITRX1
BANKSEL RCREG
MOVF RCREG,W
MOVWF REC1
MOVF REC1,W
SUBLW D'1'
BTFSC STATUS,Z
GOTO AGA1
MOVF REC1,W
SUBLW D'2'
BTFSS STATUS,Z
GOTO AGAIN
MOVWF PORTB
BSF PORTB
GOTO ASDF
Program above shows the programming of my receiver. The receiver will receive 4 times of
decimal 1 and 1 times of decimal 2. Once the TXREG register transfers the data to the TSR
register, the TXREG register is empty and the TXIF is set. If the transfer complete, RCIF is set.
7
GOAI TECK LIANG HK2006-3572
Testing 2
8
GOAI TECK LIANG HK2006-3572
led in the photo above indicates that the digital values (0-255). To make sure the receiver
receive the correct signal, the 8 led on and off at receiver must be same as the transmistter.
Programming above shows that analog signal is changing to the digital signal and then
sends it out from transmitter. The transmitter will continue send 4 times of the data to receiver
to decrease the error of usart.
ASDF
BANKSEL RCSTA %select register RCSTA
BCF RCSTA,CREN %clear CREN register
BSF RCSTA,CREN %Set CREN register
AGAIN
BANKSEL PIR1 %select PIR1
WAITRX BTFSS PIR1,RCIF %test the RCIF register
GOTO $-1 %if RCIF = 0 test again for RCIF
9
GOAI TECK LIANG HK2006-3572
Programming above shows that the receiver always prepares to receive the data from
transmitter. Once it receives the data, it will move the data to Port B of 16 F 877A. You can
check the digital value from 8 led.
Conclusion
This application note shows the RF transmitter/receiver can be used as speed control for
stepper motor.
Reference
10