Forenex FES91W Series User Manual Download Page 5

 

http://www.forenex.com.tw

                                                -

5

4. 

Programming for FES91W

                   

………………………….……….……… 

4-1 Install Visual studio 2005 

4-1.1 Setup Development environment 

4-1.2 Create New Project 

4-1.3 Visual Basic Introduction. 

 

 

4-2 GPIO Control 

4-2.1 How to control GPIO for FES91W 

4-2.2 Example code 

4-3 PWM/ Backlight Control 

 

4-3.1 How to control PWM/ Backlight for FES91W 

4-3.2 Example code 

4-4 ADC Control 

 

4-4.1 How to control ADC for FES91W 

4-4.2 Example code 

 

 

4-5 Serial port Control 

 

 

4-5.1 Overview 

4-5.2 Member function of class SerialPort 

4-5.3 Example code 

4-6. SPI (Serial Peripheral Interface) Control

 

4-6.1 How to control SPI for FES91W 

 

 

 

 

 

 

 

 

***The content of this document is subject to be change without notice*** 

 

 

 

 

 

 

Summary of Contents for FES91W Series

Page 1: ...http www forenex com tw 1 FES91W Series User s Manual Preliminary...

Page 2: ...http www forenex com tw 2 Customer Customer Approved By Comment Module No Document No Version V2 3 Benson Wang Arthur Sung Hank Kuo Approved By Checked By Prepared By...

Page 3: ...ension changed more 1mm in D side page 9 2 Add VESA 75 hole in rear side page 9 3 Add reset hole in rear side page 22 4 Speaker connector change location page 29 5 Add SPI description page 48 1 Add Se...

Page 4: ...Serial port Rs232 test 2 4 2 Serial port Rs485 test 2 5 Device USB installation 2 5 1 USB Connect test 2 6 Host USB installation 2 7 SD MMC card installation 2 8 Extension Port installation 2 8 1 Port...

Page 5: ...4 2 2 Example code 4 3 PWM Backlight Control 4 3 1 How to control PWM Backlight for FES91W 4 3 2 Example code 4 4 ADC Control 4 4 1 How to control ADC for FES91W 4 4 2 Example code 4 5 Serial port Con...

Page 6: ...PU AT91SAM9M10 FES91Wxx xxx 64MB FES91W0x xxx 128MB FES91W1x xxx WLAN FES91WxA xxx CAN BUS FES91WxB xxx WLAN CAN BUS FES91WxC xxx 800x480 FES91Wxx 070 800x600 FES91Wxx 080 1024x768 FES91Wxx 104 Packin...

Page 7: ...Card DDR2 ADC x 4 Wi Fi WLAN Option 10 100 Ethernet RJ45 Extension Port 1 COM2 D SUB9 Male RS232 485 GPIO x 16 PWM x 2 Extension Port 2 SPI0 SPI1 COM4 CAN BUS Option LCD Touch 4 wire COM3 D SUB9 Male...

Page 8: ...thernet controller Audio AC97 Codec AMP inside for Ext Stereo speaker 8Ohm 1W Stereo Earphone Jack SD Slot SD MMC card Serial Port 5 wire RS232 x 1 COM2 connector sharing with RS485 422 3 wire RS232 x...

Page 9: ...http www forenex com tw 9 1 3 Mechanical Dimension Dimension Notice FES91xxx_080 with metal housing 193 2 mm x 145 8 mm x 36 3 mm FES91xxx_070 with metal housing 178 mm x 108 mm x 34 4 mm...

Page 10: ...n FES91W series 2 1 Power Plugging Or 2 2 Touch installation The following steps show how to use Coordinate calibration STEP 1 On Windows CE desktop click on My Device STEP 2 Select NandFlash folder 9...

Page 11: ...http www forenex com tw 11 STEP 3 Select the forenex ap folder STEP 4 Click Touch icon then Touch AP will display STEP 5 Click Adjust button...

Page 12: ...http www forenex com tw 12 This is WinCE Touch Calibration running in screen After using Touch Calibration system need reboot over suspend to store new touch parameter...

Page 13: ...al on PC end can read information from FES91W or input command to FES91W It was necessary that PC connect with FES91W The following steps show how to setup HyperTerminal on PC end STEP 1 Run the Hyper...

Page 14: ...able COM port click OK To find applicable COM port click Control panel system hardware device manager COM LPT ports STEP 3 Port Settings Bits per second or Baud rate 115200 Data bits 8 Parity None Sto...

