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.
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.
which would be not at allIt works as expected when wired direct.
tx true level @38400 baud
rx inverted @9600 baudSEROUT PORTC.5,6,[2] 'sends 2 to the HC-12 every 3 seconds
SERIN2 PORTB.2,16468,3000,OVER,[V1]
Warning I'm not a teacher
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 00:04.
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
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
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
Bookmarks