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"):
>
Yes, I remembered as soon as i read it, lcd_k107.jal it is
> """
> <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
> """
I have renamed all procedures per your examples.
>
> 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
> """
>
> 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
^^ do you mean can't??
> "--" at the end fixes the problem:
>
> -- Directions for use of this library in application programs
> -- (in this sequence):
> -- <==== THIS ONE :)
Sorry I'm not understanding that-----
k107_CR has been changed to lcd_k107_cr
>
> 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 !
>
As the k107 only accepts 6 different geometrys, I thing it is better
if this is changed to lcd_k107_init(byte geo) , The gom arg would be a
number between 1 & 6.
> 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:
Yes I forgot to change it when the if,elseif code would not compile.
> - 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.
>
> Sorry for this very long and cryptic mail :) Hope it helps though.
All the unittest is interesting but I can't get that to run here.
>
I keep coming up with very strand errors when using the library.
ie:
const byte LCD_CHARS =20 (Which is also declared in serial_sw_write)
which I include before the lcd_k107
If I declare it in the sample program, I get errors in the lcd_k107.jal
LCD_CHARS not declared
If I declare it in the library
var byte init1[LCD_CHARS] = "?G216" -- Compiler says constant expected
But it seems to work ok in the sample 16f648a_lcd_hd44780_4_1.jal which
it that way.
var byte line1[LCD_CHARS] = "<= 2 x 16 LCD =>"
Maybe the compiler does not like the? (?????)
I tried to replace the case part of lcd_k107_init with the it/elseif
and I get elseif not declared. It's in the use guide so I must just be
screwing things up. I don't know how tho.
I plan to put the lib aside, for now, and concetrate on the sample
program. I will switch to assembly if necessary. I have 8-10 LCD's and
4 K107's so I have to get something working soon. I am not getting younger.
Thanks for the pointers Seb. I really appreciate the guidance.
Regards
Wayne
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---