Page 15: ...s to FES91W with cable reboot FES91W PC HyperTerminal will display information from FES91W STEP 4 Save information from FES91W On HyperTerminal click Transfer Capture Text Then select where to save th...

Page 16: ...nnector D_SUB9 is shared with the signals of RS485 422 Due to a terminating resistor 120 Ohm has been installed inside COM2 has to enable as master or the last slave device while COM2 be dedicated to...

Page 17: ...le as master or the last slave device while COM3 be dedicated to work in mode RS485 422 Working mode RS232 and RS485 422 can not be enable in simultaneously COM4 The port COM4 provided 3 wire RS232 on...

Page 18: ...s232 test The following steps show how to set HyperTerminal at PC end STEP 1 Run the hyper terminal on PC STEP 2 Select the applicable COM port click OK To find applicable COM port click Control panel...

Page 19: ...cond or Baud rate ranges from 9600 to 115200 and Flow control settings None Click on apply then OK Steps of PC end is complete Below steps guide is use Serialport ap at Windows CE STEP 1 On Windows CE...

Page 20: ...http www forenex com tw 20 STEP 3 Select Forenex ap folder STEP 4 Click SerialPort icon This is SerialPort ap running On Windows CE desktop...

Page 21: ...me as HyperTerminal and then click Open button to open serial port If COM port opened success it will display an open message If not it will display an error message STEP6 Typing some strings on the T...

Page 22: ...Rs485 test The following steps show how to use Rs485 on Serialport ap STEP 1 Select Rs485 and confirm parameters setting as same as HyperTerminal STEP 2 RE DE Select and then click Open to open serial...

Page 23: ...ary to download free software Microsoft ActiveSync The download website is http www microsoft com downloads en details aspx FamilyID 9e641c34 6f7f 404d a04 b dc09f8141141 The following pictures are Ac...

Page 24: ...the same content as the folder My Device of FES91W User can transfer files between PC and FES91W over USB cable When user transfer or delete data to folder Mobile Device FES91W folder My Device will s...

Page 25: ...On board Support a Host Device port with USB2 0 compliant Provide for upload data stream from external USB device 2 7 SD MMC card installation Support 1 4 bit data transmission Supported card SD MMC W...

Page 26: ...Pin9 SPI1_NPCS0 Pin10 SPI0_SPCK Pin11 SPI1_IRQ Pin12 SPI1_SPCK Pin13 ComRX3 Pin14 ComTX3 FES91W supports two sets of SPI SPI 0 and SPI 1 Each SPI can supported Master or Slave mode If CAN BUS install...

Page 27: ...Pin12 GND Pin13 3 3V 150mA out Pin14 5V 150mA out Min Typ Max Pin15 GPIO11 Pin16 GPIO9 Input Voltage level 3 3V Pin17 GPIO6 Pin18 GPIO10 Resolution 10 bit Pin19 GPIO7 Pin20 GPIO5 Throughput Rate Max 4...

Page 28: ...ww forenex com tw 28 2 8 3 GPIO test The following steps show how to use GPIO ap on Windows CE STEP 1 On Windows CE desktop click on My Device STEP 2 Select NandFlash folder STEP 3 Select Forenex ap f...

Page 29: ...http www forenex com tw 29 STEP 4 Click GPIO icon This is GPIO ap running On Windows CE desktop...

Page 30: ...IO pin can be set as Output mode or Input mode As Output mode each voltage level of GPIO port can be set to 1 or 0 by selecting Hi or Low As Input mode each voltage level of GPIO port can be read Hi 1...

Page 31: ...est STEP 1 Select GPIO ap and choose PWM ADC page Button ON OFF enable disable PWM channel individually Button Default recover the Frequency value back to 500 Hz and duty become 50 Factory Test is set...

Page 32: ...ion The external GND must be connected to GND of FES91W ADC voltage level have to be kept between 0 3 3V STEP 1 Select GPIO ap and then choose PWM ADC page ADC block is on the right side Click START b...

Page 33: ...http www forenex com tw 33 2 9 External stereo earphone installation Inside speaker would be muted while earphone has had plugged AC97 Codec inside Ext speaker with 8Ohm 1W Ext earphone...

Page 34: ...mode RMII RJ45 connector with LED indicator x 2 for active link status 2 10 1 Internet setting STEP1 Insert the internet line into the LAN port STEP2 Click Star Setting Network and Dail up connections...

Page 35: ...m tw 35 STEP4 Input a website 2 11 Wi Fi installation with an external dongle Optional WLAN Module with SDIO Interface Support WLAN module compliant with IEEE802 11b g n Operating on 2 4GHz ISM radio...

Page 36: ...logic to doing this Take a look at the following to examples to get an idea how to connect the CAN bus Example CAN Interface type 1 The following schematic shows the needed interface between FES91X an...

Page 37: ...er can refer below function table list to understand how to use these function 3 1 Function table Item Function name 1 gpio_output 2 gpio_input 3 pwm_config 4 pwm_status 5 adc_config 6 touch 7 spi_con...

Page 38: ...ns Hight Example gpio_output 1 1 Set GPIO pin 1 as output and voltage level is Hight Function gpio_input Prototype int gpio_input int pin_num Parameters 1 pin_num integer Return value 0 or 1 Descripti...

Page 39: ...screen will be flashing When duty_cycle value is 0 PWM would turn Off GPIOapp defines two different units of frequency one is Hz and another is KHz KHz is value 1 999 1000 Example pwm_config 1 100 50...

Page 40: ...000 as an integer To read the value of ADC channel by function call read_adc the result has to divide by 10000 to get back a real floating value In GPIO ap the value showed on screen is divided by 100...

Page 41: ...rs Delay Between Consecutive Transfers 32 delay 133MHz delay value between 0 and 255 mode Set 0 SPI is in Slave mode Set 1 SPI is in Master mode phase Set 0 Data is changed on the leading edge of Seri...

Page 42: ...CS after the last data has been wrote out Example spi_write 0 3 Spi_Wri_Data 0 Datas in the array 0 array 2 would be transmitted by SPI 0 CS keep active after the last data has been wrote out Function...

Page 43: ...Parameters 1 com_num integer 2 hi_low integer Return value None Description This function will set Com port to be Rs485 in write or read mode com_num Set Com2 or Com3 to be Rs485 1 COM1 dedicated for...

Page 44: ...s download windows emb edded ce6 aspx Follow below steps to download complete Visual Studio 2005 on Windows XP 1 Visual Studio 2005 Trial 2 Microsoft Visual Studio 2005 Team Suite Service Pack 1 3 Win...

Page 45: ...evelopment tool to create program which can running in Windows CE STEP 3 The first time user want to close project Visual Stdio 2005 will display a message to ask user want to save project or not clic...

Page 46: ...ex com tw 46 4 1 3 Visual Basic simple Introduction Introduction Interface User can double click object or drag object from toolbox to Form and From will display the choice object Object Properties of...

Page 47: ...he Form it will display on below block for example Serial port Select object and click the mouse right key it can select view code and will display program code It also can double click object program...

Page 48: ...code Below is a simple example code to use the GPIO controlling functions in Visual Studio 2005 Declaration loaded GPIO control function from DLL file DllImport fn_9g45_lib dll _ Public Shared Functio...

Page 49: ...w to execute GPIO function on ComboBox Private Sub ComboBox1_SelectedIndexChanged ByVal sender As System Object ByVal e As System EventArgs Handles ComboBox1 SelectedIndexChanged Dim input_status As I...

Page 50: ...er to below 4 3 2 The source code located the folder of CD FES91Wxx_xxx FES91W AP source code GPIO 4 3 2 Example code Below is a simple example code to use the PWM controlling functions in Visual Stud...

Page 51: ..._lib dll in public declare area of user s program STEP3 Use the function adc_config refer to below 4 4 2 The source code located the folder of CD FES91Wxx_xxx FES91W AP source code GPIO 4 4 2 Example...

Page 52: ...t Class user can use these class in Visual studio 2005 to control Serial port Serialport Property Name Description PortName Gets or sets the port for communications including but not limited to all av...

Page 53: ...ceive data The following program is how to execute serial port receive data Private Sub Timer1_Tick ByVal sender As System Object ByVal e As System EventArgs Handles Timer1 Tick Dim TmpStr As String D...

Page 54: ...b dll _ Public Shared Function rs485_status ByVal com_num As Integer ByVal hi_low As Integer As Integer End Function The following program is how to control Com2 in Rs485 to write or read Private Sub...

Page 55: ...ple example code to use the SPI controlling functions in Visual Studio 2005 Declaration loaded SPI control function from DLL file DllImport fn_9g45_lib dll _ Public Shared Function spi_config ByVal sp...

Page 56: ...m Spi_Rea_Data 3 As Integer Dim Spi_Rea_Len As Integer 3 Spi_Wri_Data 0 1 Spi_Wri_Data 1 2 Spi_Wri_Data 2 3 spi_write SPI_NUM Length Spi_Wri_Data spi_write 0 Spi_Wri_Len Spi_Wri_Data 0 spi_read SPI_NU...

Reviews: