473,320 Members | 1,828 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,320 software developers and data experts.

Vb 2003 - Supporting UInteger

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

MODERATOR.
Sep 10 '07 #2
Plater
7,872 Expert 4TB
It's just "uint" (which should be unsigned 32bit int)
(or you can give it a size spec too UInt16, UInt32, UInt64 )
Sep 10 '07 #3

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

Similar topics

0
by: MarionEll | last post by:
XML 2003 to Highlight Key Publishing Trend: XSL-FO Tools XSL-FO “Chef’s Tools Exhibition” Slated for 7 p.m. Dec. 10; Premier XML Industry Event Runs Dec. 7-12 in Philadelphia Alexandria,...
3
by: INGSOC | last post by:
I spent a few hours today setting up remote debugging in VS.2003 I had to disable the firewall, subvert the security scheme and let anonymous users have full access to my COM+ objects on my...
2
by: Kevin | last post by:
I'm thinking of moving data from Excel to Access to get around Excel's 1024-character limit on text-wrapping, and just learned that unless you do something with VB, text field-type in Access 2003...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
0
by: INGSOC | last post by:
Using remote debugging, I can attach to a windows service and run it in debug mode in VS.Net 2003. The problem is this service uses two supporting dlls. On the remote service, the dlls have...
10
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...
12
by: cmdolcet69 | last post by:
Can anyone give me some ideas on how to convert the following program to vb 2003? I would like to jsut take this code and implement it in vb. def.h /* Global Type Definitions */ typedef ...
1
by: cmdolcet69 | last post by:
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. Public Class GlobalMembers Public com1 As MSCOMM...
6
by: Excel 009 | last post by:
Hi, In my office I have Office 2003 on the PC. I created an Access application which has a component reference to Microsoft Office 12.0 Object Library. The problem that I am having now it...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.