Hobby Components 1602 SmartLCD (HCMODU0122)

LCD, TFT, OLED, LED modules
andrew
Site Admin
Posts: 914
Joined: Sun Aug 05, 2012 4:15 pm

Re: Hobby Components 1602 SmartLCD (HCMODU0122)

Post by andrew » Fri Jun 22, 2018 1:08 pm

This is one of the common sources of confusion when first learning to program in C++. This is because there are two common methods to handle strings which can at first sight look similar to each other but are in fact different and not directly interchangeable. The first type is a C++ String (note the capital) object. This is the type that you are using in your sketch and it's actually a class (think of it like and Arduino library) that each time you create a string your actually creating an instance (a copy of the library) which has a number of member functions and properties associated with it. These then handle the string for you in the background. However, the print function is expecting a different type of string called character string which is just an array of characters with a null terminating byte at the end of it.

The former makes handling strings easier as its handling manipulation (concatenation, comparison, copying, etc) for you in the background. However the disadvantage is that this method is memory intensive. This is not a problem with programming in C++ on a PC with gigs of memory, but on a tiny microcontroller every byte of RAM is important. This is also why the library, being written for Arduinos with small amounts of memory, only makes use of character arrays which using the bare minimum of memory. The option is then there to add your own conversion function if memory isn't an issue in your sketch.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Graywallis
Posts: 9
Joined: Tue Nov 08, 2016 2:39 pm

Re: Hobby Components 1602 SmartLCD (HCMODU0122)

Post by Graywallis » Thu Apr 25, 2019 3:56 pm

Hi,
Is there an older spec sheet for this board? I ask this as my board will not respond to any UART controls from a serial interface in command mode but in Passive mode I can run the display but not quite as the spec sheet describes.
When I remove the mode jumper and connect as Command mode all that happens is I get a "Hello" response from the board when I connect power. Any attempt at commands gives an "ERROR" reply.
Any suggestions welcome.

andrew
Site Admin
Posts: 914
Joined: Sun Aug 05, 2012 4:15 pm

Re: Hobby Components 1602 SmartLCD (HCMODU0122)

Post by andrew » Fri Apr 26, 2019 8:31 am

Is there an older spec sheet for this board? I ask this as my board will not respond to any UART controls from a serial interface in command mode but in Passive mode I can run the display but not quite as the spec sheet describes.
There is currently only one revision of the module and documentation so the information in the manual should be accurate. If you think you may have found something that's not correct then please feel free to point it out so that we can correct it.

When I remove the mode jumper and connect as Command mode all that happens is I get a "Hello" response from the board when I connect power. Any attempt at commands gives an "ERROR" reply.
The fact that you are able to send and receive something from the display tells me you have the correct BAUD rate and connections.

Are you terminating the AT commands with a CR+LF?
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Graywallis
Posts: 9
Joined: Tue Nov 08, 2016 2:39 pm

Re: Hobby Components 1602 SmartLCD (HCMODU0122)

Post by Graywallis » Mon Apr 29, 2019 6:54 pm

Ok. I can get an "OK" response to an AT query. As soon as I add the + symbol then the error appears. However, I can run my little project using Passive mode so it's not really a problem, just a little puzzling. I' m simply typing the commands into a basic terminal program from a Windows 10 laptop. The laptop has the Arduino IDE and works well as a development platform for my fairly Noddy projects.

Graywallis
Posts: 9
Joined: Tue Nov 08, 2016 2:39 pm

Re: Hobby Components 1602 SmartLCD (HCMODU0122)

Post by Graywallis » Mon Apr 29, 2019 7:13 pm

Further to the last. I wrote a little program as shown in one of your spec sheets and while it simply produced an "ERROR" in Command mode, in Passive mode it displayed AT+PR=Hello World. This looked pretty close to the necessary string. Puzzling. I suspect I'm making an obvious mistake but it would be nice to clear it up. I have not tried using I2C with this display but have used I2C for a pressure sensor altimeter.

andrew
Site Admin
Posts: 914
Joined: Sun Aug 05, 2012 4:15 pm

Re: Hobby Components 1602 SmartLCD (HCMODU0122)

Post by andrew » Tue Apr 30, 2019 9:48 am

I' m simply typing the commands into a basic terminal program from a Windows 10 laptop.
Would you by any chance be using the Windows built in terminal program? If so that maybe the issue as it's not very good and causes all kinds of weird problems like that. I've just tested one using Terminal by Br@y. I've posted a screen grab so you can use it as a reference:

Smart_LCD_Terminal_Image.png


Further to the last. I wrote a little program as shown in one of your spec sheets and while it simply produced an "ERROR" in Command mode, in Passive mode it displayed AT+PR=Hello World.

I assume this is the same example sketch that's in the first post of this thread? If it displayed the AT+PR= part of the message then that kind of suggests the screen was still in passive mode. Did you remember to remove the jumper when you ran the sketch?
You do not have the required permissions to view the files attached to this post.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Graywallis
Posts: 9
Joined: Tue Nov 08, 2016 2:39 pm

Re: Hobby Components 1602 SmartLCD (HCMODU0122)

Post by Graywallis » Thu May 02, 2019 11:46 am

In response to comments on my test program from an Arduino Uno. Yes, I used the script in your example document. In Command mode nothing showed on the display (and yes I removed the jumper and did a board reset) but in Passive mode it showed the string I described. As Passive mode works fine then I'll probably give further investigation of the subject a miss. I might try your example terminal program by Br@y instead of Teraterm which has worked well for me in the past. I too find the Windows inbuilt program somewhat problematic.

Post Reply