background image

Chapter 2  Software

2-15

2.5.11 HlsbGetInt0Counter、HlsbGetInt1Counter

BOOL HlsbGetInt0Counter(HANDLE hlsbHandle, int mkyNo, BYTE *int0Counter)
BOOL HlsbGetInt1Counter(HANDLE hlsbHandle, int mkyNo, BYTE *int1Counter)

Format

Obtains the information of INT0, 1 interrupt count register retained in internal driver.
Interrupt count is incremented from 0 to 255 (0xFF)and returns to 0.

Function

Parameter

Succeeded : TRUE is returned.              Failed : FALSE is returned
You can check the details of error factor by executing HlsbGetLastError.

Return value

HLSB_SUCCESS

Terminated normally

HLSB_ERR_INVALID_HANDLE

Invalid hlsbHandle has been specified.

HLSB_ERR_INVALID_PARAM

mkyNo is out of range.
NULL has been specified to *int0Counter, *int1Counter.

HLSB_ERR_FAILED 

The process failed due to unknown reason.

Error code

hlsbHandle

Handle value of HLSB-36PCI2

mkyNo

Select MKY36 whose data to obtain. Input condition is the following.

・1 : MKY36#1,  2:MKY36#2

*int0Counter,*int1Counter

Pointer to the storage byte area of obtained interrupt count

Summary of Contents for HLSB-36PCI2

Page 1: ...HLS MKY36 PCI Board HLSB 36PCI2 User s Manual STD_HLSB36PCI2_V1 0E ...

Page 2: ...en this product and your system 3 We assume no responsibility whatsoever for any losses or damages arising from the use of the information products and circuits in this document or for infringement of patents and any other rights of a third party 4 When using this product and the information and circuits in this document we do not guarantee the right to use any property rights intellectual propert...

Page 3: ...HLSB 36PCI2 User s Manual Revision history Date Version Content Note AUG 2018 1 0E Issued the first edition ...

Page 4: ...S Prerequisites This manual assumes that you are familiar with Network technology Semiconductor products especially microcontrollers and memory Related manuals HLS Introduction Guide HLS Technical Guide MKY36 User s Manual Note Some terms in this manual are different from those that used in our website or product brochures The brochure uses ordinary terms to help many people in various industries ...

Page 5: ...3 2 5 API functions 2 4 2 5 1 HlsbGetVersion 2 5 2 5 2 HlsbGetLastError 2 6 2 5 3 HlsbSearchBoard 2 7 2 5 4 HlsbOpenHandle 2 8 2 5 5 HlsbCloseHandle 2 9 2 5 6 HlsbReadWord 2 10 2 5 7 HlsbWriteWord 2 11 2 5 8 HlsbReadData 2 12 2 5 9 HlsbWriteData 2 13 2 5 10 HlsbResetBoard 2 14 2 5 11 HlsbGetInt0Counter HlsbGetInt1Counter 2 15 2 5 12 HlsbClearInt0Counter HlsbClearInt1Counter 2 16 2 5 13 HlsbGetInt0...

Page 6: ... Table 1 2 Memory map 1 4 Table 2 1 API functions 2 4 Table 2 2 Version numbering 2 5 Table 2 3 Error code list 2 6 Table 2 4 Internal structure of Int0Info Int1info 2 17 Fig 1 1 Panel view 1 2 Fig 1 2 Connector peripheral circuits 1 2 Fig 1 3 Settings of HLSB 36PCI2 board 1 3 ...

Page 7: ...r embedded system with MKY36 The specifications of HLSB 36PCI2 are shown in Table 1 1 Type HLSB 36PCI2 Type of IC MKY36 2pcs Communication method HLS communication method full duplex half duplex Baud rate 3Mbps 6Mbps 12Mbps Supported bus PCI Ver2 2 supported 32bit 33MHz expansion bus 5V 3 3V supported Low profile supported Owned resource 16KB serial memory area Automatically allocated by PnP Inter...

