TX RX HC-12 radio module

Status
Not open for further replies.
Maybe I don't understand what you want to do with the leds,
but you have no code in rx to set rled = 0
 
Hi I,
As long as we get there in the end, that's fine.
C.
 
Hi J,
I've used rled = 0 yled = 1 and rled = 1 yled = 0 in the past, I'll add it back in, but the problem is: they are OFFing, but not ONing. Although if they come ON, they don't switch off till TX SENDs a '0' is and RX is reset.

I think it's something to do with timing of the HSERGET.

I have an ASCII table, but probably only need 0 to 9, for playing with.
C.
 
Hi,
Failed! I can only get the RX to switch, if I reset the PIC. Here's what I used:
There is a more complex version on AAC, which I'm gouing to try now. I've used similar before, and it is very versatile.
C.
TX'--------------------------------------------------------------------------------------------
main:
If button = 1 Then 'BUTTON NOT PRESSED
rled = 0
yled = 1
Hserout "0", CrLf
Endif
WaitMs 500

If button = 0 Then 'BUTTON PRESSED
rled = 1
yled = 0
Hserout "1", CrLf
Endif
WaitMs 500

Goto main
RX------------------------------------------------------------------------------------------------
main:
Hserget i
WaitMs 500
If i = Asc("0") Then '< --- -- 48 is number 0
Hserout "Number: ", i, CrLf
rled = 0
yled = 1
WaitMs 500
Endif

If i = Asc("1") Then '< --- -- 49 is number 1
Hserout "Number: ", i, CrLf
rled = 1
yled = 0
WaitMs 500
Endif
Goto main
 
I am struggling here C...

If you press ( And keep it pressed ) red should light and yellow should go out and when you let go ,the leds should reverse..???

Why are you sending ("number: " i,CrLf ) back to the transmitter.. If you don't deal with the reception in the transmitter the serial port will overun!!
 
Hi I,
Why are you sending ("number: " i,CrLf ) back to the transmitter? Only so I can see it in the computer terminal as a check. It's not necessary really.

PORT overruning! How do I stop this?
C.
 
If you use that code on your Tx board and not the PC, the serial port in the pic will receive the string but the port will not be read, This will cause the OERR flag to be set and the port will need a reboot! The terminal program on the PC will do it automatically..
 
Hi I,
Aha!
As the computer terminal is just for monitoring, it can be ignored.
Is there a way to reset the OERR flag, so the TX can keep READing?
C.
 
If OERR = 1 then
CREN = 0
CREN = 1​
ENDIF

Im not sure if this will fix the problem, but try this in the main loop..
 
OERR is a bit in some USART register.
I don't have the d/s here now, but use something like
IF someregistername. OERR=1
 
Hi All,
I chose to use a more complex but versatile program, from another forum ETO, from Eric Gibbs
Here are both TX and RX:
Thanks to everyone who helped.
C.
 

Attachments

  • 18LF4520 8MHzx4 HC12 to 18LF2520 TX 200418 1100.bas
    3.8 KB · Views: 328
  • 18LF2520 8MHx4 HC12 from 18LF4520 RX 200418 1100.bas
    2.4 KB · Views: 331
Last edited:
Hi All,
I chose to use a more complex but versatile program, from another forum ETO, from Eric Gibbs
Here are both of them:
Thanks to everyone who helped.
C.
Yeah! I know... I've been watching!! As long as you get there, That's all that matters..
 
Hi I and J,
If you would like me to carry on getting this simpler program to work for your satisfaction, I'll carry on, but for my purposes, the #33 programs are better.
C.
 
Eric's programs normally work, so They would be the ones to build on... As you know, I use C so any basic program we develop would only be for others on this forum!!
 
Eric's programs normally work, so They would be the ones to build on... As you know, I use C so any basic program we develop would only be for others on this forum!!
Hi I,
Very true. I've been playing with them, and they're working ok, apart from changing frequency. I'm just about to start a post regarding this.
C.
 
Hi,
Here are a couple of programs, that I've modified, to be TX with RX ECHO, for use to test antennas.
They aren't perfect, and need to TX to be RESET for a result.

Switch on RX and TX, then move the TX away from the RX, while RESETTING the TX with either the BUTTON pressed or not. If pressed and they are in range, then a signal goes to the RX and it sends asignal back to the TX, which switches a LED on.
Hope it's useful.
C.
 

Attachments

  • 18LF4520 8MHzx4 HC12 to 18LF4431 BASE ECHO 160518 1800.bas
    2.9 KB · Views: 326
  • 18LF4431 HC-12 BMP280 REMOTE ECHO 160518 1800.bas
    3.5 KB · Views: 349
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…