Hello everybody.
I've been looking a lot your forum which gave me a lot of help without the need of ask questions... all my problems where solved using 'Search'...
Now I think I need some guru help to solve my little problem.
I am trying to build a remote trasmitter wich will send SHT11 sensor data to my wireless station.
The modules I am using are this(TX):http://elmarpeters123.googlepages.com/TM1000-1.pdf
and this for RX (RM1SGS):http://e-madeincn.com/Product/Product-RXModule.htm
I've found them on ebay. They are very cheap. I paid 12€ for 3 pairs of them, shipping included!
I am writing some simple code to test them. The transmitter is a 12F683. Power pin is used to power up the transmitter via a transistor, will send data and then will be powered off for a minute to save battery.Here is the TX section:
Code:
INCLUDE "modedefs.bas"
ANSEL=0
CMCON0=%00000111
define osc 4
txpin var gpio.4
led var gpio.5
power var gpio.2
i var byte
low power
loop:
for i=0 to 9
high power
serout txpin,n2400,[$55,$55,$66,#i]
high led
pause 30
low led
pause 1000
low power
pause 1000
next i
goto loop
Then there is the RX section, the pic used is a 16F876:
Code:
INCLUDE "modedefs.bas"
define osc 20
Define LCD_LINES 4 ' Settings for a 4x20 LCD
Define LCD_DREG PORTB ' 4bit mode
Define LCD_DBIT 4 '
Define LCD_RSREG PORTB
Define LCD_RSBIT 3
Define LCD_EREG PORTB'
Define LCD_EBIT 2
'LCD Lines constants
row4 con $d4
row3 con $94
row2 con $c0
row1 con $80
rxpin var portb.0
rx_data var byte
TRISC=255
intcon=0
pause 500
lcdout $fe,1
lcdout $fe, row1, "** RX TEST **"
pause 300
loop:
serin rxpin,n2400,1000,loop,[$66],#rx_data
lcdout $fe, row3,dec1 rx_data
goto loop
The TX/RX modules work fine, If I monitor the rx pin of the receiver I get exactly what I send, with no garbage at all.
Still on the rxpin set on the pic I get the same clean data.
Can somebody explain me why the PIC does not always print the correct data?
The amount of correct numbers recieved is about 60%.
I've tried with and without preambles, serin, serin2,hserin, but I always get the same results.
I repeat, connecting the rxpin to an rs232 everyhing's perfect. It seems the pic is not fast enough the get data! It has a 20Mhz clock with proper capacitors.
One more thing: The pic has all the sensors(18b20, SHT11, pressure, RTC) soldered around.
I'am trying to expand the initial project, adding a receiver.
Anyway, the code uses just the rxpin to catch data.
Thank you for your attention
Francesco
Bookmarks