Sign in

username:

password:



Not a member?

Search 68hc12



Search tips

Subscribe to 68hc12



68hc12 by Keywords

68HC1 | 812A4 | 9S12DP256 | Bootloader | CodeWarrior | D60A | Debugger | DP256 | ECT | EEPROM | EVB | Flash | HC1 | HCS12 | I2C | IAR | ICC1 | Interrupts | LCD | M68KIT912DP256 | MC9S12DP256 | MC9S12DP256B | Metrowerks | Motor | MSCAN | Multilink | PLL | Quadrature | SDI | SPI | Transceiver | XFC


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | 68HC12 | Re: Re: Problems with a 4*20 LCD at a HCS12

Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).

Re: Re: Problems with a 4*20 LCD at a HCS12 - Werner Wittig - Dec 5 4:45:12 2008

if your code runs on the MSP430 I assume that it is a timing problem
during setup of the display. I wrote the code in assembler and did a
lot of cycle counting as the display controller needs some time to
perform the commands

Werner

mailto:w...@wittig-werner.de
> Yes, I know but the same code runs on a MSP430 perfectly. At the HCS12
> it does not run or only the first and third line. It seems that the
> other lines are not initialized. I do not understand why it runs at a
> MSP430 and at the HCS12 not.

> Richard

> --- In 6...@yahoogroups.com, Werner Wittig wrote:
>>
>> The problem is the odd numbering of the lines:
>>
>> The third line is the 21. char of first line
>> the forth line is the 21. char of second line
>> (numbering chars from 1 to ....)
>>
>> Werner
>>
>> mailto:whsw@...
>>
>> > hello,
>>
>> > I am trying to control an 4*20 LCD. I hava a problem to display
> text at the second and fourth line. It is no problem to display text
> at the first and third line. I have no problems in settig the
>> > courser on/off, blinking or not and so on. Everything works except
> for the second and third line.
>>
>> > I tested my code for the display on a MSP430 and there it works
> fine. It is possible to display text at the four lines. So the display
> seems to be ok.
>>
>> > To use the code from the MSP430 I only changed the Ports. I Think
> that it is connected correctly to the HCS12 because it is possible to
> initialize the display and display text on 1. and 3. line.
>>
>> > Does anybody have an idea where the mistake could be?
>>
>> > I am surprised because it runs on the MS430, but on the HCS12 not.
> The code is the same only the ports were just adapted.
>>
>> > It is a HD44780 controller.
>> > Best Regards!
>>
>> > Richard
>> > Here is my code to initialize the display:
>>
>> > void LCDInit(void)
>> > {
>> > PORTA=0x38; // 8 bit Operation, 2-Line-Display, 5*8 dot font
>> > PORTK=0x01; // RS und R/W low, E high
>> > LCDClock();
>> > wait(100);
>> > //PORTA=0x0F; // Display on, Cursor an, Cursor blinking
>> > PORTA=0x0E; // Display on, Cursor an, Cursor not blinking
>> > //PORTA=0x0C; // Display on, Cursor off,
>> > PORTK=0x01; // RS und R/W low, E high
>> > LCDClock();
>> > PORTA=0x06;
>> > PORTK=0x01; // RS und R/W low, E high
>> > LCDClock();
>> > LCDClear();
>> > }
>>
>> > void LCDClock(void)
>> > {
>> > PORTK&=~0x01;
>> > wait(5);
>> > }
>>
>> > void LCDClear(void)
>> > {
>> > row=1;
>> > chars=0;
>> > PORTA=0x01; // Clear Display
>> > PORTK=0x01; // RS und R/W low, E high
>> > LCDClock();
>> > wait(400);
>> > }
>>
>> > void SecondLine(void)
>> > {
>> > PORTA=0xC0;
>> > PORTK=0x01; // RS und R/W low, E high
>> > LCDClock();
>> > row= 2;
>> > chars= 0;
>> > }
>>
>> > void ThirdLine(void)
>> > {
>> > PORTA=0x94;
>> > PORTK=0x01; // RS und R/W low, E high
>> > LCDClock();
>> > row= 3;
>> > chars= 0;
>> > }
>>

------------------------------------



(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )