Sebastien Lelong wrote:
> Hi Wayne,
> 
> 
>> (1)---------------
>> Assuming that the col is 12
>>
>> var byte clm[] = "12"
>> lcd_k107_col(clm[])   -- don't even know if this is correct
>>
>> procedure lcd_k107_col(byte in clm) is
>>  serial_sw_write("?")
>>  serial_sw_write("y")
>>  for (COUNT(clm) using i loop
>>    serial_sw_write(clm[i])
>>  end loop
>> this works but is not as efficient as I would like
>> which just seems like it requires too much code space
>>
> 
> If col is 12, why don't you pass 12, the integer ? Your procedure then has
> to translate this to "1" and "2" (divide by 10, blablabla). Maybe you can
> even use print.jal or format.jalprint.jal for this. Or did I misunderstand 
> something
> ?

Because I did not find any samples of how to use print.jal or format.jal
with serial_sw_write.  I don't really understand enough to figure that out.

I would like to know if they would work though.

> 
>> (2)------------------------
>> why not do it in the program
>> var byte line_col[] = ("?y02?x12")
>> for COUNT(line_col[])
>> serial_sw_write  to send the string
>> done
>>
> 
> I would consider this as a "leak" API. User doesn't have to care about how
> it works behind the scene.
> 
> 
>> If you want the line done by itself the string would be "?y02"
>> if you want to change the # "4" at that line then ""?y##5"
>>
>> I have attached the latest samples, Lib and a picture of what the display
>> shows.  You will notice that i have not used any of the
>> library routines.  The mow code I write, I find that I have not needed any
>> of them.  Admittedly, I have only done the samples and a preliminary
>> screen for my application in which I have, currently, 4 screens.  Each
>> screen has fixed text and I only change values on each screen (go to line &
>> column rewrite results).  The screens rotate every 10 seconds
>> now but I want to incorporate 4 push buttons to call up any one I want to
>> continuously monitor.
> 
> 
> Sorry but I don't have much time right now to dive into this... These
> Jallib/Jaluino books are taking all my time, I didn't write a single jal
> line code for two months :)

