PM: 2.8" LCD board for the PM...


Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9203
Posted: 04:32am 02 Nov 2022      

Re: HC website - NO, and that's the problem.  
If you surf on over to their website, you will find it is all in Chinese, with no English option.  That's why most people buy them from eBay or AliExpress, but there is no way to know if you will get a clone or not.

Last time I ordered from HC directly, they had a MOQ of 50pcs, so you have to buy at least 50 if you order from them.  I think that the MOQ came in, along with many other things, cos of the virus.

I do have the genuine article here - flick me an email(I think you have my email) if you want me to sell you a couple.  I don't have a huge number in stock, but I could probably see you right for a small handful depending on what you need.  They are the genuine article sourced from HC though, so you know you will be getting the genuine article.

As to code, by default, they are 9600 baud, so without changing any settings in the module, you should be able to hook them up to the COM port and talk between them using 9600 baud.

An example transmitting test code:


DIM A$
OPEN "COM1:9600" AS #1
DO
 Input "Type a message: ", A$
 PRINT #1,A$
LOOP



An example receiving test code:


DIM A$
OPEN "COM1:9600" AS #1
DO
 DO:LOOP UNTIL LOC(#1)<>0 'Wait till something arrives in buffer
 PAUSE 150 'Allow time for data to arrive in buffer
 A$=INPUT$(LOC(#1),#1) 'Suck everything out of buffer, stick it in A$
 PRINT A$
LOOP


Use CTRL+C to break out of either of those running codes.
On BOTH PicoMites, COM1 is being used, but you could make that COM2 - this is just a quick example as requested.

This should work on any HC12's fresh out of the box, without any configuration changes at all to the modules, as by default, the HC12 is factory set to 9600 baud.

Only thing to ensure you do, is that the HC12 is fed from the 3v3 pin on the PM module, and that the SET line on the HC12 module is left floating. (it has an internal pull-up)  If SET is low, the module thinks you want to make changes to its settings, so just ignore that pin for now anyway.

EDIT: Remember that the silkscreen pin markings are with respect to the module, so RXD is data in from the PM module, and TXD is data out of the HC12 to the PM module.
I trust you have the HC12 datasheet.  Let me know if not, and I can upload it to this thread.  The datasheet is an English translation version, so it is easy to understand.
Edited 2022-11-02 14:37 by Grogster