Page 8: ... is connected to SCANL pin of MKY36 lit green when MKY36 is scanning CHK1 2 LED is connected to CHK1L and CHK2L pin of MKY36 Lit yellow when CHECK 1 is occurring lit red when CHECK 2 is occurring LED lit red if CHECK 1 and CHECK 2 are occurring at the same time CN2 CN3 HLS communication line Commercial CAT 5 or more greater straight through cable for 100BASE TX can be used Be sure that this is not...

Page 9: ...ll duplex and half duplex mode Note that the setting method of SW is different between MKY36 1 and MKY36 2 Full Half setting Board ID setting Full Half setting Notch1 2 left Notch2 3 right Notch1 2 left Notch2 3 right Panel F G connecting pad MKY36 1 Full duplex Set SW1 and SW2 to 2 3 Factory setting Half duplex Set SW1 and SW2 to 1 2 MKY36 2 Full duplex Set SW5 and SW6 to 1 2 Factory setting Half...

Page 10: ...ich is added the starting address of the board Table 1 2 Memory map Address Content 000H 595H MKY36 1 596H 7FFH Unused 800H D95H MKY36 2 D96H EFFH Unused F00H Chip Reset Register F02H Board ID Register F04H FFFH Unused Two MKY36 ICs are mounted on HLSB 36PCI2 MKY36 1 on the board is mapped to 000H to 595H MKY36 2 on the board is mapped to 800H to D95H For the details of memory map of MKY36 refer t...

Page 11: ... This register is write only so data will be undefined when reading the register Board ID Register Address F02H bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 R W R R R R R R R R R R R R R R R R Function BID1 BID0 Function The value of board ID set in SW9 can be obtained by reading BID0 1 Board ID For the details refer to 1 4 DIP switches Do not access to unused area 596H to 7FFH D96H to EFFH and F04H ...

Page 12: ...nused For this reason address to access needs to be specified 2 times longer than memory map mentioned above For example in order to read 200H address of MKY36 1 make the lower 16bit in 400H of HLSB 36PCI2 obtain 2 bytes data in 200H of MKY36 1 by executing 32bit Read In addition in order to write to 180H address of MKY36 2 the lower 16bit out of written 32bit data is written to 180H of MKY36 2 by...

Page 13: ... of supported OS and the latest software information refer to our website http www steptechnica com en index html All documents programs and program sources are belong to StepTechnica Co Ltd The individuals companies or other parties only who accept the cautions written below and use our HLSB 36PCI2 are licenced to copy or use of these works of StepTechnica Co Ltd You can not be revised and re dis...

Page 14: ...or Microsoft Visual C C which is created using VisualStudio2013 hlsb36pci2 h Header file for HLSB 36PCI2 Include this after than Windows h when using 2 4 Restrictions This chapter describes the restrictions at building an application using this API API in DLL can not be used from other threads at the same time In the case that an application has multithreading structure be sure not to be called fr...

Page 15: ...y interrupt factor register from user application Increment the value of interrupt count register Clear interrupt factor by writing 1 to the bit which is set 1 in 0 7 bit of INT0R 1 A function which returns the value of interrupt count register HlsbGetInt0Counter HlsbGetInt1Counter The internal driver retains interrupt count of each INT0 INT1 registers from MKY36 1 2 This function returns the coun...

Page 16: ...s to HLSB 36PCI2 HlsbWriteWord Write access to HLSB 36PCI2 HlsbReadData Specified word length read access to HLSB 36PCI2 HlsbWriteData Specified word length write access to HLSB 36PCI2 HlsbResetBoard Resets MKY36 HlsbGetInt0Counter HlsbGetInt1Counter Obtains INT0 INT1 interrupt count retained in the internal driver HlsbClearInt0Counter HlsbClearInt1Counter Clears INT0 INT1 interrupt count retained...

Page 17: ... advance The version number returned by this API is shown in Table 2 2 The reasons for updating the version number are as follows Major Number The revision with no backward compatibility such as API specification change Minor Number The revision with backward compatibility such as an addition of API function Update Number The revision with no specification change such as bug fixes The updates of M...

Page 18: ... Character constant Value Description HLSB_SUCCESS 0 Terminated normally HLSB_ERR_DEVICE_NOT_EXIST 1 Device does not exist HLSB_ERR_ALREADY_OPENED 2 Handle has already opened HLSB_ERR_CLOSED 3 HlsbOpenHandle has never been called HLSB_ERR_INVALID_HANDLE 4 Invalid handle value HLSB_ERR_INVALID_PARAM 5 Called with invalid parameter HLSB_ERR_NO_RESOUCE 6 No resource to execute the process HLSB_ERR_FA...

Page 19: ... units are connected to a PC and each board IDs are set in sequence 1st board ID 0 2nd board ID 1 3rd board ID 2 If the units have been identified by the PC in sequence with first third and second and run HlsbSearchBoard board number and its IDs are returned as follows board_num 3 board_id_list 0 0 board_id_list 1 2 board_id_list 2 1 board_id_list 3 0xFF HLSB_SUCCESS Terminated normally HLSB_ERR_I...

Page 20: ...ID 0 2nd board ID 1 3rd board ID 2 To obtain the handle value of Board ID 2 via user application operate as follows BYTE board_num BYTE board_id_list 4 HlsbSearchBoard board_num board_id_list 0 Check if the Board ID 2 the board to manipulate is set in board_id_list 4 board_id_list 0 0 board_id_list 1 2 board_id_list 2 1 board_id_list 3 0xFF In this case you see that the board ID to manipulate is s...

Page 21: ...is returned Failed FALSE is returned You can check the details of error factor by executing HlsbGetLastError Return value 2 5 5 HlsbCloseHandle Error code hlsbHandle Handle value of HLSB 36PCI2 HLSB_SUCCESS Terminated normally HLSB_ERR_INVALID_HANDLE Invalid hlsbHandle has been specified HLSB_ERR_FAILED The process failed due to unknown reason ...

Page 22: ...rmally HLSB_ERR_INVALID_HANDLE Invalid hlsbHandle has been specified HLSB_ERR_INVALID_PARAM Addr is out of range Set value is not multiple of 2 NULL has been specified to data HLSB_ERR_FAILED The process failed due to unknown reason hlsbHandle Handle value of HLSB 36PCI2 addr Offset address from the starting address Input conditions are the following Specify an address value which is multiples of ...

Page 23: ...rminated normally HLSB_ERR_INVALID_HANDLE Invalid hlsbHandle has been specified HLSB_ERR_INVALID_PARAM Addr is out of range Set value is not multiple of 2 NULL has been specified to data HLSB_ERR_FAILED The process failed due to unknown reason hlsbHandle Handle value of HLSB 36PCI2 addr Offset address from the starting address of the board Input conditions are the following Specify an address valu...

Page 24: ...HLSB_ERR_INVALID_PARAM Addr is out of range Set value is not multiple of 2 NULL has been specified to data Access range exceeds 0x1000 HLSB_ERR_FAILED The process failed due to unknown reason hlsbHandle Handle value of HLSB 36PCI2 addr Offset address from the starting address of the board Input conditions are the following Specify an address value which is multiples of 2 Input range 0x0000 to 0x0F...

Page 25: ...LID_PARAM Addr is out of range Set value is not multiple of 2 WordLen is out of range Access range exceeds 0x1000 NULL has been specified to data HLSB_ERR_FAILED The process failed due to unknown reason hlsbHandle Handle value of HLSB 36PCI2 addr Offset address from the starting address of the board Input conditions are the following Specify an address value which is multiples of 2 Input range 0x0...

Page 26: ...actor by executing HlsbGetLastError Return value Error code Note Wait more than 100ms to access MKY36 after reset HLSB_SUCCESS Terminated normally HLSB_ERR_INVALID_HANDLE Invalid hlsbHandle has been specified HLSB_ERR_INVALID_PARAM mkyNo is out of range HLSB_ERR_FAILED The process failed due to unknown reason hlsbHandle Handle value of HLSB 36PCI2 mkyNo Specify MKY36 to reset Input condition is th...

Page 27: ...UE is returned Failed FALSE is returned You can check the details of error factor by executing HlsbGetLastError Return value HLSB_SUCCESS Terminated normally HLSB_ERR_INVALID_HANDLE Invalid hlsbHandle has been specified HLSB_ERR_INVALID_PARAM mkyNo is out of range NULL has been specified to int0Counter int1Counter HLSB_ERR_FAILED The process failed due to unknown reason Error code hlsbHandle Handl...

Page 28: ...ameter Succeeded TRUE is returned Failed FALSE is returned You can check the details of error factor by executing HlsbGetLastError Return value HLSB_SUCCESS Terminated normally HLSB_ERR_INVALID_HANDLE Invalid hlsbHandle has been specified HLSB_ERR_INVALID_ PARAM mkyNo is out of range HLSB_ERR_FAILED The process failed due to unknown reason Error code hlsbHandle Handle value of HLSB 36PCI2 mkyNo Se...

Page 29: ...mkyNo Select MKY36 whose data to obtain Input condition is the following 1 MKY36 1 2 MKY36 2 int0Info int1Info Pointer to the storage byte area of obtained interrupt factor Information of interrupt factors which has been occurred are accumulated Note The configuration of parameters set to int0Info int1Info is shown in Table 2 4 When interrupt has occurred the bit which corresponds to its factor tu...

Page 30: ...unction Parameter Succeeded TRUE is returned Failed FALSE is returned You can check the details of error factor by executing HlsbGetLastError Return value HLSB_SUCCESS Terminated normally HLSB_ERR_INVALID_HANDLE Invalid hlsbHandle has been specified HLSB_ERR_INVALID_ PARAM mkyNo is out of range HLSB_ERR_FAILED The process failed due to unknown reason Error code hlsbHandle Handle value of HLSB 36PC...

Page 31: ...r i 0 i 0x580 i 2 HlsbWriteWord hlsbHandle i 0 2 Setting HLS scanning conditions to BCR Set FH 0 Half duplex BPS1 0 3 12Mbps HlsbWriteWord hlsbHandle 0x58E 0x0003 3 Write Do output status initial value to Do area 0x80 0xFF if necessary In this sample program it is processed without specifying the initial value Write FS Final Satelite to SCR HlsbWriteWord hlsbHandle 0x580 0x003F Obtain Di informati...

Page 32: ...x800 i 0xD80 i 2 HlsbWriteWord hlsbHandle i 0 2 Setting HLS scanning conditions to BCR Set FH 0 Half duplex BPS1 0 3 12Mbps HlsbWriteWord hlsbHandle 0x58E 0x0003 3 Write Do output status initial value to Do area 0x80 0xFF if necessary In this sample program it is processed without specifying the initial value Write FS Final Satelite to SCR HlsbWriteWord hlsbHandle 0xD80 0x003F Obtain Di informatio...

Page 33: ...ClearInt0Counter hlsbHandle 1 Interrupt count is 0 int0_lastTime_numOfOccurr 0 Set the interrupt factor Generate INT0 interrupt when CHECK 1 is occurring HlsbWriteWord hlsbHandle 0x586 0x2000 while 1 Obtain the information of interrupt count register HlsbGetInt0Counter hlsbHandle 1 int0_current_numOfOccurr An interrupt is occurring if it does not match with previous interrupt count if int0_lastTim...

Page 34: ...ctured by StepTechnica Co Ltd 757 3 Shimofujisawa Iruma Saitama http www steptechnica com en index html info steptechnica com HLS MKY36 PCI Board HLSB 36PCI2 User s Manual Document No STD_HLSB36PCI2_V1 0E Issued August 2018 ...

Reviews: