Colin Tinker
2010-12-18
MYLCD="/var/1-Wire/29.C2A909000000"
SENSOR1=cat /var/1-Wire/10.BC8FF5010800/temperature | sed 's/^*//'
SENSOR2=cat /var/1-Wire/10.BC8FF5010800/temperature | sed 's/^*//'
SENSOR3=cat /var/1-Wire/10.BC8FF5010800/temperature | sed 's/^*//'
SENSOR4=cat /var/1-Wire/10.BC8FF5010800/temperature | sed 's/^*//'
LCD1="$MYLCD/LCD_H/screen"
LCD2="$MYLCD/LCD_H/message"
MSG="$SENSOR1"
MSG="$SENSOR2"
MSG="$SENSOR3"
MSG="$SENSOR4"
printf "\x0C" > $LCD1
printf "1" > $MYLCD/LCD_H/clear
printf "1" > $MYLCD/LCD_H/home
for INDEX in 1 3 2 4
do
printf '%-20s' "Sensor1 ${MSG}" > $LCD1
done
Hope this helps some one.
Colin
Paul Alfille
2010-12-19
Thanks, Colin, this is helpful.
Do you have a picture of the LCD screen so I can use this example on the web
site?
Paul Alfille
Colin Tinker
2010-12-19
Not very good I am afraid but at least it shows it working. I only have the
one sensor so far but intend to add more once all my parts arrive to build the
boards etc. Glad it may be useful to someone, took me a little while to work
out how to use it as there seems to be very little info available. What it
does is send a reset to the screen then a clear and a home cursor hidden. It
then goes through the 4 sensors defined pads the lines to 20 characters each
using printf and prints the values to the screen. Sensor1 could do with being
a variable once I get some more sensors. I will post the update then.
Colin
Colin Tinker
2010-12-19
Here is the updated script which enables setting the sensor names. They are
TEMP to TEMP for a 4 line display.
MYLCD="/var/1-Wire/29.C2A909000000"
SENSOR1=cat /var/1-Wire/10.BC8FF5010800/temperature | sed 's/^*//'
SENSOR2=cat /var/1-Wire/10.BC8FF5010800/temperature | sed 's/^*//'
SENSOR3=cat /var/1-Wire/10.BC8FF5010800/temperature | sed 's/^*//'
SENSOR4=cat /var/1-Wire/10.BC8FF5010800/temperature | sed 's/^*//'
LCD1="$MYLCD/LCD_H/screen"
LCD2="$MYLCD/LCD_H/message"
MSG="$SENSOR1"
MSG="$SENSOR2"
MSG="$SENSOR3"
MSG="$SENSOR4"
TEMP="Sensor1"
TEMP="Sensor2"
TEMP="Sensor3"
TEMP="Sensor4"
printf "\x0C" > $LCD1
printf "1" > $MYLCD/LCD_H/clear
printf "1" > $MYLCD/LCD_H/home
for INDEX in 1 3 2 4
do
printf '%-20s' "${TEMP} ${MSG}" > $LCD1
done
Colin
Colin Tinker
2010-12-19
I forgot to add the display was bought from here for people in the UK
Colin
Patryk
2011-01-09
@g1gsw
I'm having problem making my LCD work. I have 2x16 characters but also on some
HD44780 clone. I have lines P3-P7 and RSTZ connected like on hobby boards
design.
I've connected it on a breadboard for testing and it does not work properly.
When I try to write to the screen or other files I get errors
printf "1" >clear bash: printf: write error : bad argument
Could You tell which version of owfs are you usnig?
Colin Tinker
2011-01-09
My version of owfs is owfs-2.8p4 but it work on p3 as well.
Looking at your code you don't have the full path to clear mine is
/var/1-Wire/29.C2A909000000/LCD_H/clear so the command would be:
printf "1" > /var/1-Wire/29.C2A909000000/LCD_H/clear
Colin
Patryk
2011-01-09
I was in that directory when running printf.
I have a simpler script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/bin/bash MYLCD="/mnt/owfs/29.B3BC08000000/" SENSOR1="12" LCD1="$MYLCD/LCD_H/screen" LCD2="$MYLCD/LCD_H/message" MSG[1]="$SENSOR1" ls -l "$LCD1" #to see that files exists printf "\x0C" > $LCD1 printf "1" > $MYLCD/LCD_H/clear printf "1" > $MYLCD/LCD_H/home #just one line for testing printf '%-16s' "Sensor1 ${MSG[1]}" > $LCD1 |
But when I run it I get an error message form printf: write error Bad
argument.
However after printf "\x0C" > $LCD1 screen goes blank.
How is it possible? Does owfs receive any feedback from LCD?
I've also tried code from this blog it displays some characters but not the ones it
should.
./test.sh --w--w--w- 1 root root 128 2011-01-09 19:02 /mnt/owfs/29.B3BC08000000//LCD_H/screen ./test.sh: line 14: printf: błąd zapisu: Zły argument ./test.sh: line 15: printf: błąd zapisu: Zły argument ./test.sh: line 16: printf: błąd zapisu: Zły argument ./test.sh: line 20: printf: błąd zapisu: Zły argument
Colin Tinker
2011-01-09
I have had no trouble with mine not has a friend we both use the hobby boards
LCD driver purchased from them.
printf "\x0C" > $LCD1 is the initialisation string for the display but I also
believe that printing to screen sends that code as well, can you print to
message after trying a print to screen?
Colin
Patryk
2011-01-09
When I only print to message I also get an error but the screen gets blank
also so I guess owfs initializes my LCD.
I'll try to rewire for LCD_M configuration maybe it will work
Patryk
2011-01-09
OK, It was my mistake. The strobe signal was badly connected to all other line
through a resistor. Now it works in both configurations (Maxim and Hobby
boards)
Sorry for the fuss.
Colin Tinker
2011-01-09
No problem glad you got it working :)
Colin
Patryk
2011-01-10
I have another question. I wired PIO.0 to a transistor and I can control the
backlight. However after writing to message PIO.0 resets and turns off the
backlight. I made a little workaround. I read the value of PIO.0 and restore
it after writing but it's not perfect because LCD goes dark for a second.
I wonder if it's possible to leave alone PIO.0 while writing to the
screen/message.