background image

BEGV643A User Manual Ver.0

2

  

79 

4-3-3-5 Touch function 

Header file : touch.h, a2d.h 
object file : touch.o, a2d.o 

touchInit Function:

 Initial Touch panel. 

Syntax

void touchInit( 

);

Parameters

None. 

Return value

None. 

touchGet Function:

 to read touch data from touch panel 

Syntax

uint8_t touchGet( 

int *   

pX, 

int *   

pY 

);

Parameters

pX     

 

to read X Coordinate from touch data 

pY     

 

to read Y Coordinate from touch data 

Return value

TRUE 

 

data of pX and pY is true 

FALSE     

data of pX and pY is false 

touchDrawCalPoint Function:

 to draw Calibration cross Coordinate on LCD 

Syntax

uint8_t touchDrawCalPoint ( 

POINT*   ptCal, 
int    

);

Parameters

ptCal  

 

Calibration Coordinate.  

 

  Calibration 

Coordinate 

No. 

Return value

None. 

setCalibrationMatrix Function:

 to set Calibration calculation matrix 

Syntax

void setCalibrationMatrix( 

POINT *    ptDisplay, 
POINT *    ptTouch, 
int    

);

Parameters

ptDisplay    

LCD reference Coordinate for calibration. 

ptTouch     

Touch Coordinate for calibration 

n   

 

 

Coordinate No. for calibration 

Return value

None. 

getDisplayPoint Function:

 to change Touch Coordinate into LCD   

Syntax

void getDisplayPoint( 

int   x, 
int   y, 
int *  pX, 
int *  pY 

);

Parameters

x   

 

Touch X Coordinate. 

y    

Touch Y Coordinate. 

pX   

LCD X Coordinate changed from Touch X Coordinate 

pY   

LCD Y Coordinate changed from Touch Y Coordinate 

Return value

None. 

Summary of Contents for BEGV643A Series

Page 1: ...D Embedded System Atmel ATmega644p MCU Graphic 320x240 STN LCD LED white backlight RS232 RS422 RS485 I2 C SPI 64KB in system programmable Flash No Operating System required Bolymin Inc www bolymin com...

Page 2: ...t Mapping P21 3 2 1 LCD Controller P21 3 2 2 Touch Panel P21 3 2 3 RS 232 RS 422 RS 485 P21 3 2 4 Enable Backlight P21 3 2 5 EEPROM I2 C P21 3 2 6 2 wire serial port P21 3 2 7 SPI P22 3 2 8 General I...

Page 3: ...BEGV643A User Manual Ver 02 3 Precaution FCC This device is designed to meet the requirement in part 15 of the FCC rules Operation is subject to conditions ruled under FCC part 15 WARNING CAUTION...

Page 4: ...pon receiving BEGV643A parcel make sure that all materials and options are packed inside parcel according to your order Packing Contents Check List BEGV643A LCD Embedded module Touch panel Software Ut...

Page 5: ...ct This chapter is to offer you basic information regarding BEGV643A to help you incorporate BEGV643A into your system Contents include 1 1 Features 1 2 Board Layout 1 3 Block Diagram 1 4 Mechanical D...

Page 6: ...automation equipment medical equipment parking system ticketing system and so on There are five LCD colors among choices STN gray STN yellow green STN blue FSTN Positive and FSTN negative All comes wi...

Page 7: ...BEGV643A User Manual Ver 02 7 1 3 Block Diagram Drawing 1 3 1 4 Mechanical Dimension Drawing 1 4...

Page 8: ...MEL ATmega644P Memory 64K Bytes In System Self Programmable Flash 2K Bytes Internal EEPROM 4K Bytes Internal SRAM 3 x 64K Bytes External EEPROM optional Display Support 8 bit single scan resolution 32...

Page 9: ...Abstract This chapter is to offer designer fundamental information of BEGV643A jumpers and connectors in order to help designer configure correct setting and connection between BEGV643A and system app...

Page 10: ...ote jumpers not described here are intended to keep as factory default setting Please consult Bolymin before trying to change default setting The table listed below describes location and function of...

Page 11: ...short Connect metal frame with GND open Not connected metal frame with ground default 2 1 3 RS 422 RS 485 VDD Ground Drawing 2 1 3 S2 S3 RS 422 RS 485 VDD Ground short short internal VDD ground for is...

Page 12: ...nnected screw hole with ground default 2 2 Connectors Connectors are the key link between BEGV643A and external devices Detail locations and functions of available connectors are tabled and illustrate...

Page 13: ...2 EEPSDA 3 VDD 4 EEPSCL 5 NC 6 EEPWP 7 NC 8 IOB 9 Reset 10 NC 11 SS 12 NC 13 MOSI 14 NC 15 MISO 16 NC 17 SCK 18 NC 19 RX0 20 NC 21 TX0 22 NC 23 RX1 24 NC 25 TX1 26 NC 27 SDA 28 NC 29 SCL 30 NC 31 IOA...

