Joep Suijs wrote:
> 2009/3/3 Rob Hamerling <[email protected]>:
>
>> The API change of the lcd libs caused some errors in old samples.
>> I volunteer to correct these (and replace some with new samples), unless
>> you want to do it.
> Thank you for volunteering, please correct/replace what you think is
> desireable.
Before I start, I need to resolve an issue....
After I made a minor change in my sample it doesn't work anymore as
expected. See a (reduced) source below. I expect the first line to
show 012...DEF (char by char), but in stead it is filled with 16 '0'
characters. It looks like the index [i] is not used.
When I change the statement
lcd = line[i]
into
lcd_write_char(line[i])
the expected 012...DEF is shown.
Is this a compiler issue?
Regards, Rob.
> -- ------------------------------------------------------
> include 16f877a -- target PICmicro
> --
> pragma target OSC HS -- HS crystal or resonator
> pragma target clock 20_000_000 -- oscillator frequency
> pragma target WDT disabled -- WDT off
> -- pragma target MCLR external
> --
> enable_digital_io() -- disable analog I/O (if any)
> --
> const byte LCD_ROWS = 2 -- LCD with 2 lines
> const byte LCD_CHARS = 16 -- and 16 characters per line
> --
> var byte lcd_dataport_low is portC_high
> var byte lcd_dataport_high is portD_high
> var bit lcd_en is pin_D3 -- data trigger
> var bit lcd_rs is pin_D2 -- command/data select.
> --
> portC_high_direction = all_output
> portD_high_direction = all_output
> pin_D3_direction = output
> pin_D2_direction = output
> --
> include lcd_hd44780_8
> --
> lcd_init() -- init the lcd controller
> --
> include delay -- fetch delay library
> --
> -- --- generate LCD screen activity ---------
> var byte line[LCD_CHARS] = "0123456789ABCDEF"
> var byte i
> forever loop
> lcd_clear_screen()
> for LCD_CHARS using i loop
> lcd = line[i] -- !! gives all 0
> -- lcd_write_char(line[i]) -- !! give 012...DEF
> delay_100ms(3) -- little pause
> end loop
> end loop
--
Rob Hamerling, Vianen, NL (http://www.robh.nl/)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---