Well I believe that the lcd_k107.jal is usable , as is, to add to the 
library.  You have the samples and the library.  I leave it to you, or 
some other developer, to make that decision.  I am using it in my 
application now.  But, IFAIK, I'm the only one that has any k107 
Backpacks to experiment with.  :-(   Maybe if it is added, and people 
know it is in jallib, we will have others to test it too.

If I learn enough from the Tutorial books, maybe then I can use the 
print.jal or format.jal to do as you suggest. I open to suggestions
and hints.

Thanks and regards

Wayne

PS I hope that this gets to the list as well as to you Seb.
> 
> Cheers,
> Seb
> 
> 
> 
> 
>>> Cheers,
>>> Seb
>>>
>>> 2009/11/23 Wayne <[email protected]>
>>>
>>>  Sebastien Lelong wrote:
>>>>  Hi Wayne,
>>>>> First of all, the filename itself should contain "lcd". I think
>>>>> "lcd_k107.jal" would be ok, following this section from JSG (
>>>>> http://code.google.com/p/jallib/wiki/JallibStyleGuide, section "Rules
>>>>> of
>>>>> Thumb/Filenames"):
>>>>>
>>>>> """
>>>>> <device-family>_<device>.jal for external libraries [this is the case
>>>>> here,
>>>>> right ?]. device-family describes the device family (...), and is often
>>>>> the
>>>>> directory name where the lib is. device precisely sets the part.
>>>>>
>>>>> Ex: lcd_hd44780_4.jal, rtc_ds1302.jal, co2_t6603.jal
>>>>> """
>>>>>
>>>>>
>>>>> JSG validator also says ("jallib validate k107.jal"):
>>>>>
>>>>> """
>>>>> File: k107.jal
>>>>> 2 errors found
>>>>>       ERROR: Cannot find end of field content Description
>>>>>       ERROR: 105: Found Capitals in token: 'k107_CR'
>>>>>
>>>>> 0 warnings found
>>>>> """
>>>>>
>>>>>  I changed the sample progrms to comply, I hope.
>>>>
>>>>  Mmmh... OK, so "k107_CR" should be "k107_cr". This other error is
>>>>
>>>>> trickier:
>>>>> it can't find "Description" field, while there's one ! Why ? Actually,
>>>>> it
>>>>> can find the end of the section, so the whole section is ignored. Adding
>>>>> a
>>>>> "--" at the end fixes the problem:
>>>>>
>>>>> --    Directions for use of this library in application programs
>>>>> --    (in this sequence):
>>>>> --    <==== THIS ONE :)
>>>>>
>>>>>
>>>>> About k107_init, it takes an argument for the geometry. I guess it
>>>>> describes
>>>>> the number of rows and columns. Ex: 416 is a 4 rows and 16 columns LCD,
>>>>> right ? I would have preferred specifying rows and cols separately,
>>>>> maybe
>>>>> more user-friendly. But that's a matter of taste !
>>>>>
>>>>>
>>>>>  Yes the init is to program the k107 16f628a/648a eeprom to set it up
>>>> for a
>>>> 4x20 LED (in this example).  There are seperate row and col routines that
>>>> go
>>>> 'directly' to the LCD. the init, a 3 other routines, are ysed once to
>>>> program the k107 eeprom and are not needed again unless you change LCDs.
>>>>  ie
>>>> change a 4x20 to 2x24 requires a change in the k107 chip.
>>>>
>>>> I have added more information under the "Directions for use".
>>>>
>>>>  Thinking again about your "case" impl., I wonder how defining both "var
>>>>
>>>>> byte
>>>>> cmd[]" and "const byte cmd[]" behaves... More, if "geo" can be 416 or
>>>>> 420,
>>>>> then it must be a "word", not a "byte". And here I've found interesting
>>>>> things... Here's a program I've written including unittest:
>>>>>
>>>>>  - test_orig.jal: I took your case, and adapt it so I can run unittests
>>>>> on
>>>>> it. Basically, I removed arrays
>>>>>
>>>>>  If you have last jallib from trunk, jallib.py and PICShell installed
>>>>> with
>>>>> correct PYTHONPATH, you can run:
>>>>>
>>>>>   python jallib.py unittest test_orig.jal
>>>>>
>>>>> this will give:
>>>>>
>>>>> test_orig.jal compiled, running tests...
>>>>> test_test : OK
>>>>> test_geo : FAIL, 416 != 0
>>>>>
>>>>>
>>>>> (you can also use PICShell's GUI)
>>>>>
>>>>> Mmmh... cmd is 0, that is the initialized value. Weird. Does "var byte
>>>>> cmd"
>>>>> and "const byte cmd" are allowed on the same scope ? It seems not, and
>>>>> it
>>>>> seems logical. When using block... end block, a new scope is created.
>>>>> Looks
>>>>> like your const assignement has fade away.
>>>>>
>>>>> Another test:
>>>>>
>>>>>  - test_noconst.jal : I remove "const", that I directly assign to "cmd"
>>>>> being declared as "var byte cmd" before the "case". Also converted byte
>>>>> to
>>>>> word as needed.
>>>>>
>>>>> Results are:
>>>>>
>>>>> test_noconst.jal compiled, running tests...
>>>>> test_test : OK
>>>>> test_geo : OK
>>>>>
>>>>>
>>>>> Good ! Another test...
>>>>>
>>>>>  - test_noconst_noassign.jal : removed cmd assignement to 0.
>>>>>
>>>>> Results:
>>>>>
>>>>> test_noconst_noassign.jal compiled, running tests...
>>>>> test_test : OK
>>>>> test_geo : FAIL, 416 != 160
>>>>>
>>>>>
>>>>> Weird ! Looks like it ate some of the bits, just as though it couldn't
>>>>> handle "word" in the case. Last test
>>>>>
>>>>>  - test_byteonly.jal: same as before, but with "byte"
>>>>>
>>>>> Results:
>>>>>
>>>>> test_byteonly.jal compiled, running tests...
>>>>> test_test : OK
>>>>> test_geo : OK
>>>>>
>>>>>
>>>>> It works !
>>>>>
>>>>> This should be tested for real to check, but if I were you, I would dig
>>>>> this
>>>>> "case", there are weird things about it.
>>>>>
>>>>>  Done!  ??? dig = dump? as in throw away this junk code?  :-)
>>>>
>>>>  Sorry for this very long and cryptic mail :) Hope it helps though.
>>>> No need to be sorry.  This is what I was hoping for.  I have
>>>>
>>>>  --
>>>>>>
>>>>>>
>>>>>> -----------------------------------------------------------------------------
>>>>>> -- Title: LCD library for the k107 Serial Backpack
>>>>>> -- Author: Wayne Topa, Copyright (c) 2008..2009, all rights reserved.
>>>>>> -- Adapted-by:
>>>>>> -- Compiler:  >=2.4k
>>>>>> --
>>>>>> -- This file is part of jallib (http://jallib.googlecode.com)
>>>>>> -- Released under the ZLIB license (
>>>>>> http://www.opensource.org/licenses/zlib-license.html)
>>>>>> --
>>>>>> -- Sources:
>>>>>> --
>>>>>> -- Description:
>>>>>> --    Serial interface for K107 (and similar) serial LCD backpack for
>>>>>> -- 2x16 to 4x20 HD44780 compatible alphanumeric LCD displays.
>>>>>> -- .
>>>>>> --    Expects: - 1 pin from Pic to K107
>>>>>> -- .
>>>>>> --    Directions for use of this library in application programs
>>>>>> --    (in this sequence):
>>>>>>
>>>>>>
>>>>>> -- define in calling program or here ???
>>>>>> const byte K107_CHARS = 20
>>>>>> var byte i
>>>>>> -- var byte cmd[]
>>>>>>
>>>>>>  This was removed and seperate routines to intitalize are put into the
>>>> sample programs.  see below
>>>>
>>>>
>>>>  procedure k107_init(byte in  geo) is
>>>>
>>>>>  var byte cmd[]
>>>>>>  case geo of
>>>>>>      216: block const byte cmd[] = "?G216" end block
>>>>>>      220: block const byte cmd[] = "?G220" end block
>>>>>>      224: block const byte cmd[] = "?G224" end block
>>>>>>      240: block const byte cmd[] = "?G240" end block
>>>>>>      416: block const byte cmd[] = "?G416" end block
>>>>>>      420: block const byte cmd[] = "?G420" end block
>>>>>>  end case
>>>>>>  for 5 using i loop
>>>>>>      serial_sw_write(cmd[i])
>>>>>>  end loop
>>>>>> --  delay required when writing to K107 EEPROM
>>>>>>  delay_100ms(2)
>>>>>> end procedure
>>>>>>
>>>>>>  in addition to the init routine
>>>> The 3 functions, below, have been removed from the library.  They are
>>>> used only when first initializing a particular LCD.  Once initialized the
>>>> code is no longer needed so why use the code space.
>>>>
>>>>
>>>>  -- Tab size can be 1-8
>>>>
>>>>> procedure k107_tabsize(byte in tab) is
>>>>>>  serial_sw_write("?")
>>>>>>  serial_sw_write("s")
>>>>>>  serial_sw_write(tab)
>>>>>>  delay_100ms(2)
>>>>>> end procedure
>>>>>>
>>>>>> procedure k107_cursor_style(byte in c_style) is
>>>>>>  serial_sw_write("?")
>>>>>>  serial_sw_write("c")
>>>>>>  serial_sw_write(c_style)
>>>>>>  delay_100ms(2)
>>>>>> end procedure
>>>>>>
>>>>>> -- Back Light settings 00 to FF hex. Use 80 or less normally
>>>>>> procedure k107_backlight(byte in bl) is
>>>>>>  serial_sw_write("?")
>>>>>>  serial_sw_write("s")
>>>>>>  serial_sw_write(bl)
>>>>>> end procedure
>>>>>>
>>>>>> -- goto line
>>>>>>
>>>>>>  The column procedure is stumping me so is not included in the current
>>>> library.
>>>>
>>>> I have to call the go to column routine with with bytes and I'm not happy
>>>> with the methods I have tried.  The column number is 2 digits
>>>> 00 up to 49. This is why I did not use it in the samples.
>>>> I have looked at & tried many variations but am still not satisfied
>>>> with the results.
>>>>
>>>> it could be
>>>> var byte ln_col[] = ("?y{0-3}?x{00-39}")
>>>> so the use would be
>>>> for COUNT(ln_col) using i loop
>>>> serial_sw_write(ln_col[i])
>>>> end loop
>>>> This could be done in a program but I can't figure out how to do it,
>>>> nicely, in the library.
>>>>
>>>>
>>>>  -- goto column
>>>>
>>>>> This prodedure does not work!!!  DUMP IT
>>>>>>   procedure k107_goto_column(byte in cl) is
>>>>>  serial_sw_write("?")
>>>>>>  serial_sw_write("x")
>>>>>>  serial_sw_write(cl)
>>>>>> end procedure
>>>>>>
>>>>>>   serial_sw_write("a")
>>>>>  end procedure
>>>>>>  Thank's for the comments, they are really appreciated!!!
>>>> I am attaching a photo that shows the a static view of a display.
>>>> The samples I have, for the 628a, 88 and 688 have the screen rewritten
>>>> for
>>>>
>>>>
>>>> Best Regards
>>>>
>>>> Wayne
>>>>
>>>> --
>>>>
>>>> -----------------------------------------------------------------------------
>>>> -- Title: LCD library for the k107 Serial Backpack
>>>> -- Author: Wayne Topa, Copyright (c) 2008..2009, all rights reserved.
>>>> -- Adapted-by:
>>>> -- Compiler:  >=2.4l
>>>> --
>>>> -- This file is part of jallib (http://jallib.googlecode.com)
>>>> -- Released under the ZLIB license (
>>>> http://www.opensource.org/licenses/zlib-license.html)
>>>> --
>>>> -- Sources:
>>>> --
>>>> -- Description:
>>>> --    Serial interface for K107 (and similar) serial LCD backpack for
>>>> --  2x16, 20, 24 or 40 characters as well as 4x16 or 20 character
>>>> --  HD44780 compatible alphanumeric LCD displays.
>>>> -- .
>>>> --    Expects: - 1 pin from Pic to K107 and +5 and Gnd.
>>>> -- .
>>>> --    Directions for use of this library in application programs
>>>> --    (in this sequence):
>>>>
>>>>
>>>> var byte i
>>>>
>>>>
>>>>
>>>> --  home cursor
>>>> procedure lcd_k107_home()  is
>>>>   serial_sw_write("?")
>>>>   serial_sw_write("a")
>>>> end procedure
>>>>
>>>> -- CLRF, cursor at start of line, line cleared
>>>> procedure lcd_k107_clrf()  is
>>>>       serial_sw_write("?")
>>>>       serial_sw_write("n")
>>>> end procedure
>>>>
>>>> -- tab, advances display one tab postiion
>>>> procedure lcd_k107_tab()  is
>>>>   serial_sw_write("?")
>>>>   serial_sw_write("t")
>>>> end procedure
>>>>
>>>> -- carrage return, cursor to start of current line
>>>> procedure lcd_k107_cr()  is
>>>>   serial_sw_write("?")
>>>>   serial_sw_write("m")
>>>> end procedure
>>>>
>>>> -- clear current line, cursor goes to start of current line
>>>> procedure lcd_k107_clr_line_home() is
>>>>   serial_sw_write("?")
>>>>   serial_sw_write("l")
>>>> end procedure
>>>>
>>>> -- clear screen and leave cursor at home position
>>>> procedure lcd_k107_clear()   is
>>>>   serial_sw_write("?")
>>>>   serial_sw_write("f")
>>>> end procedure
>>>>
>>>> -- Non-destructive backspace
>>>> procedure lcd_k107_cur_back_1_no_del() is
>>>>   serial_sw_write("?")
>>>>   serial_sw_write("h")
>>>> end procedure
>>>>
>>>> -- destructive backspace
>>>> procedure lcd_k107_cur_back_1_del() is
>>>>   serial_sw_write("?")
>>>>   serial_sw_write("b")
>>>> end procedure
>>>>
>>>> -- forward cursor
>>>> procedure lcd_k107_cur_forward_1() is
>>>>   serial_sw_write("?")
>>>>   serial_sw_write("i")
>>>> end procedure
>>>>
>>>> -- down cursor
>>>> procedure lcd_k107_cur_down_1() is
>>>>   serial_sw_write("?")
>>>>   serial_sw_write("j")
>>>> end procedure
>>>>
>>>> -- up cursor
>>>> procedure lcd_k107_cur_up_1() is
>>>>   serial_sw_write("?")
>>>>   serial_sw_write("k")
>>>> end procedure
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
> 
> 

--

You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.


Reply via email to