PDA

View Full Version : Hm-trp



zdravko
- 21st April 2011, 10:00
Please help me about HM-TRP. http://www.hoperf.com/rf_fsk/hm-trp.htm

This is my PICBasic Pro Code:

Transmitter:

@ DEVICE pic12F675, intrc_osc_noclkout, wdt_off, pwrt_on, mclr_off, bod_off, protect_off

Include "modedefs.bas" ' Mode definitions for Serout

Define OSCCAL_1K 1 ' Calibrate internal oscillator

CONF Var GPIO.1
ENAB Var GPIO.2
LED Var GPIO.0
SI Var GPIO.4
SO Var GPIO.5

B0 var byte


ANSEL = 0 ' Set all digital
CMCON = 7 ' Analog comparators off

HIGH CONF

mainloop:

FOR B0=0 TO 99
Serout SO,N9600,[B0]
Pause 200
NEXT

Goto mainloop

End

Receiver:

@ DEVICE pic12F675, intrc_osc_noclkout, wdt_off, pwrt_on, mclr_off, bod_off, protect_off

Include "modedefs.bas" ' Mode definitions for Serout

Define OSCCAL_1K 1 ' Calibrate internal oscillator

CONF Var GPIO.1
ENAB Var GPIO.2
LED Var GPIO.0
SI Var GPIO.4
SO Var GPIO.5

B0 var byte


ANSEL = 0 ' Set all digital
CMCON = 7 ' Analog comparators off

HIGH CONF
b0=0

mainloop:

Serin SI,N9600,B0
WRITE B0,B0

Goto mainloop

End

What is wrong with my code?

Ioannis
- 21st April 2011, 11:47
Did you set up the modules prior their use?

Ioannis

zdravko
- 21st April 2011, 12:31
[QUOTE=Ioannis;101633]Did you set up the modules prior their use?

I think its not necessary. Default Settings is 9600bps, 8bit, No check, 1 bit stop.

prstein
- 23rd April 2011, 19:11
[QUOTE=Ioannis;101633]Did you set up the modules prior their use?

I think its not necessary. Default Settings is 9600bps, 8bit, No check, 1 bit stop.

I haven't used this particular device but I've become quite familiar with Hope's RFM22B. I think you might be a little optimistic in assuming the default serial settings cover everything you'll need. Given that it isn't working, following the guidance in the datasheet for configuring the chip might be a good step (after confirming that your PIC is working by blinking an LED or something).

Some very quick observations on your code:
-You define an ENAB pin but never explicitly set it low.
-You don't allow any warm up time. I think good practice is to give the PIC (and the module) a few hundred millisec to get their acts together. I usually add a PAUSE 500 after setting all the configuration bits.
-I don't see how you can even tell if it's working or not--how are you getting data out? At least for initial testing try having an LED blink (or something) each time a character is received.

Let us know how it goes. If you can't get it working give us some description of what it does and doesn't do--beyond "it doesn't work"--and how you're testing it. A schematic showing your hookup might also be useful.

Best Regards,
Paul

zdravko
- 24th April 2011, 02:10
Thanks Paul

This is a scheme and Ioannis is right. I have to configure the HM-TRP but currently have no MAX3232, MAX232 only.