Byte is not a member of Integer

C

cmdolcet69

Public Shared adc_value As word_byte
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class

pmsg(2) = CChar(adc_value.word16.high_byte)



I get the following error "high_byte is not a member of Integer" How
can i fix this
 
C

cmdolcet69

What is word16 ? Is it an integer rather than a byte_low_hi ?

---
Patrice

"cmdolcet69" <[email protected]> a écrit dans le message de (e-mail address removed)...






- Show quoted text -


These are all my declarations:

Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM

' Global Union Variables:
Public Shared crc_value As word_byte ' system crc value
Public Shared adc_value As word_byte ' adc value read from
table
Public Shared location_value As word_byte ' address of table
to send ADC value
Public Shared pmsg As Byte() = New Byte(24) {} ' crc buffer
Public Shared tsize As Integer



Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class


Public Structure word_byte
Public word16 As Integer
Public byte8 As byte_low_hi
End Structure
'Code Constants
'#Const BMS = True ' this represents the binary
message start byte, value 0x2A
'#Const PASSWD = True ' this represents the factory
pass code, value 11548d
'#Const POLY = True ' the polynomial used in the CRC
algorithm


Public Const BMS As Char = "*"c
Public Const PASSWD As Integer = &H2D1C
Public Const POLY As Integer = &H8005
 
P

Phillip Taylor

These are all my declarations:

Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM

' Global Union Variables:
Public Shared crc_value As word_byte ' system crc value
Public Shared adc_value As word_byte ' adc value read from
table
Public Shared location_value As word_byte ' address of table
to send ADC value
Public Shared pmsg As Byte() = New Byte(24) {} ' crc buffer
Public Shared tsize As Integer

Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class

Public Structure word_byte
Public word16 As Integer <-- type of Integer
Public byte8 As byte_low_hi
End Structure
'Code Constants
'#Const BMS = True ' this represents the binary
message start byte, value 0x2A
'#Const PASSWD = True ' this represents the factory
pass code, value 11548d
'#Const POLY = True ' the polynomial used in the CRC
algorithm

Public Const BMS As Char = "*"c
Public Const PASSWD As Integer = &H2D1C
Public Const POLY As Integer = &H8005

Well, there you go:

word16 is an Integer (4 bytes) rather than just a byte. You need to
cast it to the correct type.
 
C

cmdolcet69

Public word16 As Integer <-- type of Integer



Well, there you go:

word16 is an Integer (4 bytes) rather than just a byte. You need to
cast it to the correct type.- Hide quoted text -

- Show quoted text -

How do i cast it to the correct type?
 
A

Armin Zingler

It depends on what you want to do. You are trying to access a member that
does not exist. As the message says, "high_byte is not a member of Integer",
so you can not access it. Anyway it's confusing because word16 pretends to
be a 16-Bit integer, but it is declared as a 32 bit integer (Integer is
synonym for Int32), so either I would rename it to word32 or declare it as
Int16 (synonym for Short).

These are all my declarations:

Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM

' Global Union Variables:
Public Shared crc_value As word_byte ' system crc value
Public Shared adc_value As word_byte ' adc value read from
table
Public Shared location_value As word_byte ' address of table
to send ADC value
Public Shared pmsg As Byte() = New Byte(24) {} ' crc buffer
Public Shared tsize As Integer



Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class


Public Structure word_byte
Public word16 As Integer
Public byte8 As byte_low_hi
End Structure
'Code Constants
'#Const BMS = True ' this represents the binary
message start byte, value 0x2A
'#Const PASSWD = True ' this represents the factory
pass code, value 11548d
'#Const POLY = True ' the polynomial used in the CRC
algorithm


Public Const BMS As Char = "*"c
Public Const PASSWD As Integer = &H2D1C
Public Const POLY As Integer = &H8005


Armin
 
C

cmdolcet69

It depends on what you want to do. You are trying to access a member that
does not exist. As the message says, "high_byte is not a member of Integer",
so you can not access it. Anyway it's confusing because word16 pretends to
be a 16-Bit integer, but it is declared as a 32 bit integer (Integer is
synonym for Int32), so either I would rename it to word32 or declare it as
Int16 (synonym for Short).











Armin- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -

If i were to include all the code and give you a little bakground as
to what i wnat to do would you be able to help?
 
G

Guest

cmdolcet69,

It looks like you need to take a programming course and/or a Visual Basic
course.

Kerry Moorman
 
C

cmdolcet69

cmdolcet69,

It looks like you need to take a programming course and/or a Visual Basic
course.

Kerry Moorman





- Show quoted text -

Im a little confused with the data type structure, This would be the
first time i have ever implemented into a micro. My other skills are
strong.
 
P

Patrice

So word16 is an integer. high_byte is a member of byte_low_hi. So
word16.high_byte is something that doesn't exists.

I'm not sure how you would like to approach this :
- you could declare word16 as an integer (or short for a 16 bit value ???)
and extract the parts as needed
- you could declare word16 as a byte_low_hi and compute the corresponding 16
bit value as needed
- you could perhaps even declare a union (that is two structure that shares
the same underlying memroy area to access this a 16 bit value or as two
bytes depending on your needs; not remember to have tried this with .NET)

Another option would be to explain what you are trying to do in case somone
would suggest another simpler approach.

--
Patrice

"cmdolcet69" <[email protected]> a écrit dans le message de (e-mail address removed)...
What is word16 ? Is it an integer rather than a byte_low_hi ?

---
Patrice

"cmdolcet69" <[email protected]> a écrit dans le message de (e-mail address removed)...






- Show quoted text -


These are all my declarations:

Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM

' Global Union Variables:
Public Shared crc_value As word_byte ' system crc value
Public Shared adc_value As word_byte ' adc value read from
table
Public Shared location_value As word_byte ' address of table
to send ADC value
Public Shared pmsg As Byte() = New Byte(24) {} ' crc buffer
Public Shared tsize As Integer



Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class


Public Structure word_byte
Public word16 As Integer
Public byte8 As byte_low_hi
End Structure
'Code Constants
'#Const BMS = True ' this represents the binary
message start byte, value 0x2A
'#Const PASSWD = True ' this represents the factory
pass code, value 11548d
'#Const POLY = True ' the polynomial used in the CRC
algorithm


Public Const BMS As Char = "*"c
Public Const PASSWD As Integer = &H2D1C
Public Const POLY As Integer = &H8005
 
A

Armin Zingler

cmdolcet69 said:
If i were to include all the code and give you a little bakground as
to what i wnat to do would you be able to help?

I'm afraid, due to a lack of time, currently probably not.


Armin
 
P

Phillip Taylor

I'm afraid, due to a lack of time, currently probably not.

Armin

Just do this then if your running out of time:

msg(2) = CChar(Convert.ToByte(adc_value.word16))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top