Ebay HC-12 wireless transceivers


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2008
    Posts
    59

    Default Ebay HC-12 wireless transceivers

    HC-12 wireless transceivers

    Has anyone used the HC-12 wireless RS-232 modules on ebay? My modules seem to work fine with Arduino but I am having no luck using a 16F628A/16f616. Very simple code below returns
    4
    8
    2
    96
    128
    32
    16
    32
    32
    32
    16
    128
    96
    4
    16
    64
    128
    128

    Transmitter Code 16F616:
    Tx:
    SEROUT PORTC.5,6,[2] 'sends 2 to the HC-12 every 3 seconds
    PAUSE 3000
    GOTO TX

    Receiver Code 16F628A:
    OVER:
    SERIN2 PORTB.2,16468,3000,OVER,[V1]
    IF V1 = 0 THEN GOTO OVER
    SEROUT PORTB.5,6,[#V1,10] 'Output to serial Monitor
    GOTO OVER
    Last edited by n0yox; - 30th January 2017 at 03:37.

  2. #2
    Join Date
    Dec 2010
    Posts
    409

    Default Re: Ebay HC-12 wireless transceivers

    Break down the problem - connect the 16F616 pin C.5 to the 16F628A pin B.2 with a piece of wire and make that work first.
    GND on both devices should be tied together too.

  3. #3
    Join Date
    Mar 2008
    Posts
    59

    Default Re: Ebay HC-12 wireless transceivers

    Quote Originally Posted by Charlie View Post
    Break down the problem - connect the 16F616 pin C.5 to the 16F628A pin B.2 with a piece of wire and make that work first.
    GND on both devices should be tied together too.
    It works as expected when wired direct.

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,381

    Default Re: Ebay HC-12 wireless transceivers

    It works as expected when wired direct.
    which would be not at all


    tx true level @38400 baud
    SEROUT PORTC.5,6,[2] 'sends 2 to the HC-12 every 3 seconds
    rx inverted @9600 baud
    SERIN2 PORTB.2,16468,3000,OVER,[V1]
    Warning I'm not a teacher

  5. #5
    Join Date
    Mar 2008
    Posts
    59

    Default Re: Ebay HC-12 wireless transceivers

    Quote Originally Posted by richard View Post
    which would be not at all


    tx true level @38400 baud


    rx inverted @9600 baud

    It works for sure when wired direct.
    If you take a look at the third 9600bps mode " http://melabs.com/resources/ser2modes.htm " you will find that 16468 is indeed 9600 inverted when using serin2 as is mode 6 when using serout. I am running inverted since I am wired direct and not thru a set of MAX232 ics.
    Last edited by n0yox; - 31st January 2017 at 01:04.

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,381

    Default Re: Ebay HC-12 wireless transceivers

    ok [I was thinking serout2]

    are you sure the signal needs to be inverted , I have not used these modules but the code here is using true levels
    http://www.picbasic.co.uk/forum/showthread.php?t=20869

    there is also mention of setting the module correctly re baud rate and fu_x
    Warning I'm not a teacher

  7. #7
    Join Date
    Mar 2008
    Posts
    59

    Default Re: Ebay HC-12 wireless transceivers

    Thank you, Richard the link was helpful as was yours and Charlie’s comments .My project is back on track with the code below

    Transmitter Code 16F616:
    Tx:
    SEROUT PORTC.5,2,[2] 'sends 2 to the HC-12 every 3 seconds
    PAUSE 3000
    GOTO TX

    Receiver Code 16F628A:
    OVER:
    SERIN2 PORTB.2,84,3000,OVER,[V1]
    IF V1 = 0 THEN GOTO OVER
    SEROUT PORTB.5,6,[#V1,10] 'Output to serial Monitor
    GOTO OVER

  8. #8
    Join Date
    Nov 2021
    Posts
    2

    Default Re: Ebay HC-12 wireless transceivers

    buenas tardes tengo problemas mi hc 12 no se conecta no envía datos hice el código como está y no agradecería si alguien me puede ayudar

    DEFINE OSC 4


    include "modedefs.bas"


    LEDS VAR BYTE


    CMCON=7


    TRISA=$FF


    TRISB=%00000000


    PORTB=0


    PORTA=0


    PAUSE 50


    INICIO :


    SEROUT PORTB.2,2,[2]
    PAUSE 1000
    GOTO INICIO


    END

  9. #9
    Join Date
    Nov 2021
    Posts
    2

    Default Re: Ebay HC-12 wireless transceivers

    y este es el codigo que uso para el receptor:

    DEFINE OSC 4


    include "modedefs.bas"


    LEDS VAR BYTE


    CMCON=7


    TRISA=$FF


    TRISB=%00000000


    PORTB=0


    PORTA=0


    HIGH PORTB.0
    PAUSE 1000
    LOW PORTB.0


    INICIO:


    SERIN2 PORTB.1,84,300,INICIO,[LEDS]


    IF LEDS=2 THEN


    PORTB.0=1


    PAUSE 500


    ENDIF
    goto inicio

  10. #10
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default Re: Ebay HC-12 wireless transceivers

    Maybe you will have better luck in english...

Similar Threads

  1. Reflow Oven in Ebay
    By rsocor01 in forum Off Topic
    Replies: 6
    Last Post: - 20th December 2013, 11:37
  2. eBay Auction (no reserve)
    By T.Jackson in forum Adverts
    Replies: 43
    Last Post: - 13th June 2008, 16:06
  3. PicBasic Pro Ebay Auction
    By tonyfelloni in forum Adverts
    Replies: 1
    Last Post: - 10th January 2008, 12:09
  4. has anyone used chipcon transceivers?
    By grahamwebb2000 in forum General
    Replies: 1
    Last Post: - 28th June 2006, 21:29
  5. Transceivers with 2 different PICs.
    By Eng4444 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 7th June 2006, 10:31

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts