IBM H8 user manual Lcddatactrl = Lcdin Setlcden

Page 42

HTEB1

User manual

LCD_DATA_CTRL = LCD_IN; SET_LCD_EN;

status = LCD_DATA_PORT; CLEAR_LCD_EN; LCD_DATA_CTRL = LCD_OUT;

return status;

}

 

void LCDInit(void)

// inits the LCD

{

 

u16 cnt=0;

 

CLEAR_LCD_RS;

 

CLEAR_LCD_RW;

 

CLEAR_LCD_EN;

 

PCR7 = 0x30;

// Set RS+RW = Output

PCR2 = 0x01;

// Set EN = Output

LCD_DATA_CTRL = LCD_OUT;

// Set DDR to Output

// required 3 times pls. ref. data sheet

LCDWriteCmd(0x38); // 8Bit-IF, 2

Lines, 5x7 character font

while(--cnt);

 

LCDWriteCmd(0x38); // 8Bit-IF, 2

Lines, 5x7 character font

while(--cnt);

 

LCDWriteCmd(0x38); // 8Bit-IF, 2

Lines, 5x7 character font

while(--cnt);

 

LCDWriteCmd(0x38); // 8Bit-IF, 2

Lines, 5x7 character font

while(--cnt);

 

LCDWriteCmd(0x0c); // DisplayOn,

CursorOff, BlinkingOff

LCDReadStatus();

 

LCDWriteCmd(0x06); // Enter Mode, AutoIncrement

LCDReadStatus();

 

LCDWriteCmd(0x14); // MoveCursor

right

LCDReadStatus();

 

LCDWriteCmd(0x80); // Set DD RAM

Address = 0x00

LCDReadStatus();

 

}

// writesomedata from 1st position in #line (0/1) void LCDWriteLine(u8 line, u8 *data)

{

 

LCDWriteCmd(0x80 + line*0x40);

// select line

while (*data)

 

{

 

LCDWriteData(*data);

 

data++;

 

}

 

}

 

#define ADDR_A (*(volatile unsigned short *)(0xFFB0)) #define ADDR_B (*(volatile unsigned short *)(0xFFB2))

u16 Read_AD(u8 channel)

{

 

u8 dummy;

 

u16 adval;

 

dummy = ADCSR;

// dummy read

ADCSR = 0x00;

// reset A/D

ADCSR = (0x20 + (channel &0x01));

// start A/D, channel 0 or 1

 

while (!(ADCSR & 0x80));

// wait conversion end

 

 

if (channel & 0x01)

adval = ADDR_B;

// read A/D-value

 

else adval = ADDR_A;

 

 

 

return adval>>6;

 

 

}

 

 

 

 

u8

Line0[]

= " A/D#0=P1=0x

\0";

 

u8

Line1[]

= " A/D#1=P2=0x

\0";

 

// convert int to ASCII-HEX

void ShowHexValue(u16 code, u8 line)

Issue 0.2

Page 42

07/2002

Image 42
Contents Hitachi H8/Tiny 3664F Preface Table of Contents System Development Kit content Hardware descriptionFeatures Board overview Board overviewJumpers and switches JP4, D/A CONOrientation Operation Connectors X1 SubD9, Pin Operation RemarkX3 LCD-CON SV1 SV2 SV3 SV4 PIN Installing the HTEB1 Start-Up instructionsTest program Software Installation Creating a program using IAR-EWH8 Development EnvironmentHTEB1 HTEB1 HTEB1 HTEB1 HTEB1 HTEB1 HTEB1 Download the code using FDT HTEB1 HTEB1 HTEB1 HTEB1 HTEB1 HTEB1 HTEB1 Workflow Examples Key’s and LED’s LEDSPEEDINIT4PMR1 &= ~KEYALL RunningLightInit Init keys and LEDs TimerAInit LCD Clearlcdrs Setlcdrw Lcddatactrl = Lcdin Setlcden HTEB1 SCI IsscitxfreeInit sci with 9600Baud, 8N1 A/D + PWM Lcddatactrl = Lcdin Setlcden Calculate av of last 15 values AT-Keyboard-Interface Setlcdrw Lcddatactrl = Lcdin Setlcden Mask = Msg buffer Tables Scan-Codes MFII-Keyboard Numeric Keypad Main Scan-Code Keypad Function Scan-Code Examples DatasheetsPrograms DemoAppendix B Schematic Appendix C Board layout HTEB1 HTEB1 HTEB1