473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

VB 2003- Supporting UInteger as an Unsigned Integer

I'm having issues with the code below. I get the message that Uinteger is not defined. I need to make this data type as a unsigned integer.

Expand|Select|Wrap|Line Numbers
  1. Public Class GlobalMembers
  2.     Public com1 As MSCOMM
  3.     ' Global Union Variables: 
  4.     Public Shared crc_value As word_byte ' system crc value 
  5.     Public Shared adc_value As word_byte ' adc value read from table 
  6.     Public Shared location_value As word_byte ' address of table to send ADC value 
  7.     Public Shared pmsg As Byte() = New Byte(24) {} ' crc buffer 
  8.     Public Shared tsize As UInteger
  9.     ' Global Structure Definitions 
  10.     Public Class byte_low_hi
  11.         Public low_byte As Byte
  12.         Public high_byte As Byte
  13.     End Class
  14.     ' Global Union Definitions 
  15.     'C++ to VB CONVERTER TODO TASK: Unions are not supported in VB. 
  16.     'ORIGINAL LINE: union word_byte 
  17.     Public Structure word_byte
  18.         Public word16 As UInteger
  19.         Public byte8 As byte_low_hi
  20.     End Structure
  21.     'Code Constants 
  22. #Const BMS = True ' this represents the binary message start byte, value 0x2A 
  23. #Const PASSWD = True ' this represents the factory pass code, value 11548d 
  24. #Const POLY = True ' the polynomial used in the CRC algorithm 
  25.     Friend NotInheritable Class DefineConstants
  26.         Public Const BMS As Char = "*"c
  27.         Public Const PASSWD As Integer = &H2D1C
  28.         Public Const POLY As Integer = &H8005
  29.     End Class
  30.     Public Sub table_upload_req()
  31.         Dim Len As Byte = &H8
  32.         Dim Cmd As Byte = &H9
  33.         adc_value.word16 = &H0 ' read ADC value and put into storage var 
  34.         location_value.word16 = &H0
  35.         crc_value.word16 = 0
  36.  
  37.         Dim msg_size As Byte = Len - 2
  38.  
  39.         pmsg(0) = AscW(Len)
  40.         pmsg(1) = AscW(Cmd)
  41.  
  42.         Dim i As Integer = 0
  43.         Do While i < tsize
  44.  
  45.             ' single table upload request packet 
  46.             location_value.word16 += 1
  47.             adc_value.word16 = ADC_AVE(i)
  48.  
  49.             pmsg(2) = CChar(adc_value.word16.high_byte)
  50.             pmsg(3) = CChar(adc_value.word16.low_byte)
  51.             pmsg(4) = CChar(location_value.word16.high_byte)
  52.             pmsg(5) = CChar(location_value.word16.low_byte)
  53.  
  54.             crc_value.word16 = Make_Bitwise_CRC16(Of UInteger, msg_size)()
  55.             com1.Output = DefineConstants.BMS + pmsg(0) + pmsg(1) + pmsg(2) + pmsg(3) + pmsg(4) + pmsg(5) + CChar(crc_value.word16.high_byte) + CChar(crc_value.word16.low_byte)
  56.             tsize += 1
  57.         Loop
  58.     End Sub
  59.     Public Function Make_Bitwise_CRC16(ByVal msg_size As UInteger) As Integer
  60.         Dim i As UInteger
  61.         Dim j As UInteger
  62.         Dim msg As UInteger
  63.         For i = 0 To msg_size - 1
  64.             msg = (pmsg(i) << 8)
  65.             For j = 0 To 7
  66.                 If ((msg Xor crc_value.word16) >> 15) > 0 Then
  67.                     crc_value.word16 = (crc_value.word16 << 1) Xor DefineConstants.POLY
  68.                 Else
  69.                     crc_value.word16 <<= 1
  70.                 End If
  71.                 msg <<= 1
  72.             Next j
  73.         Next i
  74.         Return (crc_value.word16 Xor 0)
  75.     End Function
  76. End Class
  77.  
Sep 10 '07 #1
1 1879
SammyB
807 Expert 512MB
As they told you on PC Review, in VB2003, you do not have UInteger keyword. You must use System.UInt32.
Sep 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David Lee | last post by:
Need some help bad here. Am using VB.Net Standard 2003 supplied for a class and I need to install Msde and the sample databases to work on homework. Following the documentation I can download...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
0
by: MarionEll | last post by:
Premier XML Industry Event Slated for Dec. 7-12 in Philadelphia; Presenters Include Adobe, BEA, Microsoft, IBM, Sun, Hewlett-Packard, Oracle Alexandria, Va. Sept. 30, 2003 - IDEAlliance, a...
0
by: MarionEll | last post by:
Premier XML Industry Event Slated for Dec. 7-12 in Philadelphia; Presenters Include Adobe, BEA, Microsoft, IBM, Sun, Hewlett-Packard, Oracle Alexandria, Va. Sept. 30, 2003 - IDEAlliance, a...
6
by: David Waz... | last post by:
Moved an app from W/2000 Asp V1.0 to W/2003, VS/2003, ASPV 1.1 Page runs a long job, uploading 2 large fixed length files (300,000 rows) into SQL database. A process is run against the data,...
22
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.