Page 14: ...ound for isolated RS 422 485 ground2 GND2 P 26 External Ground for isolated RS 422 485 ground2 Pin No Signal Pin No Signal 1 GND 2 EEPSDA 3 VDD 4 EEPSCL 5 NC 6 EEPWP 7 NC 8 IOB 9 Reset 10 NC 11 SS 12...

Page 15: ...2 wire serial interface it can be programmed as IO SCL U 29 Clock of 2 wire serial interface it can be programmed as IO EEPSDA Bi 2 Data of 2 wire serial interface for additional EEPROM update EEPSCL...

Page 16: ...to ATmega644p via ATMEL AVR ISP MKII writer without taking ATmega644p IC off board Please visit following website for more information on AVR ISP MKII writer http www atmel com dyn products tools_card...

Page 17: ...C EEPROM BEGV643A offers I2 C port Via this I2 C port designer may control 64Kbytes x 3 EEPROM in system and external I2 C devices BEGV643A VDD GND GND 5V EEPSCL EEPSDA EEPWP EEPROM EEPROM M icroproce...

Page 18: ...2 Recever RS 422 Recever RS 422 Transmitter RS 422 Transmitter RS 422 Transmitter RS 422 Transmitter RS 422 Recever RS 422 Recever VDD2 RS 422 isolated power GND2 RS 422 isolated ground BEGV643A VDD G...

Page 19: ...pter 3 MCU port mapping Abstract This chapter explains ATmega644p MCU pin configuration and port mapping toward key elements such as LCD Touch Panel RS 232 RS 422 RS 485 LED Backlight EEPROM I2 C 2 wi...

Page 20: ...BEGV643A User Manual Ver 01 20 3 1 MCU Pin Configuration Drawing 3 1 ATmega644p MCU...

Page 21: ...ATmega644P Touch Panel PORTA 0 X1 PORTA 1 Y1 PORTA 2 X2 PORTA 3 Y2 3 2 3 RS 232 RS 422 RS 485 Table 3 2c MCU ATmega644P RS 232 422 485 PORTD 0 RX0 PORTD 1 TX0 PORTD 2 RX1 PORTD 3 TX1 Table 3 2d MCU A...

Page 22: ...BEGV643A User Manual Ver 02 22 3 2 7 SPI Table 3 2h MCU ATmega644P SPI PORTB 4 SS PORTB 5 MOSI PORTB 6 MISO PORTB 7 SCK 3 2 8 General I O Table 3 2i MCU ATmega644P General I O PORTA 4 IOA PORTA 7 IOB...

Page 23: ...EGV643A User Manual Ver 02 23 Chapter 4 Software Development Tool Utility Abstract This chapter explains ATmega644p MCU software development tool AVR ISP mkII writer and Bolymin free software utilitie...

Page 24: ...ebsite http www atmel com dyn products tools_card asp tool_id 2725 or from BOLYMIN utility disk 4 1 1 Download software from AVR Studio website step1 Download design software Step2 install AVR studio...

Page 25: ...BEGV643A User Manual Ver 02 25...

Page 26: ...BEGV643A User Manual Ver 02 26 Accept terms to continue...

Page 27: ...BEGV643A User Manual Ver 02 27 Select folder to install and continue...

Page 28: ...BEGV643A User Manual Ver 02 28 Select features to install and continue...

Page 29: ...BEGV643A User Manual Ver 02 29 Click install to begin installation...

Page 30: ...BEGV643A User Manual Ver 02 30 Wait for seconds for installation...

Page 31: ...BEGV643A User Manual Ver 02 31 Click finish to exit the installation...

Page 32: ...guage designers additionally please download and install AVR gcc from http sourceforge net project downloading php group_id 68108 filename WinAVR 20090313 install exe a 6759369 Double click to install...

Page 33: ...BEGV643A User Manual Ver 02 33 Click I agree to continue Choose folder to continue...

Page 34: ...BEGV643A User Manual Ver 02 34 Choose components to install Wait for seconds for installation...

Page 35: ...BEGV643A User Manual Ver 02 35 AVR Studio and AVR gcc software are also available on Bolymin utility disk or Bolymin website Click finish to exit installation...

Page 36: ...3A User Manual Ver 02 36 4 2 Execute AVR Studio 4 16 on designer PC Start All programs Atmel AVR Tools AVR Studio 4 Click New Project to start Choose Atmel AVR Assembler assembly language or AVR GCC C...

Page 37: ...V643A User Manual Ver 02 37 Choose AVR GCC here All Bolymin utility drivers are designed with C code and key in Project Name and Initial file Choose AVR Simulator ATmega644P and click Finish to contin...

Page 38: ...BEGV643A User Manual Ver 02 38 Choose Project Configuration Options to continue Here you can see software design screen yet no hurry to start software design yet...

Page 39: ...BEGV643A User Manual Ver 02 39 Choose General and key in necessary information to continue Choose Include Directories and Include File Search Path to continue...

Page 40: ...BEGV643A User Manual Ver 02 40 Choose Include as File Search Path to continue Click Yes to continue...

Page 41: ...BEGV643A User Manual Ver 02 41 After executing AVR Studio 4 16 on PC designer can see key information on 5 windows 1 Project management window 1 5 3 2 4...

Page 42: ...BEGV643A User Manual Ver 02 42 2 Program editing window...

Page 43: ...BEGV643A User Manual Ver 02 43 3 I O view window 4 Message window 5 Toolbars...

Page 44: ...BEGV643A User Manual Ver 02 44 4 3 In System Programmer AVR ISP mkII Inside mkII box 1 designer will get DVD 2 mkII device 3 and USB cable 4 Please be sure that all parts are packed inside 1 2 3 4...

Page 45: ...BEGV643A User Manual Ver 02 45 Steps 1 Get mkII connected to PC Choose Tools Program AVR Connect to continue Choose AVRISP mkII USB Connect to continue...

Page 46: ...BEGV643A User Manual Ver 02 46 Choose Hex file for ATmega644p flash Program Choose Hex file for ATmega644p EEPROM Program Choose ELF file for fuses and lockbits Program...

Page 47: ...BEGV643A User Manual Ver 02 47 Start software burning Choose Auto and necessary configure and click Start to program...

Page 48: ...BEGV643A User Manual Ver 02 48 Good job Software burning is done...

Page 49: ...02 49 Product Function Verify On PC Start All programs Telecommunication Hyper Terminal Please define a name and choose a icon for this connection and click Yes to continue Choose a suitable COM port...

Page 50: ...BEGV643A User Manual Ver 02 50 Key in COM port setting 115200 8 No 1 No and click Yes to continue...

Page 51: ...r 3 for ATmega644P internal EEPROM function test D Enter number 4 for 4 wire SPI Master function test E Enter number 5 for 4 wire SPI Slave function test F Enter number 6 to touch panel function test...

Page 52: ...ROM 3 Enter number 3 for I2 C EEPROM function test 3rd EEPROM 4 Enter number 0 to return to main screen 1 Enter number 1 to write 55 on current screen 2 Enter number 2 to write AA on current screen 3...

Page 53: ...for 2nd UART function test 1 Enter number 1 to send 1 byte 0x55 2 Enter number 2 to send 1 byte 0xAA 3 Enter number 3 to send 1 word 0x5555 4 Enter number 4 to send 1 byte 0xAAAA 5 Enter number 0 to...

Page 54: ...panel calibration data 1 Enter number 1 to write 55 on current screen 2 Enter number 2 to write AA on current screen 3 Enter number 3 to write 00 on current screen 4 Enter number 4 to write FF on curr...

Page 55: ...number 4 for 4 wire SPI Master function test 1 Enter number 1 to send 1 byte 0x55 2 Enter number 2 to send 1 byte 0xAA 3 Enter number 3 to send 1 word 0x5555 4 Enter number 4 to send 1 byte 0xAAAA 5 E...

Page 56: ...BEGV643A User Manual Ver 02 56 E Enter number 5 for 4 wire SPI Slave function test 1 Enter number 1 to receive 1 byte 2 Enter number 2 to receive 1 word 3 Enter number 0 to return to main screen...

Page 57: ...ber 6 to read from touch panel 1 Using light pen to touch a point on touch panel 2 X Y values are touch panel coordinates 3 DX DY values are LCD coordinates DX 0 DY 0 if touch panel is not calibrated...

Page 58: ...ch panel calibration 5 point 1 On the LCD designer will see displays Please use light pen to touch center point of until it turns to be Such one point is calibrated 2 Please repeat above process to ca...

Page 59: ...2 to LCD show vertical line 3 Enter number 3 to LCD show horizontal line 4 Enter number 4 to LCD show half 5 Enter number 5 to LCD show cross dot 6 Enter number 6 to LCD show character 7 Enter number...

Page 60: ...BEGV643A User Manual Ver 02 60 H line Half Cross dot Character Picture1 Picture2...

Page 61: ...Manual Ver 02 61 I Enter number 9 for backlight brightness adjustment function test 1 Enter number 1 to backlight brightness 5 2 Enter number 2 to backlight brightness 5 3 Enter number 0 to return to...

Page 62: ...r RS 232 485 422 www bolymin com tw embedded utility BEGV643A uartdriver zip z SPI Driver www bolymin com tw embedded utility BEGV643A spidriver zip z I2 C Driver www bolymin com tw embedded utility B...

Page 63: ...ment phase However designer may develop your own software utilities if you find Bolymin utilities is not convenient to use On following paragraphs we explain the way to add Bolymin software utilities...

Page 64: ...BEGV643A User Manual Ver 02 64 Choose Include as File Search Path to continue...

Page 65: ...BEGV643A User Manual Ver 02 65 Note For touch panel calibration Floating point operations is necessary so please add libm a and libprintf_flt a in WinAVR...

Page 66: ...BEGV643A User Manual Ver 02 66...

Page 67: ...BEGV643A User Manual Ver 02 67 Note Adding into Obj...

Page 68: ...BEGV643A User Manual Ver 02 68...

Page 69: ...BEGV643A User Manual Ver 02 69 Note choose Linker Options...

Page 70: ...BEGV643A User Manual Ver 02 70 Note key in Wl u vfprintf and then Add...

Page 71: ...E EVEN O ODD uDatabit data bit 5 8 uStopbit data bit 1 2 nTxMode Transmission Mode 0 or FALSE RS232 1 or TRUE RS485 or RS422 Return value None uartSetBaudRate Function to set up baud rate for assigne...

Page 72: ...int8_t buffer uint16_t nBytes Parameters byPort UART_PORT0 1st Uart port UART_PORT1 2nd Uart port buffer index of buffer to be sent nBytes bytes of buffer to be sent Return value None uartReceiveByte...

Page 73: ...RT_PORT0 1st Uart port UART_PORT1 2nd Uart port Return value None uartEnableTx Function to Enable or Disable UART transmitter When UART port is applied on RS485 or RS422 transmitter must be set to Dis...

Page 74: ...vAddr I2 C device address address of three 24c512 on board are A2hex A4hex A6hex nAddr address to write in Return value Data reading from I2 C i2cWriteByte Function to write 1 byte data from I2 C Synt...

Page 75: ...ter Function Initial SPI to master mode Syntax void spiMaster uint8_t mode Parameters mode SPI mode 0 CPOL 0 CPHA 0 Sample Rising Setup Falling 1 CPOL 0 CPHA 1 Setup Rising Sample Falling 2 CPOL 1 CPH...

Page 76: ...2MHz 0 OSC 4 1 OSC 16 2 OSC 64 3 OSC 128 Return value None spiSetDataOrder Function to set SPI order when sending data LSB first or MSB first Syntax void spiSetDataOrder uint8_t order Parameters order...

Page 77: ...yntax uint8_t spiTransferByte uint8_t data Parameters data byte to be sent Return value 1 byte data reading from SPI spiTransferWord Function to send and read 1 word from SPI port Syntax Uint16_t spiT...

Page 78: ...nt8_t address Parameters address E2 PROM address to read range 0 0x7FF Return value Data reading from E2 PROM eeprom_write_block Function to write block data to EEPROM Syntax void eeprom_write_byte vo...

Page 79: ...on LCD Syntax uint8_t touchDrawCalPoint POINT ptCal int n Parameters ptCal Calibration Coordinate n Calibration Coordinate No Return value None setCalibrationMatrix Function to set Calibration calcul...

Page 80: ...F the display of cursor text and graphic layer Syntax void lcdSwitchDisplay uint8_t display_switch Parameters display_switch Display switch flag DS_DISPLAY_OFF Turn off all display DS_TEXT_ON Turn ON...

Page 81: ...nd uint8_t y_end uint8_t pic_data uint8_t mode Parameters x_start X coordinate of the top left point of input picture UNIT pixel y_start Y coordinate of the top left point of input picture UNIT pixel...

Page 82: ...then fill it on the specified area Return value None lcdPrintString Function Print input string to specified location of text layer Syntax void lcdPrintString uint8_t x_start uint8_t y_start char stri...

Page 83: ...t8_t y_start uint8_t x_end uint8_t y_end Parameters x_start X coordinate of the top left point of rectangle UNIT pixel y_start Y coordinate of the top left point of rectangle UNIT pixel x_end X coordi...

Page 84: ...backlight PWM control functions Syntax void bklPWM_Init Parameters None Return value None bklSetBrightness Function Set current brightness value of backlight Syntax void bklSetBrightness uint8_t brig...

Page 85: ...ndix A LCD Controller Specification Appendix B EEPROM Specification Appendix C ATMEL ATmega644p MCU Specification Please download this specification from following ATMEL link http www atmel com dyn re...

Page 86: ...BEGV643A User Manual Ver 02 86 END of BEGV643A User Manual...

Reviews: